summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--include/delphi/m_netlib.inc2
-rw-r--r--include/m_core.h1
-rw-r--r--include/m_netlib.h4
-rw-r--r--include/m_system.h2
-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
-rw-r--r--protocols/AimOscar/src/avatars.cpp2
-rw-r--r--protocols/AimOscar/src/chat.cpp6
-rw-r--r--protocols/AimOscar/src/client.cpp2
-rw-r--r--protocols/AimOscar/src/file.cpp4
-rw-r--r--protocols/AimOscar/src/popup.cpp4
-rw-r--r--protocols/AimOscar/src/proto.cpp4
-rw-r--r--protocols/AimOscar/src/server.cpp18
-rw-r--r--protocols/AimOscar/src/services.cpp6
-rw-r--r--protocols/AimOscar/src/theme.cpp20
-rw-r--r--protocols/AimOscar/src/ui.cpp34
-rw-r--r--protocols/AimOscar/src/utility.cpp14
-rw-r--r--protocols/Dummy/src/dummy_options.cpp4
-rw-r--r--protocols/FacebookRM/src/avatars.cpp2
-rw-r--r--protocols/FacebookRM/src/captcha.cpp2
-rw-r--r--protocols/FacebookRM/src/chat.cpp8
-rw-r--r--protocols/FacebookRM/src/communication.cpp6
-rw-r--r--protocols/FacebookRM/src/contacts.cpp2
-rw-r--r--protocols/FacebookRM/src/dialogs.cpp24
-rw-r--r--protocols/FacebookRM/src/json.cpp4
-rw-r--r--protocols/FacebookRM/src/proto.cpp12
-rw-r--r--protocols/FacebookRM/src/theme.cpp4
-rw-r--r--protocols/GTalkExt/src/avatar.cpp4
-rw-r--r--protocols/GTalkExt/src/menu.cpp2
-rw-r--r--protocols/GTalkExt/src/notifications.cpp2
-rw-r--r--protocols/GTalkExt/src/options.cpp2
-rw-r--r--protocols/GTalkExt/src/tipper_items.cpp2
-rw-r--r--protocols/Gadu-Gadu/src/avatar.cpp4
-rw-r--r--protocols/Gadu-Gadu/src/core.cpp14
-rw-r--r--protocols/Gadu-Gadu/src/dialogs.cpp72
-rw-r--r--protocols/Gadu-Gadu/src/filetransfer.cpp8
-rw-r--r--protocols/Gadu-Gadu/src/gg.cpp16
-rw-r--r--protocols/Gadu-Gadu/src/gg_proto.cpp14
-rw-r--r--protocols/Gadu-Gadu/src/groupchat.cpp8
-rw-r--r--protocols/Gadu-Gadu/src/icolib.cpp10
-rw-r--r--protocols/Gadu-Gadu/src/image.cpp10
-rw-r--r--protocols/Gadu-Gadu/src/import.cpp58
-rw-r--r--protocols/Gadu-Gadu/src/oauth.cpp2
-rw-r--r--protocols/Gadu-Gadu/src/popups.cpp12
-rw-r--r--protocols/Gadu-Gadu/src/services.cpp10
-rw-r--r--protocols/Gadu-Gadu/src/sessions.cpp20
-rw-r--r--protocols/Gadu-Gadu/src/token.cpp2
-rw-r--r--protocols/Gadu-Gadu/src/userutils.cpp10
-rw-r--r--protocols/IRCG/src/clist.cpp2
-rw-r--r--protocols/IRCG/src/commandmonitor.cpp18
-rw-r--r--protocols/IRCG/src/input.cpp10
-rw-r--r--protocols/IRCG/src/irclib.cpp6
-rw-r--r--protocols/IRCG/src/ircproto.cpp10
-rw-r--r--protocols/IRCG/src/options.cpp126
-rw-r--r--protocols/IRCG/src/services.cpp14
-rw-r--r--protocols/IRCG/src/tools.cpp2
-rw-r--r--protocols/IRCG/src/userinfo.cpp8
-rw-r--r--protocols/IRCG/src/windows.cpp66
-rw-r--r--protocols/IcqOscarJ/src/capabilities.cpp4
-rw-r--r--protocols/IcqOscarJ/src/constants.cpp2
-rw-r--r--protocols/IcqOscarJ/src/db.cpp6
-rw-r--r--protocols/IcqOscarJ/src/dlgproc.cpp14
-rw-r--r--protocols/IcqOscarJ/src/editlist.cpp2
-rw-r--r--protocols/IcqOscarJ/src/editstring.cpp8
-rw-r--r--protocols/IcqOscarJ/src/fam_01service.cpp2
-rw-r--r--protocols/IcqOscarJ/src/fam_04message.cpp4
-rw-r--r--protocols/IcqOscarJ/src/fam_13servclist.cpp10
-rw-r--r--protocols/IcqOscarJ/src/fam_15icqserver.cpp16
-rw-r--r--protocols/IcqOscarJ/src/icq_advsearch.cpp4
-rw-r--r--protocols/IcqOscarJ/src/icq_avatar.cpp8
-rw-r--r--protocols/IcqOscarJ/src/icq_clients.cpp12
-rw-r--r--protocols/IcqOscarJ/src/icq_firstrun.cpp6
-rw-r--r--protocols/IcqOscarJ/src/icq_http.cpp6
-rw-r--r--protocols/IcqOscarJ/src/icq_menu.cpp2
-rw-r--r--protocols/IcqOscarJ/src/icq_opts.cpp28
-rw-r--r--protocols/IcqOscarJ/src/icq_popups.cpp12
-rw-r--r--protocols/IcqOscarJ/src/icq_proto.cpp16
-rw-r--r--protocols/IcqOscarJ/src/icq_servlist.cpp18
-rw-r--r--protocols/IcqOscarJ/src/icq_uploadui.cpp4
-rw-r--r--protocols/IcqOscarJ/src/icq_xstatus.cpp12
-rw-r--r--protocols/IcqOscarJ/src/icqosc_svcs.cpp4
-rw-r--r--protocols/IcqOscarJ/src/log.cpp6
-rw-r--r--protocols/IcqOscarJ/src/loginpassword.cpp4
-rw-r--r--protocols/IcqOscarJ/src/oscar_filetransfer.cpp4
-rw-r--r--protocols/IcqOscarJ/src/userinfotab.cpp2
-rw-r--r--protocols/JabberG/src/jabber.cpp4
-rw-r--r--protocols/JabberG/src/jabber_adhoc.cpp8
-rw-r--r--protocols/JabberG/src/jabber_archive.cpp2
-rw-r--r--protocols/JabberG/src/jabber_bookmarks.cpp10
-rw-r--r--protocols/JabberG/src/jabber_byte.cpp8
-rw-r--r--protocols/JabberG/src/jabber_caps.cpp16
-rw-r--r--protocols/JabberG/src/jabber_captcha.cpp2
-rw-r--r--protocols/JabberG/src/jabber_chat.cpp42
-rw-r--r--protocols/JabberG/src/jabber_console.cpp20
-rw-r--r--protocols/JabberG/src/jabber_disco.cpp12
-rw-r--r--protocols/JabberG/src/jabber_events.cpp2
-rw-r--r--protocols/JabberG/src/jabber_file.cpp10
-rw-r--r--protocols/JabberG/src/jabber_filterlist.cpp4
-rw-r--r--protocols/JabberG/src/jabber_ft.cpp2
-rw-r--r--protocols/JabberG/src/jabber_groupchat.cpp14
-rw-r--r--protocols/JabberG/src/jabber_icolib.cpp42
-rw-r--r--protocols/JabberG/src/jabber_iq_handlers.cpp14
-rw-r--r--protocols/JabberG/src/jabber_iqid.cpp38
-rw-r--r--protocols/JabberG/src/jabber_iqid_muc.cpp14
-rw-r--r--protocols/JabberG/src/jabber_menu.cpp18
-rw-r--r--protocols/JabberG/src/jabber_misc.cpp12
-rw-r--r--protocols/JabberG/src/jabber_opt.cpp76
-rw-r--r--protocols/JabberG/src/jabber_password.cpp6
-rw-r--r--protocols/JabberG/src/jabber_privacy.cpp28
-rw-r--r--protocols/JabberG/src/jabber_proto.cpp20
-rw-r--r--protocols/JabberG/src/jabber_rc.cpp22
-rw-r--r--protocols/JabberG/src/jabber_search.cpp22
-rw-r--r--protocols/JabberG/src/jabber_secur.cpp16
-rw-r--r--protocols/JabberG/src/jabber_std.cpp6
-rw-r--r--protocols/JabberG/src/jabber_svc.cpp6
-rw-r--r--protocols/JabberG/src/jabber_thread.cpp20
-rw-r--r--protocols/JabberG/src/jabber_userinfo.cpp26
-rw-r--r--protocols/JabberG/src/jabber_util.cpp8
-rw-r--r--protocols/JabberG/src/jabber_vcard.cpp64
-rw-r--r--protocols/JabberG/src/jabber_ws.cpp2
-rw-r--r--protocols/JabberG/src/jabber_xstatus.cpp38
-rw-r--r--protocols/MRA/src/MraAdvancedSearch.cpp14
-rw-r--r--protocols/MRA/src/MraAvatars.cpp18
-rw-r--r--protocols/MRA/src/MraChat.cpp2
-rw-r--r--protocols/MRA/src/MraFilesQueue.cpp44
-rw-r--r--protocols/MRA/src/MraIcons.cpp10
-rw-r--r--protocols/MRA/src/MraPlaces.h4
-rw-r--r--protocols/MRA/src/MraPopUp.cpp28
-rw-r--r--protocols/MRA/src/MraProto.cpp8
-rw-r--r--protocols/MRA/src/MraSelectEMail.cpp6
-rw-r--r--protocols/MRA/src/Mra_functions.cpp36
-rw-r--r--protocols/MRA/src/Mra_menus.cpp6
-rw-r--r--protocols/MRA/src/Mra_options.cpp10
-rw-r--r--protocols/MRA/src/Mra_proto.cpp16
-rw-r--r--protocols/MRA/src/Mra_svcs.cpp12
-rw-r--r--protocols/MSN/src/msn_auth.cpp8
-rw-r--r--protocols/MSN/src/msn_avatar.cpp2
-rw-r--r--protocols/MSN/src/msn_chat.cpp14
-rw-r--r--protocols/MSN/src/msn_commands.cpp54
-rw-r--r--protocols/MSN/src/msn_errors.cpp4
-rw-r--r--protocols/MSN/src/msn_ftold.cpp6
-rw-r--r--protocols/MSN/src/msn_lists.cpp4
-rw-r--r--protocols/MSN/src/msn_mail.cpp10
-rw-r--r--protocols/MSN/src/msn_menu.cpp8
-rw-r--r--protocols/MSN/src/msn_mime.cpp2
-rw-r--r--protocols/MSN/src/msn_misc.cpp30
-rw-r--r--protocols/MSN/src/msn_natdetect.cpp2
-rw-r--r--protocols/MSN/src/msn_opts.cpp34
-rw-r--r--protocols/MSN/src/msn_p2p.cpp16
-rw-r--r--protocols/MSN/src/msn_proto.cpp8
-rw-r--r--protocols/MSN/src/msn_soapab.cpp14
-rw-r--r--protocols/MSN/src/msn_soapstore.cpp4
-rw-r--r--protocols/MSN/src/msn_svcs.cpp8
-rw-r--r--protocols/MinecraftDynmap/src/dialogs.cpp8
-rw-r--r--protocols/MinecraftDynmap/src/main.cpp6
-rw-r--r--protocols/Omegle/src/communication.cpp12
-rw-r--r--protocols/Omegle/src/dialogs.cpp10
-rw-r--r--protocols/Omegle/src/main.cpp2
-rw-r--r--protocols/Omegle/src/proto.cpp2
-rw-r--r--protocols/Omegle/src/theme.cpp6
-rw-r--r--protocols/Omegle/src/utils.cpp2
-rw-r--r--protocols/Sametime/src/conference.cpp6
-rw-r--r--protocols/Sametime/src/files.cpp2
-rw-r--r--protocols/Sametime/src/messaging.cpp2
-rw-r--r--protocols/Sametime/src/options.cpp4
-rw-r--r--protocols/Sametime/src/sametime.cpp8
-rw-r--r--protocols/Sametime/src/sametime_proto.cpp6
-rw-r--r--protocols/Sametime/src/sametime_session.cpp4
-rw-r--r--protocols/Sametime/src/utils.cpp12
-rw-r--r--protocols/SkypeWeb/src/http_request.h2
-rw-r--r--protocols/SkypeWeb/src/skype_avatars.cpp12
-rw-r--r--protocols/SkypeWeb/src/skype_chatrooms.cpp6
-rw-r--r--protocols/SkypeWeb/src/skype_icons.cpp12
-rw-r--r--protocols/SkypeWeb/src/skype_login.cpp2
-rw-r--r--protocols/SkypeWeb/src/skype_menus.cpp2
-rw-r--r--protocols/SkypeWeb/src/skype_proto.cpp2
-rw-r--r--protocols/SkypeWeb/src/skype_utils.cpp6
-rw-r--r--protocols/Steam/src/api/friend_list.h18
-rw-r--r--protocols/Steam/src/api/login.h4
-rw-r--r--protocols/Steam/src/api/pending.h18
-rw-r--r--protocols/Steam/src/api/session.h2
-rw-r--r--protocols/Steam/src/http_request.h2
-rw-r--r--protocols/Steam/src/main.cpp2
-rw-r--r--protocols/Steam/src/steam_avatars.cpp2
-rw-r--r--protocols/Steam/src/steam_contacts.cpp2
-rw-r--r--protocols/Steam/src/steam_dialogs.cpp10
-rw-r--r--protocols/Steam/src/steam_menus.cpp4
-rw-r--r--protocols/Steam/src/steam_proto.cpp8
-rw-r--r--protocols/Steam/src/steam_xstatus.cpp4
-rw-r--r--protocols/Tlen/src/tlen.cpp8
-rw-r--r--protocols/Tlen/src/tlen_advsearch.cpp2
-rw-r--r--protocols/Tlen/src/tlen_avatar.cpp8
-rw-r--r--protocols/Tlen/src/tlen_file.cpp4
-rw-r--r--protocols/Tlen/src/tlen_iqid.cpp8
-rw-r--r--protocols/Tlen/src/tlen_muc.cpp10
-rw-r--r--protocols/Tlen/src/tlen_opt.cpp22
-rw-r--r--protocols/Tlen/src/tlen_p2p_new.cpp4
-rw-r--r--protocols/Tlen/src/tlen_picture.cpp16
-rw-r--r--protocols/Tlen/src/tlen_svc.cpp4
-rw-r--r--protocols/Tlen/src/tlen_thread.cpp12
-rw-r--r--protocols/Tlen/src/tlen_userinfo.cpp2
-rw-r--r--protocols/Tlen/src/tlen_voice.cpp14
-rw-r--r--protocols/Tlen/src/tlen_ws.cpp4
-rw-r--r--protocols/Tox/src/tox_avatars.cpp6
-rw-r--r--protocols/Tox/src/tox_chatrooms.cpp2
-rw-r--r--protocols/Tox/src/tox_icons.cpp14
-rw-r--r--protocols/Tox/src/tox_menus.cpp2
-rw-r--r--protocols/Tox/src/tox_multimedia.cpp16
-rw-r--r--protocols/Tox/src/tox_netlib.cpp2
-rw-r--r--protocols/Tox/src/tox_network.cpp10
-rw-r--r--protocols/Tox/src/tox_options.cpp24
-rw-r--r--protocols/Tox/src/tox_profile.cpp2
-rw-r--r--protocols/Tox/src/tox_search.cpp16
-rw-r--r--protocols/Tox/src/tox_transfer.cpp2
-rw-r--r--protocols/Twitter/src/connection.cpp2
-rw-r--r--protocols/Twitter/src/main.cpp2
-rw-r--r--protocols/Twitter/src/oauth.cpp8
-rw-r--r--protocols/Twitter/src/proto.cpp14
-rw-r--r--protocols/Twitter/src/theme.cpp14
-rw-r--r--protocols/Twitter/src/ui.cpp32
-rw-r--r--protocols/VKontakte/src/misc.cpp26
-rw-r--r--protocols/VKontakte/src/vk_avatars.cpp8
-rw-r--r--protocols/VKontakte/src/vk_captcha.cpp2
-rw-r--r--protocols/VKontakte/src/vk_chats.cpp8
-rw-r--r--protocols/VKontakte/src/vk_options.cpp16
-rw-r--r--protocols/VKontakte/src/vk_proto.cpp2
-rw-r--r--protocols/VKontakte/src/vk_search.cpp2
-rw-r--r--protocols/VKontakte/src/vk_wallpost.cpp4
-rw-r--r--protocols/WhatsApp/src/avatars.cpp4
-rw-r--r--protocols/WhatsApp/src/chat.cpp10
-rw-r--r--protocols/WhatsApp/src/contacts.cpp2
-rw-r--r--protocols/WhatsApp/src/messages.cpp2
-rw-r--r--protocols/WhatsApp/src/proto.cpp2
-rw-r--r--protocols/WhatsApp/src/theme.cpp6
-rw-r--r--protocols/Xfire/src/Xfire_base.cpp34
-rw-r--r--protocols/Xfire/src/Xfire_game.cpp8
-rw-r--r--protocols/Xfire/src/Xfire_icon_mng.cpp2
-rw-r--r--protocols/Xfire/src/Xfire_voicechat.cpp2
-rw-r--r--protocols/Xfire/src/addgamedialog.cpp34
-rw-r--r--protocols/Xfire/src/buddylist.cpp2
-rw-r--r--protocols/Xfire/src/iniupdater.cpp16
-rw-r--r--protocols/Xfire/src/main.cpp76
-rw-r--r--protocols/Xfire/src/options.cpp30
-rw-r--r--protocols/Xfire/src/passworddialog.cpp2
-rw-r--r--protocols/Xfire/src/processbuddyinfo.cpp6
-rw-r--r--protocols/Xfire/src/pwd_dlg.cpp2
-rw-r--r--protocols/Xfire/src/searching4games.cpp22
-rw-r--r--protocols/Xfire/src/setnickname.cpp2
-rw-r--r--protocols/Xfire/src/tools.cpp4
-rw-r--r--protocols/Xfire/src/userdetails.cpp18
-rw-r--r--protocols/Xfire/src/variables.cpp4
-rw-r--r--protocols/Yahoo/src/avatar.cpp8
-rw-r--r--protocols/Yahoo/src/chat.cpp18
-rw-r--r--protocols/Yahoo/src/file_transfer.cpp4
-rw-r--r--protocols/Yahoo/src/icolib.cpp8
-rw-r--r--protocols/Yahoo/src/im.cpp2
-rw-r--r--protocols/Yahoo/src/options.cpp10
-rw-r--r--protocols/Yahoo/src/proto.cpp6
-rw-r--r--protocols/Yahoo/src/search.cpp2
-rw-r--r--protocols/Yahoo/src/services.cpp12
-rw-r--r--protocols/Yahoo/src/util.cpp4
-rw-r--r--protocols/Yahoo/src/yahoo.cpp22
-rw-r--r--src/core/stdauth/src/auth.cpp10
-rw-r--r--src/core/stdauth/src/authdialogs.cpp30
-rw-r--r--src/core/stdaway/src/awaymsg.cpp10
-rw-r--r--src/core/stdaway/src/sendmsg.cpp22
-rw-r--r--src/core/stdchat/src/main.cpp26
-rw-r--r--src/core/stdchat/src/options.cpp42
-rw-r--r--src/core/stdchat/src/tools.cpp6
-rw-r--r--src/core/stdchat/src/window.cpp18
-rw-r--r--src/core/stdclist/src/clcfonts.cpp18
-rw-r--r--src/core/stdclist/src/clcopts.cpp18
-rw-r--r--src/core/stdclist/src/clcpaint.cpp4
-rw-r--r--src/core/stdclist/src/cluiopts.cpp2
-rw-r--r--src/core/stdfile/src/file.cpp6
-rw-r--r--src/core/stdfile/src/fileexistsdlg.cpp30
-rw-r--r--src/core/stdfile/src/fileopts.cpp24
-rw-r--r--src/core/stdfile/src/filerecvdlg.cpp32
-rw-r--r--src/core/stdfile/src/filesenddlg.cpp16
-rw-r--r--src/core/stdfile/src/filexferdlg.cpp28
-rw-r--r--src/core/stdhelp/src/about.cpp6
-rw-r--r--src/core/stdidle/src/idle.cpp4
-rw-r--r--src/core/stdmsg/src/globals.cpp2
-rw-r--r--src/core/stdmsg/src/msgdialog.cpp34
-rw-r--r--src/core/stdmsg/src/msglog.cpp12
-rw-r--r--src/core/stdmsg/src/msgoptions.cpp10
-rw-r--r--src/core/stdmsg/src/msgs.cpp10
-rw-r--r--src/core/stdssl/src/netlibssl.cpp20
-rw-r--r--src/core/stduihist/src/history.cpp14
-rw-r--r--src/core/stdurl/url.cpp4
-rw-r--r--src/core/stdurl/urldialogs.cpp26
-rw-r--r--src/core/stduserinfo/src/contactinfo.cpp26
-rw-r--r--src/core/stduserinfo/src/stdinfo.cpp16
-rw-r--r--src/core/stduserinfo/src/userinfo.cpp10
-rw-r--r--src/core/stduseronline/src/useronline.cpp2
-rw-r--r--src/mir_app/src/DefaultExtraIcons.cpp14
-rw-r--r--src/mir_app/src/FontOptions.cpp8
-rw-r--r--src/mir_app/src/FontService.cpp6
-rw-r--r--src/mir_app/src/button.cpp2
-rw-r--r--src/mir_app/src/chat_clist.cpp2
-rw-r--r--src/mir_app/src/chat_log.cpp12
-rw-r--r--src/mir_app/src/chat_opts.cpp4
-rw-r--r--src/mir_app/src/chat_tools.cpp20
-rw-r--r--src/mir_app/src/clc.cpp12
-rw-r--r--src/mir_app/src/clcfiledrop.cpp4
-rw-r--r--src/mir_app/src/clcitems.cpp12
-rw-r--r--src/mir_app/src/clcmsgs.cpp2
-rw-r--r--src/mir_app/src/clcutils.cpp4
-rw-r--r--src/mir_app/src/clistmenus.cpp36
-rw-r--r--src/mir_app/src/clistmod.cpp16
-rw-r--r--src/mir_app/src/clisttray.cpp14
-rw-r--r--src/mir_app/src/clui.cpp16
-rw-r--r--src/mir_app/src/cluiservices.cpp6
-rw-r--r--src/mir_app/src/contact.cpp4
-rw-r--r--src/mir_app/src/contacts.cpp6
-rw-r--r--src/mir_app/src/database.cpp30
-rw-r--r--src/mir_app/src/dbini.cpp28
-rw-r--r--src/mir_app/src/dbutils.cpp6
-rw-r--r--src/mir_app/src/extraicons.cpp2
-rw-r--r--src/mir_app/src/filter.cpp12
-rw-r--r--src/mir_app/src/findadd.cpp16
-rw-r--r--src/mir_app/src/genmenu.cpp16
-rw-r--r--src/mir_app/src/genmenuopt.cpp12
-rw-r--r--src/mir_app/src/groups.cpp34
-rw-r--r--src/mir_app/src/hotkey_opts.cpp18
-rw-r--r--src/mir_app/src/hotkeys.cpp6
-rw-r--r--src/mir_app/src/hyperlink.cpp4
-rw-r--r--src/mir_app/src/icolib.cpp4
-rw-r--r--src/mir_app/src/ignore.cpp10
-rw-r--r--src/mir_app/src/langpack.cpp2
-rw-r--r--src/mir_app/src/lpopts.cpp14
-rw-r--r--src/mir_app/src/meta_main.cpp2
-rw-r--r--src/mir_app/src/meta_menu.cpp2
-rw-r--r--src/mir_app/src/meta_services.cpp4
-rw-r--r--src/mir_app/src/meta_utils.cpp6
-rw-r--r--src/mir_app/src/miranda.cpp6
-rw-r--r--src/mir_app/src/netlib.cpp4
-rw-r--r--src/mir_app/src/netlibautoproxy.cpp6
-rw-r--r--src/mir_app/src/netlibbind.cpp2
-rw-r--r--src/mir_app/src/netlibhttp.cpp12
-rw-r--r--src/mir_app/src/netliblog.cpp32
-rw-r--r--src/mir_app/src/netlibopts.cpp14
-rw-r--r--src/mir_app/src/netlibsecurity.cpp2
-rw-r--r--src/mir_app/src/netlibsock.cpp2
-rw-r--r--src/mir_app/src/netlibupnp.cpp6
-rw-r--r--src/mir_app/src/newplugins.cpp30
-rw-r--r--src/mir_app/src/options.cpp24
-rw-r--r--src/mir_app/src/path.cpp30
-rw-r--r--src/mir_app/src/pluginopts.cpp16
-rw-r--r--src/mir_app/src/profilemanager.cpp26
-rw-r--r--src/mir_app/src/proto_accs.cpp2
-rw-r--r--src/mir_app/src/proto_opts.cpp18
-rw-r--r--src/mir_app/src/proto_utils.cpp6
-rw-r--r--src/mir_app/src/searchresults.cpp6
-rw-r--r--src/mir_app/src/services.cpp6
-rw-r--r--src/mir_app/src/skin2opts.cpp18
-rw-r--r--src/mir_app/src/skinicons.cpp44
-rw-r--r--src/mir_app/src/sounds.cpp6
-rw-r--r--src/mir_app/src/utils.cpp12
-rw-r--r--src/mir_app/src/visibility.cpp6
-rw-r--r--src/mir_app/src/xmlParser.cpp2
-rw-r--r--src/mir_core/src/langpack.cpp22
-rw-r--r--src/mir_core/src/path.cpp10
-rw-r--r--src/mir_core/src/timezones.cpp16
-rw-r--r--src/mir_core/src/ui_utils.cpp6
-rw-r--r--src/mir_core/src/winutil.cpp16
-rw-r--r--src/mir_core/src/winver.cpp4
929 files changed, 5928 insertions, 5929 deletions
diff --git a/include/delphi/m_netlib.inc b/include/delphi/m_netlib.inc
index fe46250469..e2d87ee369 100644
--- a/include/delphi/m_netlib.inc
+++ b/include/delphi/m_netlib.inc
@@ -154,7 +154,7 @@ const
{$IFNDEF WIN64}
NETLIBOPENCONNECTION_V1_SIZE = 16;
{$ELSE}
- NETLIBOPENCONNECTION_V1_SIZE = SIZEOF(TNETLIBOPENCONNECTION);
+ NETLIBOPENCONNECTION_V1_SIZE = sizeof(TNETLIBOPENCONNECTION);
{$ENDIF}
// old sizeof() is 14 bytes, but there is padding of 2 bytes
diff --git a/include/m_core.h b/include/m_core.h
index 8ee979e305..2596a01d42 100644
--- a/include/m_core.h
+++ b/include/m_core.h
@@ -26,6 +26,7 @@ Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
#define M_CORE_H__ 1
#include <stdint.h>
+#include <stdlib.h>
#ifndef M_TYPES_H__
#include <m_types.h>
diff --git a/include/m_netlib.h b/include/m_netlib.h
index 6248ec1219..0035c1acf1 100644
--- a/include/m_netlib.h
+++ b/include/m_netlib.h
@@ -793,7 +793,7 @@ __inline INT_PTR Netlib_Logf(HANDLE hUser, const char *fmt, ...)
va_list va;
va_start(va, fmt);
char szText[1024];
- mir_vsnprintf(szText, sizeof(szText), fmt, va);
+ mir_vsnprintf(szText, _countof(szText), fmt, va);
va_end(va);
return CallService(MS_NETLIB_LOG, (WPARAM)hUser, (LPARAM)szText);
}
@@ -803,7 +803,7 @@ __inline INT_PTR Netlib_LogfW(HANDLE hUser, const wchar_t *fmt, ...)
va_list va;
va_start(va, fmt);
wchar_t szText[1024];
- mir_vsnwprintf(szText, SIZEOF(szText), fmt, va);
+ mir_vsnwprintf(szText, _countof(szText), fmt, va);
va_end(va);
return CallService(MS_NETLIB_LOGW, (WPARAM)hUser, (LPARAM)szText);
}
diff --git a/include/m_system.h b/include/m_system.h
index 7f7130f693..d29911c99f 100644
--- a/include/m_system.h
+++ b/include/m_system.h
@@ -45,8 +45,6 @@ Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
#pragma warning(disable:4244 4245)
#endif
-#define SIZEOF(X) (sizeof(X)/sizeof(X[0]))
-
#define NEWSTR_ALLOCA(A) (A == NULL)?NULL:strcpy((char*)alloca(strlen(A)+1), A)
#define NEWWSTR_ALLOCA(A) ((A==NULL)?NULL:wcscpy((wchar_t*)alloca(sizeof(wchar_t)*(wcslen(A)+1)),A))
#define NEWTSTR_ALLOCA(A) (A == NULL)?NULL:_tcscpy((TCHAR*)alloca((_tcslen(A)+1)* sizeof(TCHAR)), A)
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 );
diff --git a/protocols/AimOscar/src/avatars.cpp b/protocols/AimOscar/src/avatars.cpp
index 2de60d0ed4..298a11f899 100644
--- a/protocols/AimOscar/src/avatars.cpp
+++ b/protocols/AimOscar/src/avatars.cpp
@@ -104,7 +104,7 @@ void CAimProto::avatar_retrieval_handler(const char* sn, const char* /*hash*/, c
if (data_len > 0) {
const TCHAR *type;
ai.format = ProtoGetBufferFormat(data, &type);
- get_avatar_filename(ai.hContact, ai.filename, SIZEOF(ai.filename), type);
+ get_avatar_filename(ai.hContact, ai.filename, _countof(ai.filename), type);
int fileId = _topen(ai.filename, _O_CREAT | _O_TRUNC | _O_WRONLY | O_BINARY, _S_IREAD | _S_IWRITE);
if (fileId >= 0) {
diff --git a/protocols/AimOscar/src/chat.cpp b/protocols/AimOscar/src/chat.cpp
index 0188d4609f..09ab42eecc 100644
--- a/protocols/AimOscar/src/chat.cpp
+++ b/protocols/AimOscar/src/chat.cpp
@@ -197,7 +197,7 @@ int CAimProto::OnGCMenuHook(WPARAM, LPARAM lParam)
{ TranslateT("&Invite user..."), 10, MENU_ITEM, FALSE },
{ TranslateT("&Leave chat session"), 20, MENU_ITEM, FALSE }
};
- gcmi->nItems = SIZEOF(Items);
+ gcmi->nItems = _countof(Items);
gcmi->Item = (gc_item*)Items;
}
else if ( gcmi->Type == MENU_ON_NICKLIST )
@@ -211,7 +211,7 @@ int CAimProto::OnGCMenuHook(WPARAM, LPARAM lParam)
{ _T(""), 100, MENU_SEPARATOR, FALSE },
{ TranslateT("&Leave chat session"), 110, MENU_ITEM, FALSE }
};
- gcmi->nItems = SIZEOF(Items);
+ gcmi->nItems = _countof(Items);
gcmi->Item = (gc_item*)Items;
}
else {
@@ -219,7 +219,7 @@ int CAimProto::OnGCMenuHook(WPARAM, LPARAM lParam)
{ TranslateT("User &details"), 10, MENU_ITEM, FALSE },
{ TranslateT("User &history"), 20, MENU_ITEM, FALSE }
};
- gcmi->nItems = SIZEOF(Items);
+ gcmi->nItems = _countof(Items);
gcmi->Item = (gc_item*)Items;
}
mir_free(sn);
diff --git a/protocols/AimOscar/src/client.cpp b/protocols/AimOscar/src/client.cpp
index 169003f94c..b17a0cdd39 100644
--- a/protocols/AimOscar/src/client.cpp
+++ b/protocols/AimOscar/src/client.cpp
@@ -53,7 +53,7 @@ int CAimProto::aim_auth_request(HANDLE hServerConn,unsigned short &seqno,const c
char client_id[64], mirver[64];
CallService(MS_SYSTEM_GETVERSIONTEXT, sizeof(mirver), (LPARAM)mirver);
- int client_id_len = mir_snprintf(client_id, SIZEOF(client_id), "Miranda AIM, version %s", mirver);
+ int client_id_len = mir_snprintf(client_id, _countof(client_id), "Miranda AIM, version %s", mirver);
char* buf=(char*)alloca(SNAC_SIZE+TLV_HEADER_SIZE*14+MD5_HASH_LENGTH+mir_strlen(username)+client_id_len+30+mir_strlen(language)+mir_strlen(country));
diff --git a/protocols/AimOscar/src/file.cpp b/protocols/AimOscar/src/file.cpp
index d47aa56b02..f98060d924 100644
--- a/protocols/AimOscar/src/file.cpp
+++ b/protocols/AimOscar/src/file.cpp
@@ -94,7 +94,7 @@ void CAimProto::report_file_error(TCHAR *fname)
{
TCHAR errmsg[512];
TCHAR* error = mir_a2t(_strerror(NULL));
- mir_sntprintf(errmsg, SIZEOF(errmsg), TranslateT("Failed to open file: %s : %s"), fname, error);
+ mir_sntprintf(errmsg, _countof(errmsg), TranslateT("Failed to open file: %s : %s"), fname, error);
mir_free(error);
ShowPopup((char*)errmsg, ERROR_POPUP | TCHAR_POPUP);
}
@@ -347,7 +347,7 @@ int CAimProto::receiving_file(file_transfer *ft, HANDLE hServerPacketRecver, NET
mir_free(buf);
TCHAR fname[256];
- mir_sntprintf(fname, SIZEOF(fname), _T("%s%s"), ft->pfts.tszWorkingDir, name);
+ mir_sntprintf(fname, _countof(fname), _T("%s%s"), ft->pfts.tszWorkingDir, name);
mir_free(name);
mir_free(ft->pfts.tszCurrentFile);
ft->pfts.tszCurrentFile = mir_tstrdup(fname);
diff --git a/protocols/AimOscar/src/popup.cpp b/protocols/AimOscar/src/popup.cpp
index 61ecaa9d17..01eec9d9b2 100644
--- a/protocols/AimOscar/src/popup.cpp
+++ b/protocols/AimOscar/src/popup.cpp
@@ -65,7 +65,7 @@ void CAimProto::ShowPopup(const char* msg, int flags, char* url)
{
POPUPDATAT ppd = {0};
- mir_sntprintf(ppd.lptzContactName, SIZEOF(ppd.lptzContactName), TranslateT("%s Protocol"), m_tszUserName);
+ mir_sntprintf(ppd.lptzContactName, _countof(ppd.lptzContactName), TranslateT("%s Protocol"), m_tszUserName);
if (flags & ERROR_POPUP)
{
@@ -88,7 +88,7 @@ void CAimProto::ShowPopup(const char* msg, int flags, char* url)
if (flags & MAIL_POPUP)
{
size_t len = mir_tstrlen(ppd.lptzText);
- mir_sntprintf(&ppd.lptzText[len], SIZEOF(ppd.lptzText) - len, _T(" %s"), TranslateT("Open mail account?"));
+ mir_sntprintf(&ppd.lptzText[len], _countof(ppd.lptzText) - len, _T(" %s"), TranslateT("Open mail account?"));
if (MessageBox(NULL, ppd.lptzText, ppd.lptzContactName, MB_YESNO | MB_ICONINFORMATION) == IDYES)
ShellExecuteA(NULL, "open", url, NULL, NULL, SW_SHOW);
}
diff --git a/protocols/AimOscar/src/proto.cpp b/protocols/AimOscar/src/proto.cpp
index 91618cf53e..5df30f65a6 100644
--- a/protocols/AimOscar/src/proto.cpp
+++ b/protocols/AimOscar/src/proto.cpp
@@ -57,7 +57,7 @@ CAimProto::CAimProto(const char* aProtoName, const TCHAR* aUserName) :
m_hNetlibUser = (HANDLE) CallService(MS_NETLIB_REGISTERUSER, 0, (LPARAM)&nlu);
char szP2P[128];
- mir_snprintf(szP2P, SIZEOF(szP2P), "%sP2P", m_szModuleName);
+ mir_snprintf(szP2P, _countof(szP2P), "%sP2P", m_szModuleName);
nlu.flags = NUF_OUTGOING | NUF_INCOMING | NUF_TCHAR;
mir_sntprintf(descr, TranslateT("%s Client-to-client connection"), m_tszUserName);
nlu.szSettingsModule = szP2P;
@@ -701,7 +701,7 @@ int __cdecl CAimProto::OnEvent(PROTOEVENTTYPE eventType, WPARAM wParam, LPARAM l
case EV_PROTO_ONERASE:
{
char szDbsettings[64];
- mir_snprintf(szDbsettings, SIZEOF(szDbsettings), "%sP2P", m_szModuleName);
+ mir_snprintf(szDbsettings, _countof(szDbsettings), "%sP2P", m_szModuleName);
CallService(MS_DB_MODULE_DELETE, 0, (LPARAM)szDbsettings);
}
break;
diff --git a/protocols/AimOscar/src/server.cpp b/protocols/AimOscar/src/server.cpp
index 5cb097c4ac..15d9e4babe 100644
--- a/protocols/AimOscar/src/server.cpp
+++ b/protocols/AimOscar/src/server.cpp
@@ -316,7 +316,7 @@ void CAimProto::snac_user_online(SNAC &snac)//family 0x0003
char f =cap[13];
char g =cap[14];
char h =cap[15];
- mir_snprintf(client,SIZEOF(client),CLIENT_OSCARJ,a&0x7f,b,c,d,alpha_cap_str(a),e&0x7f,f,g,h,alpha_cap_str(e));
+ mir_snprintf(client,_countof(client),CLIENT_OSCARJ,a&0x7f,b,c,d,alpha_cap_str(a),e&0x7f,f,g,h,alpha_cap_str(e));
}
else if (memcmp(cap, "MirandaA", 8) == 0)
{
@@ -328,7 +328,7 @@ void CAimProto::snac_user_online(SNAC &snac)//family 0x0003
char f =cap[13];
char g =cap[14];
char h =cap[15];
- mir_snprintf(client,SIZEOF(client),CLIENT_AIMOSCAR,a,b,c,d,e,f,g,h);
+ mir_snprintf(client,_countof(client),CLIENT_AIMOSCAR,a,b,c,d,e,f,g,h);
}
if (memcmp(cap, "sinj", 4) == 0)
{
@@ -340,7 +340,7 @@ void CAimProto::snac_user_online(SNAC &snac)//family 0x0003
char f =cap[9];
char g =cap[10];
char h =cap[11];
- mir_snprintf(client,SIZEOF(client),CLIENT_OSCARSN,a&0x7f,b,c,d,alpha_cap_str(a),e&0x7f,f,g,h,alpha_cap_str(e),secure_cap_str(&cap[12]));
+ mir_snprintf(client,_countof(client),CLIENT_OSCARSN,a&0x7f,b,c,d,alpha_cap_str(a),e&0x7f,f,g,h,alpha_cap_str(e),secure_cap_str(&cap[12]));
}
if (memcmp(cap, "icqp", 4) == 0)
{
@@ -352,7 +352,7 @@ void CAimProto::snac_user_online(SNAC &snac)//family 0x0003
char f =cap[9];
char g =cap[10];
char h =cap[11];
- mir_snprintf(client,SIZEOF(client),CLIENT_OSCARPL,a&0x7f,b,c,d,alpha_cap_str(a),e&0x7f,f,g,h,alpha_cap_str(e),secure_cap_str(&cap[12]));
+ mir_snprintf(client,_countof(client),CLIENT_OSCARPL,a&0x7f,b,c,d,alpha_cap_str(a),e&0x7f,f,g,h,alpha_cap_str(e),secure_cap_str(&cap[12]));
}
else if (memcmp(cap, "Kopete ICQ", 10) == 0)
{
@@ -1584,7 +1584,7 @@ void CAimProto::snac_list_modification_ack(SNAC &snac)//family 0x0013
default:
char msg[64];
- mir_snprintf(msg, SIZEOF(msg), "Error removing buddy from list. Error code %#x", code);
+ mir_snprintf(msg, _countof(msg), "Error removing buddy from list. Error code %#x", code);
ShowPopup(msg, ERROR_POPUP);
break;
}
@@ -1619,7 +1619,7 @@ void CAimProto::snac_list_modification_ack(SNAC &snac)//family 0x0013
default:
char msg[64];
- mir_snprintf(msg, SIZEOF(msg), Translate("Unknown error when adding buddy to list. Error code %#x"), code);
+ mir_snprintf(msg, _countof(msg), Translate("Unknown error when adding buddy to list. Error code %#x"), code);
ShowPopup(msg, ERROR_POPUP);
break;
}
@@ -1639,7 +1639,7 @@ void CAimProto::snac_list_modification_ack(SNAC &snac)//family 0x0013
default:
char msg[64];
- mir_snprintf(msg, SIZEOF(msg), Translate("Unknown error when attempting to modify a group. Error code %#x"), code);
+ mir_snprintf(msg, _countof(msg), Translate("Unknown error when attempting to modify a group. Error code %#x"), code);
ShowPopup(msg, ERROR_POPUP);
break;
}
@@ -1813,12 +1813,12 @@ void CAimProto::snac_mail_response(SNAC &snac)//family 0x0018
{
TCHAR msg[1024];
- int len = mir_sntprintf(msg, SIZEOF(msg), _T("%S@%S (%d)\r\n%s "), sn, address, num_msgs,
+ int len = mir_sntprintf(msg, _countof(msg), _T("%S@%S (%d)\r\n%s "), sn, address, num_msgs,
TranslateT("You've got mail! Checked at")) ;
SYSTEMTIME stLocal;
GetLocalTime(&stLocal);
- GetTimeFormat(LOCALE_USER_DEFAULT, 0, &stLocal, NULL, msg + len, SIZEOF(msg) - len);
+ GetTimeFormat(LOCALE_USER_DEFAULT, 0, &stLocal, NULL, msg + len, _countof(msg) - len);
ShowPopup((char*)msg, MAIL_POPUP | TCHAR_POPUP, url);
}
diff --git a/protocols/AimOscar/src/services.cpp b/protocols/AimOscar/src/services.cpp
index 9d5b86d317..cfa55973a1 100644
--- a/protocols/AimOscar/src/services.cpp
+++ b/protocols/AimOscar/src/services.cpp
@@ -346,7 +346,7 @@ INT_PTR CAimProto::GetAvatarInfo(WPARAM wParam, LPARAM lParam)
if (getByte(AIM_KEY_DA, 0)) return GAIR_NOAVATAR;
- switch (get_avatar_filename(pai->hContact, pai->filename, SIZEOF(pai->filename), NULL))
+ switch (get_avatar_filename(pai->hContact, pai->filename, _countof(pai->filename), NULL))
{
case GAIR_SUCCESS:
if (!(wParam & GAIF_FORCE) || state != 1 )
@@ -479,12 +479,12 @@ INT_PTR CAimProto::SetAvatar(WPARAM, LPARAM lParam)
TCHAR tFileName[MAX_PATH];
TCHAR *ext = _tcsrchr(szFileName, '.');
- get_avatar_filename(NULL, tFileName, SIZEOF(tFileName), ext);
+ get_avatar_filename(NULL, tFileName, _countof(tFileName), ext);
int fileId = _topen(tFileName, _O_CREAT | _O_TRUNC | _O_WRONLY | O_BINARY, _S_IREAD | _S_IWRITE);
if (fileId < 0)
{
char errmsg[512];
- mir_snprintf(errmsg, SIZEOF(errmsg), "Cannot store avatar. File '%s' could not be created/overwritten", tFileName);
+ mir_snprintf(errmsg, _countof(errmsg), "Cannot store avatar. File '%s' could not be created/overwritten", tFileName);
ShowPopup(errmsg, ERROR_POPUP);
return 1;
}
diff --git a/protocols/AimOscar/src/theme.cpp b/protocols/AimOscar/src/theme.cpp
index 6d99b8d563..ed7bbf2c48 100644
--- a/protocols/AimOscar/src/theme.cpp
+++ b/protocols/AimOscar/src/theme.cpp
@@ -63,13 +63,13 @@ void InitIcons(void)
HICON LoadIconEx(const char *name, bool big)
{
char szSettingName[100];
- mir_snprintf(szSettingName, SIZEOF(szSettingName), "AIM_%s", name);
+ mir_snprintf(szSettingName, _countof(szSettingName), "AIM_%s", 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;
@@ -79,7 +79,7 @@ HANDLE GetIconHandle(const char *name)
void ReleaseIconEx(const char *name, bool big)
{
char szSettingName[100];
- mir_snprintf(szSettingName, SIZEOF(szSettingName ), "%s_%s", "AIM", name);
+ mir_snprintf(szSettingName, _countof(szSettingName ), "%s_%s", "AIM", name);
IcoLib_Release(szSettingName, big);
}
@@ -239,21 +239,21 @@ void CAimProto::InitMainMenus(void)
mi.hParentMenu = hRoot;
mi.flags = CMIF_CHILDPOPUP;
- mir_snprintf(service_name, SIZEOF(service_name), "%s%s", m_szModuleName, "/ManageAccount");
+ mir_snprintf(service_name, _countof(service_name), "%s%s", m_szModuleName, "/ManageAccount");
CreateProtoService("/ManageAccount", &CAimProto::ManageAccount);
mi.position = 201001;
mi.icolibItem = GetIconHandle("aim");
mi.pszName = LPGEN("Manage Account");
hMainMenu[0] = Menu_AddProtoMenuItem(&mi);
- mir_snprintf(service_name, SIZEOF(service_name), "%s%s", m_szModuleName, "/InstantIdle");
+ mir_snprintf(service_name, _countof(service_name), "%s%s", m_szModuleName, "/InstantIdle");
CreateProtoService("/InstantIdle",&CAimProto::InstantIdle);
mi.position = 201002;
mi.icolibItem = GetIconHandle("idle");
mi.pszName = LPGEN("Instant Idle");
hMainMenu[1] = Menu_AddProtoMenuItem(&mi);
- mir_snprintf(service_name, SIZEOF(service_name), "%s%s", m_szModuleName, "/JoinChatRoom");
+ mir_snprintf(service_name, _countof(service_name), "%s%s", m_szModuleName, "/JoinChatRoom");
CreateProtoService("/JoinChatRoom", &CAimProto::JoinChatUI);
mi.position = 201003;
mi.icolibItem = GetIconHandle("aol");
@@ -270,7 +270,7 @@ void CAimProto::InitContactMenus(void)
mi.pszService = service_name;
mi.pszContactOwner = m_szModuleName;
- mir_snprintf(service_name, SIZEOF(service_name), "%s%s", m_szModuleName, "/GetHTMLAwayMsg");
+ mir_snprintf(service_name, _countof(service_name), "%s%s", m_szModuleName, "/GetHTMLAwayMsg");
CreateProtoService("/GetHTMLAwayMsg",&CAimProto::GetHTMLAwayMsg);
mi.position = -2000006000;
mi.icolibItem = GetIconHandle("away");
@@ -278,7 +278,7 @@ void CAimProto::InitContactMenus(void)
mi.flags = CMIF_NOTOFFLINE | CMIF_HIDDEN;
hHTMLAwayContextMenuItem = Menu_AddContactMenuItem(&mi);
- mir_snprintf(service_name, SIZEOF(service_name), "%s%s", m_szModuleName, "/GetProfile");
+ mir_snprintf(service_name, _countof(service_name), "%s%s", m_szModuleName, "/GetProfile");
CreateProtoService("/GetProfile", &CAimProto::GetProfile);
mi.position = -2000005090;
mi.icolibItem = GetIconHandle("profile");
@@ -286,7 +286,7 @@ void CAimProto::InitContactMenus(void)
mi.flags = CMIF_NOTOFFLINE;
hReadProfileMenuItem = Menu_AddContactMenuItem(&mi);
- mir_snprintf(service_name, SIZEOF(service_name), "%s%s", m_szModuleName, "/AddToServerList");
+ mir_snprintf(service_name, _countof(service_name), "%s%s", m_szModuleName, "/AddToServerList");
CreateProtoService("/AddToServerList", &CAimProto::AddToServerList);
mi.position = -2000005080;
mi.icolibItem = GetIconHandle("add");
@@ -294,7 +294,7 @@ void CAimProto::InitContactMenus(void)
mi.flags = CMIF_NOTONLINE | CMIF_HIDDEN;
hAddToServerListContextMenuItem = Menu_AddContactMenuItem(&mi);
- mir_snprintf(service_name, SIZEOF(service_name), "%s%s", m_szModuleName, "/BlockCommand");
+ mir_snprintf(service_name, _countof(service_name), "%s%s", m_szModuleName, "/BlockCommand");
CreateProtoService("/BlockCommand", &CAimProto::BlockBuddy);
mi.position = -2000005060;
mi.icolibItem = GetIconHandle("block");
diff --git a/protocols/AimOscar/src/ui.cpp b/protocols/AimOscar/src/ui.cpp
index 4904e134eb..d81b65f3c0 100644
--- a/protocols/AimOscar/src/ui.cpp
+++ b/protocols/AimOscar/src/ui.cpp
@@ -631,7 +631,7 @@ INT_PTR CALLBACK admin_dialog(HWND hwndDlg, UINT msg, WPARAM wParam, LPARAM lPar
break;
char name[64];
- GetDlgItemTextA(hwndDlg, IDC_FNAME, name, SIZEOF(name));
+ GetDlgItemTextA(hwndDlg, IDC_FNAME, name, _countof(name));
if (mir_strlen(trim_str(name)) > 0 && !ppro->getString(AIM_KEY_SN, &dbv)) {
if (mir_strcmp(name, dbv.pszVal))
ppro->aim_admin_format_name(ppro->hAdminConn, ppro->admin_seqno, name);
@@ -639,7 +639,7 @@ INT_PTR CALLBACK admin_dialog(HWND hwndDlg, UINT msg, WPARAM wParam, LPARAM lPar
}
char email[254];
- GetDlgItemTextA(hwndDlg, IDC_CEMAIL, email, SIZEOF(email));
+ GetDlgItemTextA(hwndDlg, IDC_CEMAIL, email, _countof(email));
if (mir_strlen(trim_str(email)) > 1 && !ppro->getString(AIM_KEY_EM, &dbv)) // Must be greater than 1 or a SNAC error is thrown.
{
if (mir_strcmp(email, dbv.pszVal))
@@ -650,9 +650,9 @@ INT_PTR CALLBACK admin_dialog(HWND hwndDlg, UINT msg, WPARAM wParam, LPARAM lPar
ShowWindow(GetDlgItem(hwndDlg, IDC_PINFO), SW_HIDE);
char cpw[256], npw1[256], npw2[256];
- GetDlgItemTextA(hwndDlg, IDC_CPW, cpw, SIZEOF(cpw));
- GetDlgItemTextA(hwndDlg, IDC_NPW1, npw1, SIZEOF(npw1));
- GetDlgItemTextA(hwndDlg, IDC_NPW2, npw2, SIZEOF(npw2));
+ GetDlgItemTextA(hwndDlg, IDC_CPW, cpw, _countof(cpw));
+ GetDlgItemTextA(hwndDlg, IDC_NPW1, npw1, _countof(npw1));
+ GetDlgItemTextA(hwndDlg, IDC_NPW2, npw2, _countof(npw2));
if (cpw[0] != 0 && npw1[0] != 0 && npw2[0] != 0) {
// AOL only requires that you send the current password and a (single) new password.
// Let's allow the client to type (two) new passwords incase they make a mistake so we
@@ -798,7 +798,7 @@ static INT_PTR CALLBACK options_dialog(HWND hwndDlg, UINT msg, WPARAM wParam, LP
{
char str[128];
//SN
- GetDlgItemTextA(hwndDlg, IDC_SN, str, SIZEOF(str));
+ GetDlgItemTextA(hwndDlg, IDC_SN, str, _countof(str));
if (str[0] != 0)
ppro->setString(AIM_KEY_SN, str);
else
@@ -806,16 +806,16 @@ static INT_PTR CALLBACK options_dialog(HWND hwndDlg, UINT msg, WPARAM wParam, LP
//END SN
//NK
- if (GetDlgItemTextA(hwndDlg, IDC_NK, str, SIZEOF(str)))
+ if (GetDlgItemTextA(hwndDlg, IDC_NK, str, _countof(str)))
ppro->setString(AIM_KEY_NK, str);
else {
- GetDlgItemTextA(hwndDlg, IDC_SN, str, SIZEOF(str));
+ GetDlgItemTextA(hwndDlg, IDC_SN, str, _countof(str));
ppro->setString(AIM_KEY_NK, str);
}
//END NK
//PW
- GetDlgItemTextA(hwndDlg, IDC_PW, str, SIZEOF(str));
+ GetDlgItemTextA(hwndDlg, IDC_PW, str, _countof(str));
if (str[0] != 0)
ppro->setString(AIM_KEY_PW, str);
else
@@ -823,7 +823,7 @@ static INT_PTR CALLBACK options_dialog(HWND hwndDlg, UINT msg, WPARAM wParam, LP
//END PW
//HN
- GetDlgItemTextA(hwndDlg, IDC_HN, str, SIZEOF(str));
+ GetDlgItemTextA(hwndDlg, IDC_HN, str, _countof(str));
if (str[0] != 0 && mir_strcmp(str, AIM_DEFAULT_SERVER))
ppro->setString(AIM_KEY_HN, str);
else
@@ -959,12 +959,12 @@ static INT_PTR CALLBACK privacy_dialog(HWND hwndDlg, UINT msg, WPARAM wParam, LP
case WM_COMMAND:
if (LOWORD(wParam) == IDC_ALLOWADD) {
char nick[80];
- GetDlgItemTextA(hwndDlg, IDC_ALLOWEDIT, nick, SIZEOF(nick));
+ GetDlgItemTextA(hwndDlg, IDC_ALLOWEDIT, nick, _countof(nick));
SendDlgItemMessageA(hwndDlg, IDC_ALLOWLIST, LB_ADDSTRING, 0, (LPARAM)trim_str(nick));
}
else if (LOWORD(wParam) == IDC_BLOCKADD) {
char nick[80];
- GetDlgItemTextA(hwndDlg, IDC_BLOCKEDIT, nick, SIZEOF(nick));
+ GetDlgItemTextA(hwndDlg, IDC_BLOCKEDIT, nick, _countof(nick));
SendDlgItemMessageA(hwndDlg, IDC_BLOCKLIST, LB_ADDSTRING, 0, (LPARAM)trim_str(nick));
}
else if (LOWORD(wParam) == IDC_ALLOWREMOVE) {
@@ -1106,10 +1106,10 @@ INT_PTR CALLBACK first_run_dialog(HWND hwndDlg, UINT msg, WPARAM wParam, LPARAM
case WM_NOTIFY:
if (((LPNMHDR)lParam)->code == (UINT)PSN_APPLY) {
char str[128];
- GetDlgItemTextA(hwndDlg, IDC_SN, str, SIZEOF(str));
+ GetDlgItemTextA(hwndDlg, IDC_SN, str, _countof(str));
ppro->setString(AIM_KEY_SN, str);
- GetDlgItemTextA(hwndDlg, IDC_PW, str, SIZEOF(str));
+ GetDlgItemTextA(hwndDlg, IDC_PW, str, _countof(str));
ppro->setString(AIM_KEY_PW, str);
return TRUE;
}
@@ -1216,7 +1216,7 @@ INT_PTR CALLBACK join_chat_dialog(HWND hwndDlg, UINT msg, WPARAM wParam, LPARAM
switch (LOWORD(wParam)) {
case IDOK:
char room[128];
- GetDlgItemTextA(hwndDlg, IDC_ROOM, room, SIZEOF(room));
+ GetDlgItemTextA(hwndDlg, IDC_ROOM, room, _countof(room));
if (ppro->state == 1 && room[0] != 0) {
chatnav_param* par = new chatnav_param(room, 4);
ppro->ForkThread(&CAimProto::chatnav_request_thread, par);
@@ -1349,7 +1349,7 @@ INT_PTR CALLBACK invite_to_chat_dialog(HWND hwndDlg, UINT msg, WPARAM wParam, LP
case IDC_ADDSCR:
if (param->ppro->state == 1) {
TCHAR sn[64];
- GetDlgItemText(hwndDlg, IDC_EDITSCR, sn, SIZEOF(sn));
+ GetDlgItemText(hwndDlg, IDC_EDITSCR, sn, _countof(sn));
CLCINFOITEM cii = { 0 };
cii.cbSize = sizeof(cii);
@@ -1366,7 +1366,7 @@ INT_PTR CALLBACK invite_to_chat_dialog(HWND hwndDlg, UINT msg, WPARAM wParam, LP
chat_list_item* item = param->ppro->find_chat_by_id(param->id);
if (item) {
char msg[1024];
- GetDlgItemTextA(hwndDlg, IDC_MSG, msg, SIZEOF(msg));
+ GetDlgItemTextA(hwndDlg, IDC_MSG, msg, _countof(msg));
HWND hwndList = GetDlgItem(hwndDlg, IDC_CCLIST);
clist_chat_invite_send(NULL, hwndList, item, param->ppro, msg);
diff --git a/protocols/AimOscar/src/utility.cpp b/protocols/AimOscar/src/utility.cpp
index 174764ee46..004e195359 100644
--- a/protocols/AimOscar/src/utility.cpp
+++ b/protocols/AimOscar/src/utility.cpp
@@ -496,42 +496,42 @@ void BdList::remove_by_id(unsigned short id)
unsigned short CAimProto::getBuddyId(MCONTACT hContact, int i)
{
char item[sizeof(AIM_KEY_BI)+10];
- mir_snprintf(item, SIZEOF(item), AIM_KEY_BI"%d", i);
+ mir_snprintf(item, _countof(item), AIM_KEY_BI"%d", i);
return getWord(hContact, item, 0);
}
void CAimProto::setBuddyId(MCONTACT hContact, int i, unsigned short id)
{
char item[sizeof(AIM_KEY_BI)+10];
- mir_snprintf(item, SIZEOF(item), AIM_KEY_BI"%d", i);
+ mir_snprintf(item, _countof(item), AIM_KEY_BI"%d", i);
setWord(hContact, item, id);
}
int CAimProto::deleteBuddyId(MCONTACT hContact, int i)
{
char item[sizeof(AIM_KEY_BI)+10];
- mir_snprintf(item, SIZEOF(item), AIM_KEY_BI"%d", i);
+ mir_snprintf(item, _countof(item), AIM_KEY_BI"%d", i);
return delSetting(hContact, item);
}
unsigned short CAimProto::getGroupId(MCONTACT hContact, int i)
{
char item[sizeof(AIM_KEY_GI)+10];
- mir_snprintf(item, SIZEOF(item), AIM_KEY_GI"%d", i);
+ mir_snprintf(item, _countof(item), AIM_KEY_GI"%d", i);
return getWord(hContact, item, 0);
}
void CAimProto::setGroupId(MCONTACT hContact, int i, unsigned short id)
{
char item[sizeof(AIM_KEY_GI)+10];
- mir_snprintf(item, SIZEOF(item), AIM_KEY_GI"%d", i);
+ mir_snprintf(item, _countof(item), AIM_KEY_GI"%d", i);
setWord(hContact, item, id);
}
int CAimProto::deleteGroupId(MCONTACT hContact, int i)
{
char item[sizeof(AIM_KEY_GI)+10];
- mir_snprintf(item, SIZEOF(item), AIM_KEY_GI"%d", i);
+ mir_snprintf(item, _countof(item), AIM_KEY_GI"%d", i);
return delSetting(hContact, item);
}
@@ -553,7 +553,7 @@ int CAimProto::open_contact_file(const char*, const TCHAR* file, const char*, TC
if (fid < 0)
{
TCHAR errmsg[512];
- mir_sntprintf(errmsg, SIZEOF(errmsg), TranslateT("Failed to open file: %s %s"), path, __tcserror(NULL));
+ mir_sntprintf(errmsg, _countof(errmsg), TranslateT("Failed to open file: %s %s"), path, __tcserror(NULL));
ShowPopup((char*)errmsg, ERROR_POPUP | TCHAR_POPUP);
}
return fid;
diff --git a/protocols/Dummy/src/dummy_options.cpp b/protocols/Dummy/src/dummy_options.cpp
index 279140bc29..4ff413d2dd 100644
--- a/protocols/Dummy/src/dummy_options.cpp
+++ b/protocols/Dummy/src/dummy_options.cpp
@@ -59,10 +59,10 @@ INT_PTR CALLBACK DummyAccountProc(HWND hwndDlg, UINT uMsg, WPARAM wParam, LPARAM
switch (((LPNMHDR)lParam)->code) {
case PSN_APPLY:
char str[128];
- GetDlgItemTextA(hwndDlg, IDC_ID_TEXT, str, SIZEOF(str));
+ GetDlgItemTextA(hwndDlg, IDC_ID_TEXT, str, _countof(str));
ppro->setString(DUMMY_ID_TEXT, str);
- GetDlgItemTextA(hwndDlg, IDC_ID_SETTING, str, SIZEOF(str));
+ GetDlgItemTextA(hwndDlg, IDC_ID_SETTING, str, _countof(str));
ppro->setString(DUMMY_ID_SETTING, str);
}
break;
diff --git a/protocols/FacebookRM/src/avatars.cpp b/protocols/FacebookRM/src/avatars.cpp
index 9beaa10869..15abcdd60f 100644
--- a/protocols/FacebookRM/src/avatars.cpp
+++ b/protocols/FacebookRM/src/avatars.cpp
@@ -126,7 +126,7 @@ void FacebookProto::UpdateAvatarWorker(void *)
std::tstring FacebookProto::GetAvatarFolder()
{
TCHAR path[MAX_PATH];
- mir_sntprintf(path, SIZEOF(path), _T("%s\\%s"), VARST(_T("%miranda_avatarcache%")), m_tszUserName);
+ mir_sntprintf(path, _countof(path), _T("%s\\%s"), VARST(_T("%miranda_avatarcache%")), m_tszUserName);
return path;
}
diff --git a/protocols/FacebookRM/src/captcha.cpp b/protocols/FacebookRM/src/captcha.cpp
index 4ff4a2faa9..98cc51bd1e 100644
--- a/protocols/FacebookRM/src/captcha.cpp
+++ b/protocols/FacebookRM/src/captcha.cpp
@@ -85,7 +85,7 @@ static INT_PTR CALLBACK CaptchaFormDlgProc(HWND hwndDlg, UINT msg, WPARAM wParam
return TRUE;
case IDOK:
- GetDlgItemTextA(hwndDlg, IDC_VALUE, params->Result, SIZEOF(params->Result));
+ GetDlgItemTextA(hwndDlg, IDC_VALUE, params->Result, _countof(params->Result));
EndDialog(hwndDlg, 1);
return TRUE;
}
diff --git a/protocols/FacebookRM/src/chat.cpp b/protocols/FacebookRM/src/chat.cpp
index 2b9af2ddcb..e6e29ddb90 100644
--- a/protocols/FacebookRM/src/chat.cpp
+++ b/protocols/FacebookRM/src/chat.cpp
@@ -365,7 +365,7 @@ int FacebookProto::OnGCMenuHook(WPARAM, LPARAM lParam)
{ LPGENT("&Invite user..."), 10, MENU_ITEM, FALSE },
{ LPGENT("&Leave chat session"), 20, MENU_ITEM, FALSE }
};
- gcmi->nItems = SIZEOF(Items);
+ gcmi->nItems = _countof(Items);
gcmi->Item = (gc_item*)Items;
}
else if (gcmi->Type == MENU_ON_NICKLIST)
@@ -379,7 +379,7 @@ int FacebookProto::OnGCMenuHook(WPARAM, LPARAM lParam)
{ _T(""), 100, MENU_SEPARATOR, FALSE },
{ LPGENT("&Leave chat session"), 110, MENU_ITEM, FALSE }
};
- gcmi->nItems = SIZEOF(Items);
+ gcmi->nItems = _countof(Items);
gcmi->Item = (gc_item*)Items;*/
gcmi->nItems = 0;
gcmi->Item = NULL;
@@ -391,7 +391,7 @@ int FacebookProto::OnGCMenuHook(WPARAM, LPARAM lParam)
{ LPGENT("User &details"), 10, MENU_ITEM, FALSE },
{ LPGENT("User &history"), 20, MENU_ITEM, FALSE }
};
- gcmi->nItems = SIZEOF(Items);
+ gcmi->nItems = _countof(Items);
gcmi->Item = (gc_item*)Items;
}
}
@@ -415,7 +415,7 @@ void FacebookProto::PrepareNotificationsChatRoom() {
MCONTACT hNotificationsChatRoom = ChatIDToHContact(FACEBOOK_NOTIFICATIONS_CHATROOM);
if (hNotificationsChatRoom == NULL || getDword(hNotificationsChatRoom, "Status", ID_STATUS_OFFLINE) != ID_STATUS_ONLINE) {
TCHAR nameT[200];
- mir_sntprintf(nameT, SIZEOF(nameT), _T("%s: %s"), m_tszUserName, TranslateT("Notifications"));
+ mir_sntprintf(nameT, _countof(nameT), _T("%s: %s"), m_tszUserName, TranslateT("Notifications"));
// Create the group chat session
GCSESSION gcw = { sizeof(gcw) };
diff --git a/protocols/FacebookRM/src/communication.cpp b/protocols/FacebookRM/src/communication.cpp
index 342845436f..2c50763622 100644
--- a/protocols/FacebookRM/src/communication.cpp
+++ b/protocols/FacebookRM/src/communication.cpp
@@ -546,7 +546,7 @@ NETLIBHTTPHEADER *facebook_client::get_request_headers(int request_type, int *he
std::string facebook_client::get_newsfeed_type()
{
BYTE feed_type = parent->getByte(FACEBOOK_KEY_FEED_TYPE, 0);
- if (feed_type >= SIZEOF(feed_types))
+ if (feed_type >= _countof(feed_types))
feed_type = 0;
std::string ret = "sk=";
@@ -559,7 +559,7 @@ std::string facebook_client::get_newsfeed_type()
std::string facebook_client::get_server_type()
{
BYTE server_type = parent->getByte(FACEBOOK_KEY_SERVER_TYPE, 0);
- if (server_type >= SIZEOF(server_types))
+ if (server_type >= _countof(server_types))
server_type = 0;
return server_types[server_type].id;
}
@@ -567,7 +567,7 @@ std::string facebook_client::get_server_type()
std::string facebook_client::get_privacy_type()
{
BYTE privacy_type = parent->getByte(FACEBOOK_KEY_PRIVACY_TYPE, 0);
- if (privacy_type >= SIZEOF(privacy_types))
+ if (privacy_type >= _countof(privacy_types))
privacy_type = 0;
return privacy_types[privacy_type].id;
}
diff --git a/protocols/FacebookRM/src/contacts.cpp b/protocols/FacebookRM/src/contacts.cpp
index d7b575f6ed..184713d917 100644
--- a/protocols/FacebookRM/src/contacts.cpp
+++ b/protocols/FacebookRM/src/contacts.cpp
@@ -313,7 +313,7 @@ void FacebookProto::LoadChatInfo(facebook_chatroom *fbc)
if (fbc->participants.size() > namesUsed) {
TCHAR more[200];
- mir_sntprintf(more, SIZEOF(more), TranslateT("%s and more (%d)"), fbc->chat_name.c_str(), fbc->participants.size() - namesUsed);
+ mir_sntprintf(more, _countof(more), TranslateT("%s and more (%d)"), fbc->chat_name.c_str(), fbc->participants.size() - namesUsed);
fbc->chat_name = more;
}
diff --git a/protocols/FacebookRM/src/dialogs.cpp b/protocols/FacebookRM/src/dialogs.cpp
index 3610b5d19f..2cbcfff995 100644
--- a/protocols/FacebookRM/src/dialogs.cpp
+++ b/protocols/FacebookRM/src/dialogs.cpp
@@ -88,10 +88,10 @@ INT_PTR CALLBACK FBAccountProc(HWND hwnd, UINT message, WPARAM wparam, LPARAM lp
{
char str[128];
- GetDlgItemTextA(hwnd, IDC_UN, str, SIZEOF(str));
+ GetDlgItemTextA(hwnd, IDC_UN, str, _countof(str));
db_set_s(NULL, proto->ModuleName(), FACEBOOK_KEY_LOGIN, str);
- GetDlgItemTextA(hwnd, IDC_PW, str, SIZEOF(str));
+ GetDlgItemTextA(hwnd, IDC_PW, str, _countof(str));
db_set_s(NULL, proto->ModuleName(), FACEBOOK_KEY_PASS, str);
return TRUE;
}
@@ -107,7 +107,7 @@ void RefreshPrivacy(HWND hwnd, post_status_data *data)
SendDlgItemMessage(hwnd, IDC_PRIVACY, CB_RESETCONTENT, 0, 0);
int wall_id = SendDlgItemMessage(hwnd, IDC_WALL, CB_GETCURSEL, 0, 0);
if (data->walls[wall_id]->user_id == data->proto->facy.self_.user_id) {
- for (size_t i = 0; i < SIZEOF(privacy_types); i++)
+ for (size_t i = 0; i < _countof(privacy_types); i++)
SendDlgItemMessageA(hwnd, IDC_PRIVACY, CB_INSERTSTRING, i, reinterpret_cast<LPARAM>(Translate(privacy_types[i].name)));
}
else {
@@ -219,7 +219,7 @@ INT_PTR CALLBACK FBMindProc(HWND hwnd, UINT message, WPARAM wparam, LPARAM lpara
ptrA firstname(data->proto->getStringA(FACEBOOK_KEY_FIRST_NAME));
if (firstname != NULL) {
char title[100];
- mir_snprintf(title, SIZEOF(title), Translate("What's on your mind, %s?"), firstname);
+ mir_snprintf(title, _countof(title), Translate("What's on your mind, %s?"), firstname);
SetWindowTextA(hwnd, title);
}
}
@@ -276,9 +276,9 @@ INT_PTR CALLBACK FBMindProc(HWND hwnd, UINT message, WPARAM wparam, LPARAM lpara
TCHAR urlT[1024];
TCHAR placeT[100];
- GetDlgItemText(hwnd, IDC_MINDMSG, mindMessageT, SIZEOF(mindMessageT));
- GetDlgItemText(hwnd, IDC_PLACE, placeT, SIZEOF(placeT));
- GetDlgItemText(hwnd, IDC_URL, urlT, SIZEOF(urlT));
+ GetDlgItemText(hwnd, IDC_MINDMSG, mindMessageT, _countof(mindMessageT));
+ GetDlgItemText(hwnd, IDC_PLACE, placeT, _countof(placeT));
+ GetDlgItemText(hwnd, IDC_URL, urlT, _countof(urlT));
ShowWindow(hwnd, SW_HIDE);
int wall_id = SendDlgItemMessage(hwnd, IDC_WALL, CB_GETCURSEL, 0, 0);
@@ -395,13 +395,13 @@ INT_PTR CALLBACK FBOptionsProc(HWND hwnd, UINT message, WPARAM wparam, LPARAM lp
{
char str[128]; TCHAR tstr[128];
- GetDlgItemTextA(hwnd, IDC_UN, str, SIZEOF(str));
+ GetDlgItemTextA(hwnd, IDC_UN, str, _countof(str));
db_set_s(0, proto->ModuleName(), FACEBOOK_KEY_LOGIN, str);
- GetDlgItemTextA(hwnd, IDC_PW, str, SIZEOF(str));
+ GetDlgItemTextA(hwnd, IDC_PW, str, _countof(str));
proto->setString(FACEBOOK_KEY_PASS, str);
- GetDlgItemText(hwnd, IDC_GROUP, tstr, SIZEOF(tstr));
+ GetDlgItemText(hwnd, IDC_GROUP, tstr, _countof(tstr));
if (tstr[0] != '\0')
{
proto->m_tszDefaultGroup = mir_tstrdup(tstr);
@@ -496,11 +496,11 @@ INT_PTR CALLBACK FBOptionsEventsProc(HWND hwnd, UINT message, WPARAM wparam, LPA
proto = reinterpret_cast<FacebookProto*>(lparam);
SetWindowLongPtr(hwnd, GWLP_USERDATA, lparam);
- for (size_t i = 0; i < SIZEOF(feed_types); i++)
+ for (size_t i = 0; i < _countof(feed_types); i++)
SendDlgItemMessageA(hwnd, IDC_FEED_TYPE, CB_INSERTSTRING, i, reinterpret_cast<LPARAM>(Translate(feed_types[i].name)));
SendDlgItemMessage(hwnd, IDC_FEED_TYPE, CB_SETCURSEL, proto->getByte(FACEBOOK_KEY_FEED_TYPE, 0), 0);
- for (size_t i = 0; i < SIZEOF(server_types); i++)
+ for (size_t i = 0; i < _countof(server_types); i++)
SendDlgItemMessageA(hwnd, IDC_URL_SERVER, CB_INSERTSTRING, i, reinterpret_cast<LPARAM>(Translate(server_types[i].name)));
SendDlgItemMessage(hwnd, IDC_URL_SERVER, CB_SETCURSEL, proto->getByte(FACEBOOK_KEY_SERVER_TYPE, 0), 0);
diff --git a/protocols/FacebookRM/src/json.cpp b/protocols/FacebookRM/src/json.cpp
index df528d7cc9..d8a43f9255 100644
--- a/protocols/FacebookRM/src/json.cpp
+++ b/protocols/FacebookRM/src/json.cpp
@@ -391,7 +391,7 @@ void parseAttachments(FacebookProto *proto, std::string *message_text, const JSO
newText = _A2T(type.c_str());
TCHAR title[200];
- mir_sntprintf(title, SIZEOF(title), TranslateT("User sent %s:"), newText.c_str());
+ mir_sntprintf(title, _countof(title), TranslateT("User sent %s:"), newText.c_str());
*message_text += T2Utf(title);
*message_text += attachments_text;
@@ -688,7 +688,7 @@ int facebook_json_parser::parse_messages(std::string *data, std::vector< faceboo
StatusTextData st = { 0 };
st.cbSize = sizeof(st);
- mir_sntprintf(st.tszText, SIZEOF(st.tszText), TranslateT("%s is typing a message..."), name);
+ mir_sntprintf(st.tszText, _countof(st.tszText), TranslateT("%s is typing a message..."), name);
CallService(MS_MSG_SETSTATUSTEXT, (WPARAM)hChatContact, (LPARAM)&st);
}
diff --git a/protocols/FacebookRM/src/proto.cpp b/protocols/FacebookRM/src/proto.cpp
index 923a371f0a..b3bfdc93b3 100644
--- a/protocols/FacebookRM/src/proto.cpp
+++ b/protocols/FacebookRM/src/proto.cpp
@@ -277,7 +277,7 @@ HANDLE FacebookProto::SearchByEmail(const TCHAR* email)
HANDLE FacebookProto::SearchByName(const TCHAR* nick, const TCHAR* firstName, const TCHAR* lastName)
{
TCHAR arg[200];
- mir_sntprintf(arg, SIZEOF(arg), _T("%s %s %s"), nick, firstName, lastName);
+ mir_sntprintf(arg, _countof(arg), _T("%s %s %s"), nick, firstName, lastName);
return SearchByEmail(arg); // Facebook is using one search method for everything (except IDs)
}
@@ -531,7 +531,7 @@ int FacebookProto::OnToolbarInit(WPARAM, LPARAM)
ttb.dwFlags = TTBBF_SHOWTOOLTIP | TTBBF_VISIBLE;
char service[100];
- mir_snprintf(service, SIZEOF(service), "%s%s", m_szModuleName, "/Mind");
+ mir_snprintf(service, _countof(service), "%s%s", m_szModuleName, "/Mind");
ttb.pszService = service;
ttb.pszTooltipUp = ttb.name = LPGEN("Share status...");
@@ -772,7 +772,7 @@ INT_PTR FacebookProto::CancelFriendship(WPARAM wParam, LPARAM lParam)
return 1;
TCHAR tstr[256];
- mir_sntprintf(tstr, SIZEOF(tstr), TranslateT("Do you want to cancel your friendship with '%s'?"), tname);
+ mir_sntprintf(tstr, _countof(tstr), TranslateT("Do you want to cancel your friendship with '%s'?"), tname);
if (MessageBox(0, tstr, m_tszUserName, MB_ICONWARNING | MB_YESNO | MB_DEFBUTTON2) == IDYES) {
ptrA id(getStringA(hContact, FACEBOOK_KEY_ID));
@@ -1124,7 +1124,7 @@ void FacebookProto::MessageRead(MCONTACT hContact)
return;
TCHAR ttime[64];
- _tcsftime(ttime, SIZEOF(ttime), _T("%X"), localtime(&time));
+ _tcsftime(ttime, _countof(ttime), _T("%X"), localtime(&time));
StatusTextData st = { 0 };
st.cbSize = sizeof(st);
@@ -1133,10 +1133,10 @@ void FacebookProto::MessageRead(MCONTACT hContact)
if (isChatRoom(hContact)) {
// Load readers names
ptrT treaders(getTStringA(hContact, FACEBOOK_KEY_MESSAGE_READERS));
- mir_sntprintf(st.tszText, SIZEOF(st.tszText), TranslateT("Message read: %s by %s"), ttime, treaders ? treaders : _T("???"));
+ mir_sntprintf(st.tszText, _countof(st.tszText), TranslateT("Message read: %s by %s"), ttime, treaders ? treaders : _T("???"));
CallService(MS_MSG_SETSTATUSTEXT, (WPARAM)hContact, (LPARAM)&st);
} else if (!ServiceExists("MessageState/DummyService")){
- mir_sntprintf(st.tszText, SIZEOF(st.tszText), TranslateT("Message read: %s"), ttime);
+ mir_sntprintf(st.tszText, _countof(st.tszText), TranslateT("Message read: %s"), ttime);
CallService(MS_MSG_SETSTATUSTEXT, (WPARAM)hContact, (LPARAM)&st);
}
}
diff --git a/protocols/FacebookRM/src/theme.cpp b/protocols/FacebookRM/src/theme.cpp
index 96d413b8c3..868593fad7 100644
--- a/protocols/FacebookRM/src/theme.cpp
+++ b/protocols/FacebookRM/src/theme.cpp
@@ -51,12 +51,12 @@ static IconItem icons[] =
void InitIcons(void)
{
- Icon_Register(g_hInstance, "Protocols/Facebook", icons, SIZEOF(icons), "Facebook");
+ Icon_Register(g_hInstance, "Protocols/Facebook", icons, _countof(icons), "Facebook");
}
HANDLE GetIconHandle(const char* name)
{
- for (size_t i = 0; i < SIZEOF(icons); i++)
+ for (size_t i = 0; i < _countof(icons); i++)
if (mir_strcmp(icons[i].szName, name) == 0)
return icons[i].hIcolib;
diff --git a/protocols/GTalkExt/src/avatar.cpp b/protocols/GTalkExt/src/avatar.cpp
index 833bfeef0a..bf6ec8389e 100644
--- a/protocols/GTalkExt/src/avatar.cpp
+++ b/protocols/GTalkExt/src/avatar.cpp
@@ -33,7 +33,7 @@
LPTSTR CreateAvaFile(HANDLE *hFile)
{
TCHAR name[MAX_PATH + 2];
- if (CallService(MS_DB_GETPROFILENAMET, (WPARAM)SIZEOF(name), (LPARAM)&name))
+ if (CallService(MS_DB_GETPROFILENAMET, (WPARAM)_countof(name), (LPARAM)&name))
return NULL;
TCHAR *p = _tcsrchr(name, '.');
@@ -41,7 +41,7 @@ LPTSTR CreateAvaFile(HANDLE *hFile)
*p = 0;
TCHAR path[MAX_PATH + 2];
- if (CallService(MS_DB_GETPROFILEPATHT, (WPARAM)SIZEOF(path), (LPARAM)&path))
+ if (CallService(MS_DB_GETPROFILEPATHT, (WPARAM)_countof(path), (LPARAM)&path))
return NULL;
TCHAR full[MAX_PATH + 2];
diff --git a/protocols/GTalkExt/src/menu.cpp b/protocols/GTalkExt/src/menu.cpp
index b640317fe3..50e88caa18 100644
--- a/protocols/GTalkExt/src/menu.cpp
+++ b/protocols/GTalkExt/src/menu.cpp
@@ -41,7 +41,7 @@ int InitMenus(WPARAM wParam, LPARAM lParam)
if (pga != NULL) {
LPCSTR szModuleName = pga->m_japi->GetModuleName();
char szServiceName[100];
- mir_snprintf(szServiceName, SIZEOF(szServiceName), "%s/%s", szModuleName, MS_GTALKEXT_OPENMAILBOX);
+ mir_snprintf(szServiceName, _countof(szServiceName), "%s/%s", szModuleName, MS_GTALKEXT_OPENMAILBOX);
CreateServiceFunctionParam(szServiceName, OpenMailboxMenuHandler, (LPARAM)szModuleName);
CLISTMENUITEM cmi = { sizeof(cmi) };
diff --git a/protocols/GTalkExt/src/notifications.cpp b/protocols/GTalkExt/src/notifications.cpp
index 9f0dd6dbde..c4e21d177d 100644
--- a/protocols/GTalkExt/src/notifications.cpp
+++ b/protocols/GTalkExt/src/notifications.cpp
@@ -199,7 +199,7 @@ static MEVENT AddCListNotification(MCONTACT hContact, LPCSTR acc, POPUPDATAT *da
dbei.eventType = EVENTTYPE_MESSAGE;
char szEventText[4096];
- dbei.cbBlob = mir_snprintf(szEventText, SIZEOF(szEventText), "%s\r\n%s", szUrl, szText);
+ dbei.cbBlob = mir_snprintf(szEventText, _countof(szEventText), "%s\r\n%s", szUrl, szText);
dbei.pBlob = (PBYTE)szEventText;
return db_event_add(hContact, &dbei);
}
diff --git a/protocols/GTalkExt/src/options.cpp b/protocols/GTalkExt/src/options.cpp
index eb5286d7f5..d82087963b 100644
--- a/protocols/GTalkExt/src/options.cpp
+++ b/protocols/GTalkExt/src/options.cpp
@@ -218,7 +218,7 @@ INT_PTR CALLBACK PopupsOptionsDlgProc(HWND wnd, UINT msg, WPARAM wParam, LPARAM
db_set_dw(0, SHORT_PLUGIN_NAME, BACK_COLOR_SETTING, (DWORD)SendDlgItemMessage(wnd, IDC_BACKCOLORPICKER, CPM_GETCOLOUR, 0, 0));
db_set_dw(0, SHORT_PLUGIN_NAME, TEXT_COLOR_SETTING, (DWORD)SendDlgItemMessage(wnd, IDC_TEXTCOLORPICKER, CPM_GETCOLOUR, 0, 0));
- GetDlgItemText(wnd, IDC_TIMEOUTEDIT, timeout, SIZEOF(timeout));
+ GetDlgItemText(wnd, IDC_TIMEOUTEDIT, timeout, _countof(timeout));
db_set_dw(0, SHORT_PLUGIN_NAME, TIMEOUT_SETTING, _ttoi(timeout));
}
return 0;
diff --git a/protocols/GTalkExt/src/tipper_items.cpp b/protocols/GTalkExt/src/tipper_items.cpp
index a17127abda..b4f366d743 100644
--- a/protocols/GTalkExt/src/tipper_items.cpp
+++ b/protocols/GTalkExt/src/tipper_items.cpp
@@ -112,7 +112,7 @@ void AddTipperItem()
}
}
- for (i = 0; i < SIZEOF(TipperItemProps); i++)
+ for (i = 0; i < _countof(TipperItemProps); i++)
ShiftTipperSettings(setting, itemCount, TipperItemProps[i]);
#define WRITE_TIPPER_PROPS(index, value)\
diff --git a/protocols/Gadu-Gadu/src/avatar.cpp b/protocols/Gadu-Gadu/src/avatar.cpp
index 4f04649a6a..f054c5e0e9 100644
--- a/protocols/Gadu-Gadu/src/avatar.cpp
+++ b/protocols/Gadu-Gadu/src/avatar.cpp
@@ -261,7 +261,7 @@ void __cdecl GGPROTO::avatarrequestthread(void*)
if (strncmp(resp->pData,"\x89\x50\x4E\x47\x0D\x0A\x1A\x0A",8) == 0) avatarType = PA_FORMAT_PNG;
setByte(data->hContact, GG_KEY_AVATARTYPE, (BYTE)avatarType);
- getAvatarFilename(ai.hContact, ai.filename, SIZEOF(ai.filename));
+ getAvatarFilename(ai.hContact, ai.filename, _countof(ai.filename));
file_fd = _topen(ai.filename, _O_WRONLY | _O_TRUNC | _O_BINARY | _O_CREAT, _S_IREAD | _S_IWRITE);
if (file_fd != -1) {
_write(file_fd, resp->pData, resp->dataLength);
@@ -389,7 +389,7 @@ void __cdecl GGPROTO::setavatarthread(void *param)
size_t avatarFileB64EncLen = mir_strlen(avatarFileB64Enc);
char dataPrefix[64];
- mir_snprintf(dataPrefix, SIZEOF(dataPrefix), "uin=%d&photo=", getDword(GG_KEY_UIN, 0));
+ mir_snprintf(dataPrefix, _countof(dataPrefix), "uin=%d&photo=", getDword(GG_KEY_UIN, 0));
size_t dataPrefixLen = mir_strlen(dataPrefix);
size_t dataLen = dataPrefixLen + avatarFileB64EncLen;
diff --git a/protocols/Gadu-Gadu/src/core.cpp b/protocols/Gadu-Gadu/src/core.cpp
index 47b20cb21d..dca61cd88b 100644
--- a/protocols/Gadu-Gadu/src/core.cpp
+++ b/protocols/Gadu-Gadu/src/core.cpp
@@ -637,8 +637,8 @@ retry:
_tcsncpy_s(strFmt2, pcli->pfnGetStatusModeDescription( status_gg2m(atoi(__status)), 0), _TRUNCATE);
if (__city) {
- mir_sntprintf(strFmt1, SIZEOF(strFmt1), _T(", %s %s"), TranslateT("City:"), __city);
- mir_tstrncat(strFmt2, strFmt1, SIZEOF(strFmt2) - mir_tstrlen(strFmt2));
+ mir_sntprintf(strFmt1, _countof(strFmt1), _T(", %s %s"), TranslateT("City:"), __city);
+ mir_tstrncat(strFmt2, strFmt1, _countof(strFmt2) - mir_tstrlen(strFmt2));
}
if (__birthyear) {
time_t t = time(NULL);
@@ -646,8 +646,8 @@ retry:
int br = atoi(__birthyear);
if (br < (lt->tm_year + 1900) && br > 1900) {
- mir_sntprintf(strFmt1, SIZEOF(strFmt1), _T(", %s %d"), TranslateT("Age:"), (lt->tm_year + 1900) - br);
- mir_tstrncat(strFmt2, strFmt1, SIZEOF(strFmt2) - mir_tstrlen(strFmt2));
+ mir_sntprintf(strFmt1, _countof(strFmt1), _T(", %s %d"), TranslateT("Age:"), (lt->tm_year + 1900) - br);
+ mir_tstrncat(strFmt2, strFmt1, _countof(strFmt2) - mir_tstrlen(strFmt2));
}
}
@@ -975,7 +975,7 @@ retry:
if (iIndexes && iIndexes[i])
continue;
- mir_sntprintf(szMsg, SIZEOF(szMsg), _T("%s (%s)"), szText,
+ mir_sntprintf(szMsg, _countof(szMsg), _T("%s (%s)"), szText,
*e->event.multilogon_info.sessions[i].name != '\0' ?
_A2T(e->event.multilogon_info.sessions[i].name) : TranslateT("Unknown client"));
showpopup(m_tszUserName, szMsg, GG_POPUP_MULTILOGON);
@@ -1008,7 +1008,7 @@ retry:
{
CLISTEVENT cle = {0};
char service[128];
- mir_snprintf(service, SIZEOF(service), GGS_RECVIMAGE, m_szModuleName);
+ mir_snprintf(service, _countof(service), GGS_RECVIMAGE, m_szModuleName);
cle.cbSize = sizeof(cle);
cle.hContact = hContact;
@@ -1716,7 +1716,7 @@ void GGPROTO::changecontactstatus(uin_t uin, int status, const TCHAR *idescr, in
{
char sversion[48];
setDword(hContact, GG_KEY_CLIENTVERSION, (DWORD) version);
- mir_snprintf(sversion, SIZEOF(sversion), "%sGadu-Gadu %s", (version & 0x00ffffff) > 0x2b ? "Nowe " : "", gg_version2string(version));
+ mir_snprintf(sversion, _countof(sversion), "%sGadu-Gadu %s", (version & 0x00ffffff) > 0x2b ? "Nowe " : "", gg_version2string(version));
setString(hContact, "MirVer", sversion);
}
}
diff --git a/protocols/Gadu-Gadu/src/dialogs.cpp b/protocols/Gadu-Gadu/src/dialogs.cpp
index a142393008..98745341af 100644
--- a/protocols/Gadu-Gadu/src/dialogs.cpp
+++ b/protocols/Gadu-Gadu/src/dialogs.cpp
@@ -60,7 +60,7 @@ static void SetValue(HWND hwndDlg, int idCtrl, MCONTACT hContact, char *szModule
else if (special == SVS_MONTH) {
if (dbv.bVal > 0 && dbv.bVal <= 12) {
ptstr = str;
- GetLocaleInfo(LOCALE_USER_DEFAULT, LOCALE_SABBREVMONTHNAME1 - 1 + dbv.bVal, str, SIZEOF(str));
+ GetLocaleInfo(LOCALE_USER_DEFAULT, LOCALE_SABBREVMONTHNAME1 - 1 + dbv.bVal, str, _countof(str));
}
else unspecified = 1;
}
@@ -68,7 +68,7 @@ static void SetValue(HWND hwndDlg, int idCtrl, MCONTACT hContact, char *szModule
if (dbv.cVal == -100) unspecified = 1;
else {
ptstr = str;
- mir_sntprintf(str, SIZEOF(str), dbv.cVal ? _T("GMT%+d:%02d") : _T("GMT"), -dbv.cVal / 2, (dbv.cVal & 1) * 30);
+ mir_sntprintf(str, _countof(str), dbv.cVal ? _T("GMT%+d:%02d") : _T("GMT"), -dbv.cVal / 2, (dbv.cVal & 1) * 30);
}
} else {
unspecified = (special == SVS_ZEROISUNSPEC && dbv.bVal == 0);
@@ -82,7 +82,7 @@ static void SetValue(HWND hwndDlg, int idCtrl, MCONTACT hContact, char *szModule
unspecified = 1;
} else {
ptstr = str;
- mir_sntprintf(str, SIZEOF(str), _T("%S"), pstr);
+ mir_sntprintf(str, _countof(str), _T("%S"), pstr);
}
}
else {
@@ -100,12 +100,12 @@ static void SetValue(HWND hwndDlg, int idCtrl, MCONTACT hContact, char *szModule
unspecified = 1;
} else {
ptstr = str;
- mir_sntprintf(str, SIZEOF(str), _T("%S"), pstr);
+ mir_sntprintf(str, _countof(str), _T("%S"), pstr);
}
if (dbv.dVal == 0) unspecified = 1;
} else if (special == SVS_GGVERSION) {
ptstr = str;
- mir_sntprintf(str, SIZEOF(str), _T("%S"), (char *)gg_version2string(dbv.dVal));
+ mir_sntprintf(str, _countof(str), _T("%S"), (char *)gg_version2string(dbv.dVal));
} else {
ptstr = _itot(special == SVS_SIGNED ? dbv.lVal : dbv.dVal, str, 10);
}
@@ -113,7 +113,7 @@ static void SetValue(HWND hwndDlg, int idCtrl, MCONTACT hContact, char *szModule
case DBVT_ASCIIZ:
unspecified = (special == SVS_ZEROISUNSPEC && dbv.pszVal[0] == '\0');
ptstr = str;
- mir_sntprintf(str, SIZEOF(str), _T("%S"), dbv.pszVal);
+ mir_sntprintf(str, _countof(str), _T("%S"), dbv.pszVal);
break;
case DBVT_TCHAR:
unspecified = (special == SVS_ZEROISUNSPEC && dbv.ptszVal[0] == '\0');
@@ -123,7 +123,7 @@ static void SetValue(HWND hwndDlg, int idCtrl, MCONTACT hContact, char *szModule
unspecified = (special == SVS_ZEROISUNSPEC && dbv.pszVal[0] == '\0');
valT = mir_utf8decodeT(dbv.pszVal);
ptstr = str;
- _tcscpy_s(str, SIZEOF(str), valT);
+ _tcscpy_s(str, _countof(str), valT);
mir_free(valT);
break;
default:
@@ -204,9 +204,9 @@ void GGPROTO::checknewuser(uin_t uin, const char* passwd)
static void gg_optsdlgcheck(HWND hwndDlg)
{
TCHAR text[128];
- GetDlgItemText(hwndDlg, IDC_UIN, text, SIZEOF(text));
+ GetDlgItemText(hwndDlg, IDC_UIN, text, _countof(text));
if (text[0]) {
- GetDlgItemText(hwndDlg, IDC_EMAIL, text, SIZEOF(text));
+ GetDlgItemText(hwndDlg, IDC_EMAIL, text, _countof(text));
if (text[0])
ShowWindow(GetDlgItem(hwndDlg, IDC_CHEMAIL), SW_SHOW);
else
@@ -337,9 +337,9 @@ static INT_PTR CALLBACK gg_genoptsdlgproc(HWND hwndDlg, UINT msg, WPARAM wParam,
{
char email[128];
uin_t uin;
- GetDlgItemTextA(hwndDlg, IDC_UIN, email, SIZEOF(email));
+ GetDlgItemTextA(hwndDlg, IDC_UIN, email, _countof(email));
uin = atoi(email);
- GetDlgItemTextA(hwndDlg, IDC_EMAIL, email, SIZEOF(email));
+ GetDlgItemTextA(hwndDlg, IDC_EMAIL, email, _countof(email));
if (!mir_strlen(email))
MessageBox(NULL, TranslateT("You need to specify your registration e-mail first."),
gg->m_tszUserName, MB_OK | MB_ICONEXCLAMATION);
@@ -370,10 +370,10 @@ static INT_PTR CALLBACK gg_genoptsdlgproc(HWND hwndDlg, UINT msg, WPARAM wParam,
GGUSERUTILDLGDATA dat;
int ret;
char pass[128], email[128];
- GetDlgItemTextA(hwndDlg, IDC_UIN, pass, SIZEOF(pass));
+ GetDlgItemTextA(hwndDlg, IDC_UIN, pass, _countof(pass));
dat.uin = atoi(pass);
- GetDlgItemTextA(hwndDlg, IDC_PASSWORD, pass, SIZEOF(pass));
- GetDlgItemTextA(hwndDlg, IDC_EMAIL, email, SIZEOF(email));
+ GetDlgItemTextA(hwndDlg, IDC_PASSWORD, pass, _countof(pass));
+ GetDlgItemTextA(hwndDlg, IDC_EMAIL, email, _countof(email));
dat.pass = pass;
dat.email = email;
dat.gg = gg;
@@ -457,15 +457,15 @@ static INT_PTR CALLBACK gg_genoptsdlgproc(HWND hwndDlg, UINT msg, WPARAM wParam,
uin_t uin;
// Write Gadu-Gadu number & password
- GetDlgItemTextA(hwndDlg, IDC_UIN, str, SIZEOF(str));
+ GetDlgItemTextA(hwndDlg, IDC_UIN, str, _countof(str));
uin = atoi(str);
- GetDlgItemTextA(hwndDlg, IDC_PASSWORD, str, SIZEOF(str));
+ GetDlgItemTextA(hwndDlg, IDC_PASSWORD, str, _countof(str));
gg->checknewuser(uin, str);
gg->setDword(GG_KEY_UIN, uin);
gg->setString(GG_KEY_PASSWORD, str);
// Write Gadu-Gadu email
- GetDlgItemTextA(hwndDlg, IDC_EMAIL, str, SIZEOF(str));
+ GetDlgItemTextA(hwndDlg, IDC_EMAIL, str, _countof(str));
gg->setString(GG_KEY_EMAIL, str);
// Write checkboxes
@@ -564,9 +564,9 @@ static INT_PTR CALLBACK gg_confoptsdlgproc(HWND hwndDlg, UINT msg, WPARAM wParam
gg->setWord(GG_KEY_GC_POLICY_UNKNOWN, (WORD)SendDlgItemMessage(hwndDlg, IDC_GC_POLICY_UNKNOWN, CB_GETCURSEL, 0, 0));
gg->setWord(GG_KEY_GC_POLICY_DEFAULT, (WORD)SendDlgItemMessage(hwndDlg, IDC_GC_POLICY_DEFAULT, CB_GETCURSEL, 0, 0));
- GetDlgItemTextA(hwndDlg, IDC_GC_COUNT_TOTAL, str, SIZEOF(str));
+ GetDlgItemTextA(hwndDlg, IDC_GC_COUNT_TOTAL, str, _countof(str));
gg->setWord(GG_KEY_GC_COUNT_TOTAL, (WORD)atoi(str));
- GetDlgItemTextA(hwndDlg, IDC_GC_COUNT_UNKNOWN, str, SIZEOF(str));
+ GetDlgItemTextA(hwndDlg, IDC_GC_COUNT_UNKNOWN, str, _countof(str));
gg->setWord(GG_KEY_GC_COUNT_UNKNOWN, (WORD)atoi(str));
}
break;
@@ -664,16 +664,16 @@ static INT_PTR CALLBACK gg_advoptsdlgproc(HWND hwndDlg, UINT msg, WPARAM wParam,
gg->setByte(GG_KEY_FORWARDING, (BYTE) IsDlgButtonChecked(hwndDlg, IDC_FORWARDING));
// Write custom servers
- GetDlgItemTextA(hwndDlg, IDC_HOST, str, SIZEOF(str));
+ GetDlgItemTextA(hwndDlg, IDC_HOST, str, _countof(str));
gg->setString(GG_KEY_SERVERHOSTS, str);
// Write direct port
- GetDlgItemTextA(hwndDlg, IDC_DIRECTPORT, str, SIZEOF(str));
+ GetDlgItemTextA(hwndDlg, IDC_DIRECTPORT, str, _countof(str));
gg->setWord(GG_KEY_DIRECTPORT, (WORD)atoi(str));
// Write forwarding host
- GetDlgItemTextA(hwndDlg, IDC_FORWARDHOST, str, SIZEOF(str));
+ GetDlgItemTextA(hwndDlg, IDC_FORWARDHOST, str, _countof(str));
gg->setString(GG_KEY_FORWARDHOST, str);
- GetDlgItemTextA(hwndDlg, IDC_FORWARDPORT, str, SIZEOF(str));
+ GetDlgItemTextA(hwndDlg, IDC_FORWARDPORT, str, _countof(str));
gg->setWord(GG_KEY_FORWARDPORT, (WORD)atoi(str));
break;
}
@@ -828,19 +828,19 @@ static INT_PTR CALLBACK gg_detailsdlgproc(HWND hwndDlg, UINT msg, WPARAM wParam,
gg_pubdir50_t req = gg_pubdir50_new(GG_PUBDIR50_WRITE);
- GetDlgItemText(hwndDlg, IDC_FIRSTNAME, text, SIZEOF(text));
+ GetDlgItemText(hwndDlg, IDC_FIRSTNAME, text, _countof(text));
if (mir_tstrlen(text))
gg_pubdir50_add(req, GG_PUBDIR50_FIRSTNAME, T2Utf(text));
- GetDlgItemText(hwndDlg, IDC_LASTNAME, text, SIZEOF(text));
+ GetDlgItemText(hwndDlg, IDC_LASTNAME, text, _countof(text));
if (mir_tstrlen(text))
gg_pubdir50_add(req, GG_PUBDIR50_LASTNAME, T2Utf(text));
- GetDlgItemText(hwndDlg, IDC_NICKNAME, text, SIZEOF(text));
+ GetDlgItemText(hwndDlg, IDC_NICKNAME, text, _countof(text));
if (mir_tstrlen(text))
gg_pubdir50_add(req, GG_PUBDIR50_NICKNAME, T2Utf(text));
- GetDlgItemText(hwndDlg, IDC_CITY, text, SIZEOF(text));
+ GetDlgItemText(hwndDlg, IDC_CITY, text, _countof(text));
if (mir_tstrlen(text))
gg_pubdir50_add(req, GG_PUBDIR50_CITY, T2Utf(text));
@@ -856,15 +856,15 @@ static INT_PTR CALLBACK gg_detailsdlgproc(HWND hwndDlg, UINT msg, WPARAM wParam,
gg_pubdir50_add(req, GG_PUBDIR50_GENDER, "");
}
- GetDlgItemText(hwndDlg, IDC_BIRTHYEAR, text, SIZEOF(text));
+ GetDlgItemText(hwndDlg, IDC_BIRTHYEAR, text, _countof(text));
if (mir_tstrlen(text))
gg_pubdir50_add(req, GG_PUBDIR50_BIRTHYEAR, T2Utf(text));
- GetDlgItemText(hwndDlg, IDC_FAMILYNAME, text, SIZEOF(text));
+ GetDlgItemText(hwndDlg, IDC_FAMILYNAME, text, _countof(text));
if (mir_tstrlen(text))
gg_pubdir50_add(req, GG_PUBDIR50_FAMILYNAME, T2Utf(text));
- GetDlgItemText(hwndDlg, IDC_CITYORIGIN, text, SIZEOF(text));
+ GetDlgItemText(hwndDlg, IDC_CITYORIGIN, text, _countof(text));
if (mir_tstrlen(text))
gg_pubdir50_add(req, GG_PUBDIR50_FAMILYCITY, T2Utf(text));
@@ -962,10 +962,10 @@ INT_PTR CALLBACK gg_acc_mgr_guidlgproc(HWND hwndDlg, UINT msg, WPARAM wParam, LP
GGUSERUTILDLGDATA dat;
int ret;
char pass[128], email[128];
- GetDlgItemTextA(hwndDlg, IDC_UIN, pass, SIZEOF(pass));
+ GetDlgItemTextA(hwndDlg, IDC_UIN, pass, _countof(pass));
dat.uin = atoi(pass);
- GetDlgItemTextA(hwndDlg, IDC_PASSWORD, pass, SIZEOF(pass));
- GetDlgItemTextA(hwndDlg, IDC_EMAIL, email, SIZEOF(email));
+ GetDlgItemTextA(hwndDlg, IDC_PASSWORD, pass, _countof(pass));
+ GetDlgItemTextA(hwndDlg, IDC_EMAIL, email, _countof(email));
dat.pass = pass;
dat.email = email;
dat.gg = gg;
@@ -1021,15 +1021,15 @@ INT_PTR CALLBACK gg_acc_mgr_guidlgproc(HWND hwndDlg, UINT msg, WPARAM wParam, LP
uin_t uin;
// Write Gadu-Gadu number & password
- GetDlgItemTextA(hwndDlg, IDC_UIN, str, SIZEOF(str));
+ GetDlgItemTextA(hwndDlg, IDC_UIN, str, _countof(str));
uin = atoi(str);
- GetDlgItemTextA(hwndDlg, IDC_PASSWORD, str, SIZEOF(str));
+ GetDlgItemTextA(hwndDlg, IDC_PASSWORD, str, _countof(str));
gg->checknewuser(uin, str);
gg->setDword(GG_KEY_UIN, uin);
gg->setString(GG_KEY_PASSWORD, str);
// Write Gadu-Gadu email
- GetDlgItemTextA(hwndDlg, IDC_EMAIL, str, SIZEOF(str));
+ GetDlgItemTextA(hwndDlg, IDC_EMAIL, str, _countof(str));
gg->setString(GG_KEY_EMAIL, str);
}
}
diff --git a/protocols/Gadu-Gadu/src/filetransfer.cpp b/protocols/Gadu-Gadu/src/filetransfer.cpp
index 932aa9f94e..7034f31036 100644
--- a/protocols/Gadu-Gadu/src/filetransfer.cpp
+++ b/protocols/Gadu-Gadu/src/filetransfer.cpp
@@ -269,7 +269,7 @@ void __cdecl GGPROTO::dccmainthread(void*)
{
PROTOFILETRANSFERSTATUS pfts;
local_dcc->tick = tick;
- mir_snprintf(szFilename, SIZEOF(szFilename), "%s%s", local_dcc->folder, local_dcc->file_info.filename);
+ mir_snprintf(szFilename, _countof(szFilename), "%s%s", local_dcc->folder, local_dcc->file_info.filename);
memset(&pfts, 0, sizeof(PROTOFILETRANSFERSTATUS));
pfts.cbSize = sizeof(PROTOFILETRANSFERSTATUS);
pfts.hContact = (MCONTACT)local_dcc->contact;
@@ -299,7 +299,7 @@ void __cdecl GGPROTO::dccmainthread(void*)
if (local_dcc->file_fd != -1)
{
PROTOFILETRANSFERSTATUS pfts;
- mir_snprintf(szFilename, SIZEOF(szFilename), "%s%s", local_dcc->folder, local_dcc->file_info.filename);
+ mir_snprintf(szFilename, _countof(szFilename), "%s%s", local_dcc->folder, local_dcc->file_info.filename);
memset(&pfts, 0, sizeof(PROTOFILETRANSFERSTATUS));
pfts.cbSize = sizeof(PROTOFILETRANSFERSTATUS);
pfts.hContact = (MCONTACT)local_dcc->contact;
@@ -497,7 +497,7 @@ void __cdecl GGPROTO::dccmainthread(void*)
{
PROTOFILETRANSFERSTATUS pfts;
local_dcc7->tick = tick;
- mir_snprintf(szFilename, SIZEOF(szFilename), "%s%s", local_dcc->folder, local_dcc7->filename);
+ mir_snprintf(szFilename, _countof(szFilename), "%s%s", local_dcc->folder, local_dcc7->filename);
memset(&pfts, 0, sizeof(PROTOFILETRANSFERSTATUS));
pfts.cbSize = sizeof(PROTOFILETRANSFERSTATUS);
pfts.hContact = (MCONTACT)local_dcc7->contact;
@@ -527,7 +527,7 @@ void __cdecl GGPROTO::dccmainthread(void*)
if (local_dcc7->file_fd != -1)
{
PROTOFILETRANSFERSTATUS pfts;
- mir_snprintf(szFilename, SIZEOF(szFilename), "%s%s", local_dcc->folder, local_dcc7->filename);
+ mir_snprintf(szFilename, _countof(szFilename), "%s%s", local_dcc->folder, local_dcc7->filename);
memset(&pfts, 0, sizeof(PROTOFILETRANSFERSTATUS));
pfts.cbSize = sizeof(PROTOFILETRANSFERSTATUS);
pfts.hContact = (MCONTACT)local_dcc7->contact;
diff --git a/protocols/Gadu-Gadu/src/gg.cpp b/protocols/Gadu-Gadu/src/gg.cpp
index de7203f4d9..5d673107c0 100644
--- a/protocols/Gadu-Gadu/src/gg.cpp
+++ b/protocols/Gadu-Gadu/src/gg.cpp
@@ -64,11 +64,11 @@ TCHAR* ws_strerror(int code)
if (code == 0)
{
TCHAR buff[128];
- int len = FormatMessage(FORMAT_MESSAGE_FROM_SYSTEM, NULL, WSAGetLastError(), 0, buff, SIZEOF(buff), NULL);
+ int len = FormatMessage(FORMAT_MESSAGE_FROM_SYSTEM, NULL, WSAGetLastError(), 0, buff, _countof(buff), NULL);
if (len == 0)
- mir_sntprintf(err_desc, SIZEOF(err_desc), _T("WinSock %u: Unknown error."), WSAGetLastError());
+ mir_sntprintf(err_desc, _countof(err_desc), _T("WinSock %u: Unknown error."), WSAGetLastError());
else
- mir_sntprintf(err_desc, SIZEOF(err_desc), _T("WinSock %d: %s"), WSAGetLastError(), buff);
+ mir_sntprintf(err_desc, _countof(err_desc), _T("WinSock %d: %s"), WSAGetLastError(), buff);
return err_desc;
}
@@ -155,18 +155,18 @@ void GGPROTO::cleanuplastplugin(DWORD version)
debugLogA("cleanuplastplugin() 1: version=%d Cleaning junk avatar files from < 0.11.0.2", version);
TCHAR avatarsPath[MAX_PATH];
- mir_sntprintf(avatarsPath, SIZEOF(avatarsPath), _T("%s\\%s"), VARST( _T("%miranda_avatarcache%")), m_tszUserName);
+ mir_sntprintf(avatarsPath, _countof(avatarsPath), _T("%s\\%s"), VARST( _T("%miranda_avatarcache%")), m_tszUserName);
debugLog(_T("cleanuplastplugin() 1: miranda_avatarcache = %s"), avatarsPath);
TCHAR spec[MAX_PATH + 10];
- mir_sntprintf(spec, SIZEOF(spec), _T("%s\\*.(null)"), avatarsPath);
+ mir_sntprintf(spec, _countof(spec), _T("%s\\*.(null)"), avatarsPath);
WIN32_FIND_DATA ffd;
HANDLE hFind = FindFirstFile(spec, &ffd);
if (hFind != INVALID_HANDLE_VALUE) {
do {
TCHAR filePathT [2*MAX_PATH + 10];
- mir_sntprintf(filePathT, SIZEOF(filePathT), _T("%s\\%s"), avatarsPath, ffd.cFileName);
+ mir_sntprintf(filePathT, _countof(filePathT), _T("%s\\%s"), avatarsPath, ffd.cFileName);
if (!_taccess(filePathT, 0)){
debugLog(_T("cleanuplastplugin() 1: remove file = %s"), filePathT);
_tremove(filePathT);
@@ -240,7 +240,7 @@ INT_PTR GGPROTO::blockuser(WPARAM hContact, LPARAM lParam)
void GGPROTO::block_init()
{
char service[64];
- mir_snprintf(service, SIZEOF(service), "%s%s", m_szModuleName, GGS_BLOCKUSER);
+ mir_snprintf(service, _countof(service), "%s%s", m_szModuleName, GGS_BLOCKUSER);
CreateProtoService(GGS_BLOCKUSER, &GGPROTO::blockuser);
CLISTMENUITEM mi = { sizeof(mi) };
@@ -435,7 +435,7 @@ void gg_debughandler(int level, const char *format, va_list ap)
strncpy(szText + PREFIXLEN, "[libgadu] \0", sizeof(szText) - PREFIXLEN);
char prefix[6];
- mir_snprintf(prefix, SIZEOF(prefix), "%lu", GetCurrentThreadId());
+ mir_snprintf(prefix, _countof(prefix), "%lu", GetCurrentThreadId());
size_t prefixLen = mir_strlen(prefix);
if (prefixLen < PREFIXLEN) memset(prefix + prefixLen, ' ', PREFIXLEN - prefixLen);
memcpy(szText, prefix, PREFIXLEN);
diff --git a/protocols/Gadu-Gadu/src/gg_proto.cpp b/protocols/Gadu-Gadu/src/gg_proto.cpp
index 509fddb0ff..8a98d9428c 100644
--- a/protocols/Gadu-Gadu/src/gg_proto.cpp
+++ b/protocols/Gadu-Gadu/src/gg_proto.cpp
@@ -40,7 +40,7 @@ GGPROTO::GGPROTO(const char* pszProtoName, const TCHAR* tszUserName) :
// Register m_hNetlibUser user
TCHAR name[128];
- mir_sntprintf(name, SIZEOF(name), TranslateT("%s connection"), m_tszUserName);
+ mir_sntprintf(name, _countof(name), TranslateT("%s connection"), m_tszUserName);
NETLIBUSER nlu = { 0 };
nlu.cbSize = sizeof(nlu);
@@ -392,7 +392,7 @@ HWND GGPROTO::SearchAdvanced(HWND hwndDlg)
// Fetch search data
TCHAR text[64];
- GetDlgItemText(hwndDlg, IDC_FIRSTNAME, text, SIZEOF(text));
+ GetDlgItemText(hwndDlg, IDC_FIRSTNAME, text, _countof(text));
if (mir_tstrlen(text))
{
T2Utf firstName_utf8(text);
@@ -401,7 +401,7 @@ HWND GGPROTO::SearchAdvanced(HWND hwndDlg)
}
/* 1 */ szQuery.AppendChar('.');
- GetDlgItemText(hwndDlg, IDC_LASTNAME, text, SIZEOF(text));
+ GetDlgItemText(hwndDlg, IDC_LASTNAME, text, _countof(text));
if (mir_tstrlen(text))
{
T2Utf lastName_utf8(text);
@@ -410,7 +410,7 @@ HWND GGPROTO::SearchAdvanced(HWND hwndDlg)
}
/* 2 */ szQuery.AppendChar('.');
- GetDlgItemText(hwndDlg, IDC_NICKNAME, text, SIZEOF(text));
+ GetDlgItemText(hwndDlg, IDC_NICKNAME, text, _countof(text));
if (mir_tstrlen(text))
{
T2Utf nickName_utf8(text);
@@ -419,7 +419,7 @@ HWND GGPROTO::SearchAdvanced(HWND hwndDlg)
}
/* 3 */ szQuery.AppendChar('.');
- GetDlgItemText(hwndDlg, IDC_CITY, text, SIZEOF(text));
+ GetDlgItemText(hwndDlg, IDC_CITY, text, _countof(text));
if (mir_tstrlen(text))
{
T2Utf city_utf8(text);
@@ -428,7 +428,7 @@ HWND GGPROTO::SearchAdvanced(HWND hwndDlg)
}
/* 4 */ szQuery.AppendChar('.');
- GetDlgItemText(hwndDlg, IDC_AGEFROM, text, SIZEOF(text));
+ GetDlgItemText(hwndDlg, IDC_AGEFROM, text, _countof(text));
if (mir_tstrlen(text))
{
int yearTo = _tstoi(text);
@@ -438,7 +438,7 @@ HWND GGPROTO::SearchAdvanced(HWND hwndDlg)
int ay = lt->tm_year + 1900;
char age[16];
- GetDlgItemTextA(hwndDlg, IDC_AGETO, age, SIZEOF(age));
+ GetDlgItemTextA(hwndDlg, IDC_AGETO, age, _countof(age));
yearFrom = atoi(age);
// Count & fix ranges
diff --git a/protocols/Gadu-Gadu/src/groupchat.cpp b/protocols/Gadu-Gadu/src/groupchat.cpp
index 279fea7174..d7a3c77528 100644
--- a/protocols/Gadu-Gadu/src/groupchat.cpp
+++ b/protocols/Gadu-Gadu/src/groupchat.cpp
@@ -43,7 +43,7 @@ int GGPROTO::gc_init()
gc_enabled = TRUE;
// create & hook event
- mir_snprintf(service, SIZEOF(service), GG_GC_GETCHAT, m_szModuleName);
+ mir_snprintf(service, _countof(service), GG_GC_GETCHAT, m_szModuleName);
debugLogA("gc_init(): Registered with groupchat plugin.");
}
else debugLogA("gc_init(): Cannot register with groupchat plugin !!!");
@@ -64,7 +64,7 @@ void GGPROTO::gc_menus_init(HGENMENU hRoot)
mi.hParentMenu = hRoot;
// Conferencing
- mir_snprintf(service, SIZEOF(service), "%s%s", m_szModuleName, GGS_OPEN_CONF);
+ mir_snprintf(service, _countof(service), "%s%s", m_szModuleName, GGS_OPEN_CONF);
CreateProtoService(GGS_OPEN_CONF, &GGPROTO::gc_openconf);
mi.position = 2000050001;
mi.icolibItem = iconList[14].hIcolib;
@@ -73,7 +73,7 @@ void GGPROTO::gc_menus_init(HGENMENU hRoot)
hMainMenu[0] = Menu_AddProtoMenuItem(&mi);
// Clear ignored conferences
- mir_snprintf(service, SIZEOF(service), "%s%s", m_szModuleName, GGS_CLEAR_IGNORED);
+ mir_snprintf(service, _countof(service), "%s%s", m_szModuleName, GGS_CLEAR_IGNORED);
CreateProtoService(GGS_CLEAR_IGNORED, &GGPROTO::gc_clearignored);
mi.position = 2000050002;
mi.icolibItem = iconList[15].hIcolib;
@@ -303,7 +303,7 @@ TCHAR* GGPROTO::gc_getchat(uin_t sender, uin_t *recipients, int recipients_count
// Create new chat window
TCHAR status[256];
TCHAR *senderName = sender ? pcli->pfnGetContactDisplayName(getcontact(sender, 1, 0, NULL), 0) : NULL;
- mir_sntprintf(status, SIZEOF(status), (sender) ? TranslateT("%s initiated the conference.") : TranslateT("This is my own conference."), senderName);
+ mir_sntprintf(status, _countof(status), (sender) ? TranslateT("%s initiated the conference.") : TranslateT("This is my own conference."), senderName);
GCSESSION gcwindow = { sizeof(gcwindow) };
gcwindow.iType = GCW_CHATROOM;
diff --git a/protocols/Gadu-Gadu/src/icolib.cpp b/protocols/Gadu-Gadu/src/icolib.cpp
index a0b9c291de..c527755058 100644
--- a/protocols/Gadu-Gadu/src/icolib.cpp
+++ b/protocols/Gadu-Gadu/src/icolib.cpp
@@ -41,23 +41,23 @@ extern IconItem iconList[] =
{ LPGEN("Concurrent sessions"), "sessions", IDI_SESSIONS }
};
-HANDLE hIconLibItem[SIZEOF(iconList)];
+HANDLE hIconLibItem[_countof(iconList)];
void gg_icolib_init()
{
- Icon_Register(hInstance, "Protocols/" GGDEF_PROTO, iconList, SIZEOF(iconList), GGDEF_PROTO);
+ Icon_Register(hInstance, "Protocols/" GGDEF_PROTO, iconList, _countof(iconList), GGDEF_PROTO);
}
HICON LoadIconEx(const char* name, bool big)
{
char szSettingName[100];
- mir_snprintf(szSettingName, SIZEOF(szSettingName), "%s_%s", GGDEF_PROTO, name);
+ mir_snprintf(szSettingName, _countof(szSettingName), "%s_%s", GGDEF_PROTO, name);
return IcoLib_GetIcon(szSettingName, 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 hIconLibItem[i];
return NULL;
@@ -66,7 +66,7 @@ HANDLE GetIconHandle(int iconId)
void ReleaseIconEx(const char* name, bool big)
{
char szSettingName[100];
- mir_snprintf(szSettingName, SIZEOF(szSettingName), "%s_%s", GGDEF_PROTO, name);
+ mir_snprintf(szSettingName, _countof(szSettingName), "%s_%s", GGDEF_PROTO, name);
IcoLib_Release(szSettingName, big);
}
diff --git a/protocols/Gadu-Gadu/src/image.cpp b/protocols/Gadu-Gadu/src/image.cpp
index f92c77fac1..8d6e02cc90 100644
--- a/protocols/Gadu-Gadu/src/image.cpp
+++ b/protocols/Gadu-Gadu/src/image.cpp
@@ -69,7 +69,7 @@ int gg_img_remove(GGIMAGEDLGDATA *dat);
int GGPROTO::img_init()
{
char service[64];
- mir_snprintf(service, SIZEOF(service), "%s%s", m_szModuleName, GGS_SENDIMAGE);
+ mir_snprintf(service, _countof(service), "%s%s", m_szModuleName, GGS_SENDIMAGE);
CreateProtoService(GGS_SENDIMAGE, &GGPROTO::img_sendimg);
// Send image contact menu item
@@ -248,10 +248,10 @@ int gg_img_saveimage(HWND hwnd, GGIMAGEENTRY *dat)
GGPROTO* gg = ((GGIMAGEDLGDATA *)GetWindowLongPtr(hwnd, GWLP_USERDATA))->gg;
TCHAR szFilter[128];
- gg_img_getfilter(szFilter, SIZEOF(szFilter));
+ gg_img_getfilter(szFilter, _countof(szFilter));
TCHAR szFileName[MAX_PATH];
- _tcsncpy(szFileName, dat->lpszFileName, SIZEOF(szFileName));
+ _tcsncpy(szFileName, dat->lpszFileName, _countof(szFileName));
OPENFILENAME ofn = {0};
ofn.lStructSize = OPENFILENAME_SIZE_VERSION_400;
@@ -677,7 +677,7 @@ static INT_PTR CALLBACK gg_img_dlgproc(HWND hwndDlg, UINT msg, WPARAM wParam, LP
TCHAR szFileName[MAX_PATH];
OPENFILENAME ofn = {0};
- gg_img_getfilter(szFilter, SIZEOF(szFilter));
+ gg_img_getfilter(szFilter, _countof(szFilter));
*szFileName = 0;
ofn.lStructSize = OPENFILENAME_SIZE_VERSION_400;
ofn.hwndOwner = hwndDlg;
@@ -860,7 +860,7 @@ int GGPROTO::img_displayasmsg(MCONTACT hContact, void *img)
if (res != 0) {
TCHAR image_msg[MAX_PATH + 11];
- mir_sntprintf(image_msg, SIZEOF(image_msg), _T("[img]%s[/img]"), szPath);
+ mir_sntprintf(image_msg, _countof(image_msg), _T("[img]%s[/img]"), szPath);
T2Utf szMessage(image_msg);
PROTORECVEVENT pre = {0};
diff --git a/protocols/Gadu-Gadu/src/import.cpp b/protocols/Gadu-Gadu/src/import.cpp
index 3c17b89cee..d8a4001f43 100644
--- a/protocols/Gadu-Gadu/src/import.cpp
+++ b/protocols/Gadu-Gadu/src/import.cpp
@@ -336,26 +336,26 @@ INT_PTR GGPROTO::import_text(WPARAM wParam, LPARAM lParam)
OPENFILENAME ofn = {0};
ofn.lStructSize = OPENFILENAME_SIZE_VERSION_400;
- _tcsncpy(filter, TranslateT("Text files"), SIZEOF(filter));
- mir_tstrncat(filter, _T(" (*.txt)"), SIZEOF(filter) - mir_tstrlen(filter));
+ _tcsncpy(filter, TranslateT("Text files"), _countof(filter));
+ mir_tstrncat(filter, _T(" (*.txt)"), _countof(filter) - mir_tstrlen(filter));
pfilter = filter + mir_tstrlen(filter) + 1;
- if (pfilter >= filter + SIZEOF(filter))
+ if (pfilter >= filter + _countof(filter))
return 0;
- _tcsncpy(pfilter, _T("*.TXT"), SIZEOF(filter) - (pfilter - filter));
+ _tcsncpy(pfilter, _T("*.TXT"), _countof(filter) - (pfilter - filter));
pfilter = pfilter + mir_tstrlen(pfilter) + 1;
- if (pfilter >= filter + SIZEOF(filter))
+ if (pfilter >= filter + _countof(filter))
return 0;
- _tcsncpy(pfilter, TranslateT("All Files"), SIZEOF(filter) - (pfilter - filter));
- mir_tstrncat(pfilter, _T(" (*)"), SIZEOF(filter) - (pfilter - filter) - mir_tstrlen(pfilter));
+ _tcsncpy(pfilter, TranslateT("All Files"), _countof(filter) - (pfilter - filter));
+ mir_tstrncat(pfilter, _T(" (*)"), _countof(filter) - (pfilter - filter) - mir_tstrlen(pfilter));
pfilter = pfilter + mir_tstrlen(pfilter) + 1;
- if (pfilter >= filter + SIZEOF(filter))
+ if (pfilter >= filter + _countof(filter))
return 0;
- _tcsncpy(pfilter, _T("*"), SIZEOF(filter) - (pfilter - filter));
+ _tcsncpy(pfilter, _T("*"), _countof(filter) - (pfilter - filter));
pfilter = pfilter + mir_tstrlen(pfilter) + 1;
- if (pfilter >= filter + SIZEOF(filter))
+ if (pfilter >= filter + _countof(filter))
return 0;
*pfilter = '\0';
@@ -364,7 +364,7 @@ INT_PTR GGPROTO::import_text(WPARAM wParam, LPARAM lParam)
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("txt");
@@ -405,33 +405,33 @@ INT_PTR GGPROTO::export_text(WPARAM wParam, LPARAM lParam)
OPENFILENAME ofn = {0};
TCHAR filter[512], *pfilter;
- _tcsncpy(str, TranslateT("contacts"), SIZEOF(str));
- mir_tstrncat(str, _T(".txt"), SIZEOF(str) - mir_tstrlen(str));
+ _tcsncpy(str, TranslateT("contacts"), _countof(str));
+ mir_tstrncat(str, _T(".txt"), _countof(str) - mir_tstrlen(str));
ofn.lStructSize = OPENFILENAME_SIZE_VERSION_400;
- _tcsncpy(filter, TranslateT("Text files"), SIZEOF(filter));
- mir_tstrncat(filter, _T(" (*.txt)"), SIZEOF(filter) - mir_tstrlen(filter));
+ _tcsncpy(filter, TranslateT("Text files"), _countof(filter));
+ mir_tstrncat(filter, _T(" (*.txt)"), _countof(filter) - mir_tstrlen(filter));
pfilter = filter + mir_tstrlen(filter) + 1;
- if (pfilter >= filter + SIZEOF(filter))
+ if (pfilter >= filter + _countof(filter))
return 0;
- _tcsncpy(pfilter, _T("*.TXT"), SIZEOF(filter) - (pfilter - filter));
+ _tcsncpy(pfilter, _T("*.TXT"), _countof(filter) - (pfilter - filter));
pfilter = pfilter + mir_tstrlen(pfilter) + 1;
- if (pfilter >= filter + SIZEOF(filter))
+ if (pfilter >= filter + _countof(filter))
return 0;
- _tcsncpy(pfilter, TranslateT("All Files"), SIZEOF(filter) - (pfilter - filter));
- mir_tstrncat(pfilter, _T(" (*)"), SIZEOF(filter) - (pfilter - filter) - mir_tstrlen(pfilter));
+ _tcsncpy(pfilter, TranslateT("All Files"), _countof(filter) - (pfilter - filter));
+ mir_tstrncat(pfilter, _T(" (*)"), _countof(filter) - (pfilter - filter) - mir_tstrlen(pfilter));
pfilter = pfilter + mir_tstrlen(pfilter) + 1;
- if (pfilter >= filter + SIZEOF(filter))
+ if (pfilter >= filter + _countof(filter))
return 0;
- _tcsncpy(pfilter, _T("*"), SIZEOF(filter) - (pfilter - filter));
+ _tcsncpy(pfilter, _T("*"), _countof(filter) - (pfilter - filter));
pfilter = pfilter + mir_tstrlen(pfilter) + 1;
- if (pfilter >= filter + SIZEOF(filter))
+ if (pfilter >= filter + _countof(filter))
return 0;
*pfilter = '\0';
ofn.lpstrFilter = filter;
ofn.lpstrFile = str;
ofn.Flags = OFN_PATHMUSTEXIST | OFN_OVERWRITEPROMPT | OFN_HIDEREADONLY;
- ofn.nMaxFile = SIZEOF(str);
+ ofn.nMaxFile = _countof(str);
ofn.nMaxFileTitle = MAX_PATH;
ofn.lpstrDefExt = _T("txt");
@@ -516,7 +516,7 @@ void GGPROTO::import_init(HGENMENU hRoot)
{
// Import from server item
char service[64];
- mir_snprintf(service, SIZEOF(service), "%s%s", m_szModuleName, GGS_IMPORT_SERVER);
+ mir_snprintf(service, _countof(service), "%s%s", m_szModuleName, GGS_IMPORT_SERVER);
CreateProtoService(GGS_IMPORT_SERVER, &GGPROTO::import_server);
CLISTMENUITEM mi = { sizeof(mi) };
@@ -529,7 +529,7 @@ void GGPROTO::import_init(HGENMENU hRoot)
hMainMenu[2] = Menu_AddProtoMenuItem(&mi);
// Import from textfile
- mir_snprintf(service, SIZEOF(service), "%s%s", m_szModuleName, GGS_IMPORT_TEXT);
+ mir_snprintf(service, _countof(service), "%s%s", m_szModuleName, GGS_IMPORT_TEXT);
CreateProtoService(GGS_IMPORT_TEXT, &GGPROTO::import_text);
mi.position = 2000500002;
@@ -539,7 +539,7 @@ void GGPROTO::import_init(HGENMENU hRoot)
hMainMenu[3] = Menu_AddProtoMenuItem(&mi);
// Remove from server
- mir_snprintf(service, SIZEOF(service), "%s%s", m_szModuleName, GGS_REMOVE_SERVER);
+ mir_snprintf(service, _countof(service), "%s%s", m_szModuleName, GGS_REMOVE_SERVER);
CreateProtoService(GGS_REMOVE_SERVER, &GGPROTO::remove_server);
mi.position = 2000500003;
@@ -549,7 +549,7 @@ void GGPROTO::import_init(HGENMENU hRoot)
hMainMenu[4] = Menu_AddProtoMenuItem(&mi);
// Export to server
- mir_snprintf(service, SIZEOF(service), "%s%s", m_szModuleName, GGS_EXPORT_SERVER);
+ mir_snprintf(service, _countof(service), "%s%s", m_szModuleName, GGS_EXPORT_SERVER);
CreateProtoService(GGS_EXPORT_SERVER, &GGPROTO::export_server);
mi.position = 2005000001;
@@ -559,7 +559,7 @@ void GGPROTO::import_init(HGENMENU hRoot)
hMainMenu[5] = Menu_AddProtoMenuItem(&mi);
// Export to textfile
- mir_snprintf(service, SIZEOF(service), "%s%s", m_szModuleName, GGS_EXPORT_TEXT);
+ mir_snprintf(service, _countof(service), "%s%s", m_szModuleName, GGS_EXPORT_TEXT);
CreateProtoService(GGS_EXPORT_TEXT, &GGPROTO::export_text);
mi.position = 2005000002;
diff --git a/protocols/Gadu-Gadu/src/oauth.cpp b/protocols/Gadu-Gadu/src/oauth.cpp
index 8534d0e5cb..773b3ade25 100644
--- a/protocols/Gadu-Gadu/src/oauth.cpp
+++ b/protocols/Gadu-Gadu/src/oauth.cpp
@@ -248,7 +248,7 @@ char *oauth_auth_header(const char *httpmethod, const char *url, OAUTHSIGNMETHOD
case RSASHA1: oauth_setparam(oauth_parameters, "oauth_signature_method", "RSA-SHA1"); break;
default: oauth_setparam(oauth_parameters, "oauth_signature_method", "PLAINTEXT"); break;
};
- mir_snprintf(timestamp, SIZEOF(timestamp), "%ld", time(NULL));
+ mir_snprintf(timestamp, _countof(timestamp), "%ld", time(NULL));
oauth_setparam(oauth_parameters, "oauth_timestamp", timestamp);
oauth_setparam(oauth_parameters, "oauth_nonce", ptrA(oauth_generate_nonce()));
if (token != NULL && *token)
diff --git a/protocols/Gadu-Gadu/src/popups.cpp b/protocols/Gadu-Gadu/src/popups.cpp
index 9343f75bb5..ea440fb6b0 100644
--- a/protocols/Gadu-Gadu/src/popups.cpp
+++ b/protocols/Gadu-Gadu/src/popups.cpp
@@ -87,16 +87,16 @@ void GGPROTO::initpopups()
puc.hIcon = CopyIcon(LoadIconEx("main", FALSE));
ReleaseIconEx("main", FALSE);
puc.iSeconds = 4;
- mir_sntprintf(szDescr, SIZEOF(szDescr), _T("%s/%s"), m_tszUserName, TranslateT("Notify"));
- mir_snprintf(szName, SIZEOF(szName), "%s_%s", m_szModuleName, "Notify");
+ mir_sntprintf(szDescr, _countof(szDescr), _T("%s/%s"), m_tszUserName, TranslateT("Notify"));
+ mir_snprintf(szName, _countof(szName), "%s_%s", m_szModuleName, "Notify");
hPopupNotify = Popup_RegisterClass(&puc);
puc.colorBack = RGB(191, 0, 0); // Red
puc.colorText = RGB(255, 245, 225); // Yellow
puc.iSeconds = 60;
puc.hIcon = (HICON)LoadImage(NULL, IDI_WARNING, IMAGE_ICON, 0, 0, LR_SHARED);
- mir_sntprintf(szDescr, SIZEOF(szDescr), _T("%s/%s"), m_tszUserName, TranslateT("Error"));
- mir_snprintf(szName, SIZEOF(szName), "%s_%s", m_szModuleName, "Error");
+ mir_sntprintf(szDescr, _countof(szDescr), _T("%s/%s"), m_tszUserName, TranslateT("Error"));
+ mir_snprintf(szName, _countof(szName), "%s_%s", m_szModuleName, "Error");
hPopupError = Popup_RegisterClass(&puc);
}
@@ -117,9 +117,9 @@ void CALLBACK sttMainThreadCallback(PVOID dwParam)
ppd.pszClassName = szName;
if (puData->flags & GG_POPUP_ERROR || puData->flags & GG_POPUP_WARNING)
- mir_snprintf(szName, SIZEOF(szName), "%s_%s", gg->m_szModuleName, "Error");
+ mir_snprintf(szName, _countof(szName), "%s_%s", gg->m_szModuleName, "Error");
else
- mir_snprintf(szName, SIZEOF(szName), "%s_%s", gg->m_szModuleName, "Notify");
+ mir_snprintf(szName, _countof(szName), "%s_%s", gg->m_szModuleName, "Notify");
CallService(MS_POPUP_ADDPOPUPCLASS, 0, (LPARAM)&ppd);
return;
diff --git a/protocols/Gadu-Gadu/src/services.cpp b/protocols/Gadu-Gadu/src/services.cpp
index 220d71a884..077e9ab556 100644
--- a/protocols/Gadu-Gadu/src/services.cpp
+++ b/protocols/Gadu-Gadu/src/services.cpp
@@ -191,7 +191,7 @@ INT_PTR GGPROTO::getavatarinfo(WPARAM wParam, LPARAM lParam)
if (!db_get_ts(pai->hContact, "ContactPhoto", "Backup", &dbv)) {
if ((mir_tstrlen(dbv.ptszVal)>0) && db_get_b(pai->hContact, "ContactPhoto", "Locked", 0)){
debugLogA("getavatarinfo(): Incoming request for avatar information. Contact has assigned Locked ContactPhoto. return GAIR_SUCCESS");
- _tcscpy_s(pai->filename, SIZEOF(pai->filename) ,dbv.ptszVal);
+ _tcscpy_s(pai->filename, _countof(pai->filename) ,dbv.ptszVal);
pai->format = ProtoGetAvatarFormat(pai->filename);
db_free(&dbv);
return GAIR_SUCCESS;
@@ -219,13 +219,13 @@ INT_PTR GGPROTO::getavatarinfo(WPARAM wParam, LPARAM lParam)
char *AvatarName = strrchr(AvatarURL, '/');
AvatarName++;
char AvatarNameWithTS[128];
- mir_snprintf(AvatarNameWithTS, SIZEOF(AvatarNameWithTS), "%s%s", AvatarName, AvatarTs);
+ mir_snprintf(AvatarNameWithTS, _countof(AvatarNameWithTS), "%s%s", AvatarName, AvatarTs);
AvatarHash = gg_avatarhash(AvatarNameWithTS);
}
ptrA AvatarSavedHash( getStringA(pai->hContact, GG_KEY_AVATARHASH));
if (AvatarHash != NULL && AvatarSavedHash != NULL) {
- getAvatarFilename(pai->hContact, pai->filename, SIZEOF(pai->filename));
+ getAvatarFilename(pai->hContact, pai->filename, _countof(pai->filename));
if (!mir_strcmp(AvatarHash, AvatarSavedHash)) {
if (_taccess(pai->filename, 0) == 0){
debugLogA("getavatarinfo(): Incoming request for avatar information. uin=%d. Avatar hash unchanged. return GAIR_SUCCESS", uin);
@@ -251,7 +251,7 @@ INT_PTR GGPROTO::getavatarinfo(WPARAM wParam, LPARAM lParam)
}
else if ((wParam & GAIF_FORCE) != 0) {
if (AvatarHash == NULL && AvatarSavedHash != NULL) {
- getAvatarFilename(pai->hContact, pai->filename, SIZEOF(pai->filename));
+ getAvatarFilename(pai->hContact, pai->filename, _countof(pai->filename));
if (_tremove(pai->filename) != 0){
debugLog(_T("getavatarinfo(): delete. _tremove file %s error. errno=%d: %s"), pai->filename, errno, strerror(errno));
TCHAR error[512];
@@ -334,7 +334,7 @@ INT_PTR GGPROTO::setmyavatar(WPARAM wParam, LPARAM lParam)
setByte(GG_KEY_AVATARTYPE, (BYTE)iAvType);
TCHAR szMyFilename[MAX_PATH];
- getAvatarFilename(NULL, szMyFilename, SIZEOF(szMyFilename));
+ getAvatarFilename(NULL, szMyFilename, _countof(szMyFilename));
if ( mir_tstrcmp(szFilename, szMyFilename) && !CopyFile(szFilename, szMyFilename, FALSE)) {
debugLogA("setmyavatar(): Failed to set user avatar. File with type %d could not be created/overwritten.", iAvType);
return -1;
diff --git a/protocols/Gadu-Gadu/src/sessions.cpp b/protocols/Gadu-Gadu/src/sessions.cpp
index 07ee15a443..7b74a24c66 100644
--- a/protocols/Gadu-Gadu/src/sessions.cpp
+++ b/protocols/Gadu-Gadu/src/sessions.cpp
@@ -140,7 +140,7 @@ static BOOL IsOverAction(HWND hwndDlg)
ListView_GetSubItemRect(hList, hti.iItem, hti.iSubItem, LVIR_LABEL, &rc);
szText[0] = 0;
- ListView_GetItemText(hList, hti.iItem, hti.iSubItem, szText, SIZEOF(szText));
+ ListView_GetItemText(hList, hti.iItem, hti.iSubItem, szText, _countof(szText));
hdc = GetDC(hList);
GetTextExtentPoint32(hdc, szText, (int)mir_tstrlen(szText), &textSize);
ReleaseDC(hList, hdc);
@@ -167,8 +167,8 @@ static INT_PTR CALLBACK gg_sessions_viewdlg(HWND hwndDlg, UINT message, WPARAM w
TCHAR oldTitle[256], newTitle[256];
HANDLE hProtoAckEvent;
- GetWindowText(hwndDlg, oldTitle, SIZEOF(oldTitle));
- mir_sntprintf(newTitle, SIZEOF(newTitle), oldTitle, gg->m_tszUserName);
+ GetWindowText(hwndDlg, oldTitle, _countof(oldTitle));
+ mir_sntprintf(newTitle, _countof(newTitle), oldTitle, gg->m_tszUserName);
SetWindowText(hwndDlg, newTitle);
WindowSetIcon(hwndDlg, "sessions");
@@ -267,7 +267,7 @@ static INT_PTR CALLBACK gg_sessions_viewdlg(HWND hwndDlg, UINT message, WPARAM w
{
TCHAR szText[256];
szText[0] = 0;
- ListView_GetItemText(nm->nmcd.hdr.hwndFrom, nm->nmcd.dwItemSpec, nm->iSubItem, szText, SIZEOF(szText));
+ ListView_GetItemText(nm->nmcd.hdr.hwndFrom, nm->nmcd.dwItemSpec, nm->iSubItem, szText, _countof(szText));
FillRect(nm->nmcd.hdc, &rc, GetSysColorBrush(COLOR_WINDOW));
SetTextColor(nm->nmcd.hdc, RGB(0, 0, 255));
DrawText(nm->nmcd.hdc, szText, -1, &rc, DT_END_ELLIPSIS | DT_CENTER | DT_NOPREFIX | DT_SINGLELINE | DT_TOP);
@@ -327,9 +327,9 @@ static INT_PTR CALLBACK gg_sessions_viewdlg(HWND hwndDlg, UINT message, WPARAM w
EmptyClipboard();
szClientName[0] = szIP[0] = szLoginTime[0] = 0;
- ListView_GetItemText(hList, lvhti.iItem, 0, szClientName, SIZEOF(szClientName));
- ListView_GetItemText(hList, lvhti.iItem, 1, szIP, SIZEOF(szIP));
- ListView_GetItemText(hList, lvhti.iItem, 2, szLoginTime, SIZEOF(szLoginTime));
+ ListView_GetItemText(hList, lvhti.iItem, 0, szClientName, _countof(szClientName));
+ ListView_GetItemText(hList, lvhti.iItem, 1, szIP, _countof(szIP));
+ ListView_GetItemText(hList, lvhti.iItem, 2, szLoginTime, _countof(szLoginTime));
mir_sntprintf(szText, _T("%s\t%s\t%s"), szClientName, szIP, szLoginTime);
if ((hData = GlobalAlloc(GMEM_MOVEABLE, mir_tstrlen(szText) + 1)) != NULL)
{
@@ -345,8 +345,8 @@ static INT_PTR CALLBACK gg_sessions_viewdlg(HWND hwndDlg, UINT message, WPARAM w
{
TCHAR szUrl[256], szIP[64];
szIP[0] = 0;
- ListView_GetItemText(hList, lvhti.iItem, 1, szIP, SIZEOF(szIP));
- mir_sntprintf(szUrl, SIZEOF(szUrl), _T("http://whois.domaintools.com/%s"), szIP);
+ ListView_GetItemText(hList, lvhti.iItem, 1, szIP, _countof(szIP));
+ mir_sntprintf(szUrl, _countof(szUrl), _T("http://whois.domaintools.com/%s"), szIP);
CallService(MS_UTILS_OPENURL, OUF_TCHAR, (LPARAM)szUrl);
break;
}
@@ -425,7 +425,7 @@ BOOL GGPROTO::sessions_closedlg()
void GGPROTO::sessions_menus_init(HGENMENU hRoot)
{
char service[64];
- mir_snprintf(service, SIZEOF(service), "%s%s", m_szModuleName, GGS_CONCUR_SESS);
+ mir_snprintf(service, _countof(service), "%s%s", m_szModuleName, GGS_CONCUR_SESS);
CreateProtoService(GGS_CONCUR_SESS, &GGPROTO::sessions_view);
CLISTMENUITEM mi = { sizeof(mi) };
diff --git a/protocols/Gadu-Gadu/src/token.cpp b/protocols/Gadu-Gadu/src/token.cpp
index 14dc02b004..6404884486 100644
--- a/protocols/Gadu-Gadu/src/token.cpp
+++ b/protocols/Gadu-Gadu/src/token.cpp
@@ -57,7 +57,7 @@ INT_PTR CALLBACK gg_tokendlgproc(HWND hwndDlg, UINT msg, WPARAM wParam, LPARAM l
{
case IDOK:
{
- GetDlgItemTextA(hwndDlg, IDC_TOKEN, dat->val, SIZEOF(dat->val));
+ GetDlgItemTextA(hwndDlg, IDC_TOKEN, dat->val, _countof(dat->val));
EndDialog(hwndDlg, IDOK);
break;
}
diff --git a/protocols/Gadu-Gadu/src/userutils.cpp b/protocols/Gadu-Gadu/src/userutils.cpp
index 3f3f06d14c..61ccdd4849 100644
--- a/protocols/Gadu-Gadu/src/userutils.cpp
+++ b/protocols/Gadu-Gadu/src/userutils.cpp
@@ -224,8 +224,8 @@ INT_PTR CALLBACK gg_userutildlgproc(HWND hwndDlg, UINT msg, WPARAM wParam, LPARA
{
char pass[128], cpass[128];
BOOL enable;
- GetDlgItemTextA(hwndDlg, IDC_PASSWORD, pass, SIZEOF(pass));
- GetDlgItemTextA(hwndDlg, IDC_CPASSWORD, cpass, SIZEOF(cpass));
+ GetDlgItemTextA(hwndDlg, IDC_PASSWORD, pass, _countof(pass));
+ GetDlgItemTextA(hwndDlg, IDC_CPASSWORD, cpass, _countof(cpass));
enable = mir_strlen(pass) && mir_strlen(cpass) && !mir_strcmp(cpass, pass);
if (dat && dat->mode == GG_USERUTIL_REMOVE)
EnableWindow(GetDlgItem(hwndDlg, IDOK), IsDlgButtonChecked(hwndDlg, IDC_CONFIRM) ? enable : FALSE);
@@ -237,9 +237,9 @@ INT_PTR CALLBACK gg_userutildlgproc(HWND hwndDlg, UINT msg, WPARAM wParam, LPARA
case IDOK:
{
char pass[128], cpass[128], email[128];
- GetDlgItemTextA(hwndDlg, IDC_PASSWORD, pass, SIZEOF(pass));
- GetDlgItemTextA(hwndDlg, IDC_CPASSWORD, cpass, SIZEOF(cpass));
- GetDlgItemTextA(hwndDlg, IDC_EMAIL, email, SIZEOF(email));
+ GetDlgItemTextA(hwndDlg, IDC_PASSWORD, pass, _countof(pass));
+ GetDlgItemTextA(hwndDlg, IDC_CPASSWORD, cpass, _countof(cpass));
+ GetDlgItemTextA(hwndDlg, IDC_EMAIL, email, _countof(email));
EndDialog(hwndDlg, IDOK);
// Check dialog box mode
diff --git a/protocols/IRCG/src/clist.cpp b/protocols/IRCG/src/clist.cpp
index 8d6fac1a5c..8e403f4198 100644
--- a/protocols/IRCG/src/clist.cpp
+++ b/protocols/IRCG/src/clist.cpp
@@ -69,7 +69,7 @@ BOOL CIrcProto::CList_AddDCCChat(const CMString& name, const CMString& hostmask,
cle.hIcon = LoadIconEx(IDI_DCC);
mir_snprintf(szService, "%s/DblClickEvent", m_szModuleName);
cle.pszService = szService;
- mir_sntprintf(szNick, SIZEOF(szNick), TranslateT("CTCP chat request from %s"), name.c_str());
+ mir_sntprintf(szNick, _countof(szNick), TranslateT("CTCP chat request from %s"), name.c_str());
cle.ptszTooltip = szNick;
cle.lParam = (LPARAM)pdci;
diff --git a/protocols/IRCG/src/commandmonitor.cpp b/protocols/IRCG/src/commandmonitor.cpp
index a5b3f359be..bc4c6ae607 100644
--- a/protocols/IRCG/src/commandmonitor.cpp
+++ b/protocols/IRCG/src/commandmonitor.cpp
@@ -70,9 +70,9 @@ VOID CALLBACK KeepAliveTimerProc(HWND, UINT, UINT_PTR idEvent, DWORD)
TCHAR temp2[270];
if (!ppro->m_info.sServerName.IsEmpty())
- mir_sntprintf(temp2, SIZEOF(temp2), _T("PING %s"), ppro->m_info.sServerName.c_str());
+ mir_sntprintf(temp2, _countof(temp2), _T("PING %s"), ppro->m_info.sServerName.c_str());
else
- mir_sntprintf(temp2, SIZEOF(temp2), _T("PING %u"), time(0));
+ mir_sntprintf(temp2, _countof(temp2), _T("PING %u"), time(0));
if (ppro->IsConnected())
ppro->SendIrcMessage(temp2, false);
@@ -259,7 +259,7 @@ void __cdecl CIrcProto::ResolveIPThread(LPVOID di)
bool CIrcProto::OnIrc_PING(const CIrcMessage* pmsg)
{
TCHAR szResponse[100];
- mir_sntprintf(szResponse, SIZEOF(szResponse), _T("PONG %s"), pmsg->parameters[0].c_str());
+ mir_sntprintf(szResponse, _countof(szResponse), _T("PONG %s"), pmsg->parameters[0].c_str());
SendIrcMessage(szResponse);
return false;
}
@@ -275,7 +275,7 @@ bool CIrcProto::OnIrc_WELCOME(const CIrcMessage* pmsg)
CMString word = GetWord(pmsg->parameters[1].c_str(), i);
while (!word.IsEmpty()) {
if (_tcschr(word.c_str(), '!') && _tcschr(word.c_str(), '@')) {
- mir_tstrncpy(host, word.c_str(), SIZEOF(host));
+ mir_tstrncpy(host, word.c_str(), _countof(host));
TCHAR* p1 = _tcschr(host, '@');
if (p1)
ForkThread(&CIrcProto::ResolveIPThread, new IPRESOLVE(_T2A(p1 + 1), IP_AUTO));
@@ -670,7 +670,7 @@ bool CIrcProto::OnIrc_PINGPONG(const CIrcMessage* pmsg)
{
if (pmsg->m_bIncoming && pmsg->sCommand == _T("PING")) {
TCHAR szResponse[100];
- mir_sntprintf(szResponse, SIZEOF(szResponse), _T("PONG %s"), pmsg->parameters[0].c_str());
+ mir_sntprintf(szResponse, _countof(szResponse), _T("PONG %s"), pmsg->parameters[0].c_str());
SendIrcMessage(szResponse);
}
@@ -1194,7 +1194,7 @@ bool CIrcProto::IsCTCP(const CIrcMessage* pmsg)
// if the whois window is visible and the ctcp reply belongs to the user in it, then show the reply in the whois window
if (m_whoisDlg && IsWindowVisible(m_whoisDlg->GetHwnd())) {
- m_whoisDlg->m_InfoNick.GetText(szTemp, SIZEOF(szTemp));
+ m_whoisDlg->m_InfoNick.GetText(szTemp, _countof(szTemp));
if (mir_tstrcmpi(szTemp, pmsg->prefix.sNick.c_str()) == 0) {
if (pmsg->m_bIncoming && (command == _T("version") || command == _T("userinfo") || command == _T("time"))) {
SetActiveWindow(m_whoisDlg->GetHwnd());
@@ -1676,7 +1676,7 @@ bool CIrcProto::OnIrc_WHOIS_OTHER(const CIrcMessage* pmsg)
TCHAR temp[1024], temp2[1024];
m_whoisDlg->m_InfoOther.GetText(temp, 1000);
mir_tstrcat(temp, _T("%s\r\n"));
- mir_sntprintf(temp2, SIZEOF(temp2), temp, pmsg->parameters[2].c_str());
+ mir_sntprintf(temp2, _countof(temp2), temp, pmsg->parameters[2].c_str());
m_whoisDlg->m_InfoOther.SetText(temp2);
}
ShowMessage(pmsg);
@@ -1726,7 +1726,7 @@ bool CIrcProto::OnIrc_WHOIS_IDLE(const CIrcMessage* pmsg)
TCHAR tTimeBuf[128], *tStopStr;
time_t ttTime = _tcstol(pmsg->parameters[3].c_str(), &tStopStr, 10);
_tcsftime(tTimeBuf, 128, _T("%c"), localtime(&ttTime));
- mir_sntprintf(temp3, SIZEOF(temp3), TranslateT("online since %s, idle %s"), tTimeBuf, temp);
+ mir_sntprintf(temp3, _countof(temp3), TranslateT("online since %s, idle %s"), tTimeBuf, temp);
m_whoisDlg->m_AwayTime.SetText(temp3);
}
ShowMessage(pmsg);
@@ -1812,7 +1812,7 @@ bool CIrcProto::OnIrc_NICK_ERR(const CIrcMessage* pmsg)
if (pmsg->m_bIncoming) {
if (nickflag && ((m_alternativeNick[0] != 0)) && (pmsg->parameters.getCount() > 2 && mir_tstrcmp(pmsg->parameters[1].c_str(), m_alternativeNick))) {
TCHAR m[200];
- mir_sntprintf(m, SIZEOF(m), _T("NICK %s"), m_alternativeNick);
+ mir_sntprintf(m, _countof(m), _T("NICK %s"), m_alternativeNick);
if (IsConnected())
SendIrcMessage(m);
}
diff --git a/protocols/IRCG/src/input.cpp b/protocols/IRCG/src/input.cpp
index 098c8d1171..95e09dd869 100644
--- a/protocols/IRCG/src/input.cpp
+++ b/protocols/IRCG/src/input.cpp
@@ -121,7 +121,7 @@ CMString CIrcProto::DoAlias(const TCHAR *text, TCHAR *window)
for (int index = 1; index < 8; index++) {
TCHAR str[5];
- mir_sntprintf(str, SIZEOF(str), _T("#$%u"), index);
+ mir_sntprintf(str, _countof(str), _T("#$%u"), index);
if (!GetWord(line, index).IsEmpty() && IsChannel(GetWord(line, index)))
S.Replace(str, GetWord(line, index).c_str());
else {
@@ -132,12 +132,12 @@ CMString CIrcProto::DoAlias(const TCHAR *text, TCHAR *window)
}
for (int index2 = 1; index2 < 8; index2++) {
TCHAR str[5];
- mir_sntprintf(str, SIZEOF(str), _T("$%u-"), index2);
+ mir_sntprintf(str, _countof(str), _T("$%u-"), index2);
S.Replace(str, GetWordAddress(line, index2));
}
for (int index3 = 1; index3 < 8; index3++) {
TCHAR str[5];
- mir_sntprintf(str, SIZEOF(str), _T("$%u"), index3);
+ mir_sntprintf(str, _countof(str), _T("$%u"), index3);
S.Replace(str, GetWord(line, index3).c_str());
}
Messageout += GetWordAddress(S.c_str(), 1);
@@ -176,7 +176,7 @@ CMString CIrcProto::DoIdentifiers(CMString text, const TCHAR*)
text.Replace(_T("%me"), m_info.sNick.c_str());
char mirver[100];
- CallService(MS_SYSTEM_GETVERSIONTEXT, SIZEOF(mirver), LPARAM(mirver));
+ CallService(MS_SYSTEM_GETVERSIONTEXT, _countof(mirver), LPARAM(mirver));
text.Replace(_T("%mirver"), _A2T(mirver));
text.Replace(_T("%version"), _T(__VERSION_STRING_DOTS));
@@ -799,7 +799,7 @@ bool CIrcProto::PostIrcMessage(const TCHAR* fmt, ...)
va_list marker;
va_start(marker, fmt);
static TCHAR szBuf[4 * 1024];
- mir_vsntprintf(szBuf, SIZEOF(szBuf), fmt, marker);
+ mir_vsntprintf(szBuf, _countof(szBuf), fmt, marker);
va_end(marker);
return PostIrcMessageWnd(NULL, NULL, szBuf);
diff --git a/protocols/IRCG/src/irclib.cpp b/protocols/IRCG/src/irclib.cpp
index 4b2b74112d..e9a8340119 100644
--- a/protocols/IRCG/src/irclib.cpp
+++ b/protocols/IRCG/src/irclib.cpp
@@ -234,7 +234,7 @@ bool CIrcProto::Connect(const CIrcSessionInfo& info)
CMString m_userID = GetWord(info.sUserID.c_str(), 0);
TCHAR szHostName[MAX_PATH];
- DWORD cbHostName = SIZEOF(szHostName);
+ DWORD cbHostName = _countof(szHostName);
GetComputerName(szHostName, &cbHostName);
CMString HostName = GetWord(szHostName, 0);
if (m_userID.IsEmpty())
@@ -289,7 +289,7 @@ int CIrcProto::NLSend(const TCHAR* fmt, ...)
va_start(marker, fmt);
TCHAR szBuf[1024 * 4];
- mir_vsntprintf(szBuf, SIZEOF(szBuf), fmt, marker);
+ mir_vsntprintf(szBuf, _countof(szBuf), fmt, marker);
va_end(marker);
char* buf = mir_t2a_cp(szBuf, getCodepage());
@@ -304,7 +304,7 @@ int CIrcProto::NLSend(const char* fmt, ...)
va_start(marker, fmt);
char szBuf[1024 * 4];
- int cbLen = mir_vsnprintf(szBuf, SIZEOF(szBuf), fmt, marker);
+ int cbLen = mir_vsnprintf(szBuf, _countof(szBuf), fmt, marker);
va_end(marker);
return NLSend((unsigned char*)szBuf, cbLen);
diff --git a/protocols/IRCG/src/ircproto.cpp b/protocols/IRCG/src/ircproto.cpp
index 6df0a82319..59a7924475 100644
--- a/protocols/IRCG/src/ircproto.cpp
+++ b/protocols/IRCG/src/ircproto.cpp
@@ -184,15 +184,15 @@ int CIrcProto::OnModulesLoaded(WPARAM, LPARAM)
nlu.cbSize = sizeof(nlu);
nlu.flags = NUF_OUTGOING | NUF_INCOMING | NUF_HTTPCONNS | NUF_TCHAR;
nlu.szSettingsModule = m_szModuleName;
- mir_sntprintf(name, SIZEOF(name), TranslateT("%s server connection"), m_tszUserName);
+ mir_sntprintf(name, _countof(name), TranslateT("%s server connection"), m_tszUserName);
nlu.ptszDescriptiveName = name;
m_hNetlibUser = (HANDLE)CallService(MS_NETLIB_REGISTERUSER, 0, (LPARAM)&nlu);
nlu.flags = NUF_OUTGOING | NUF_INCOMING | NUF_HTTPCONNS | NUF_TCHAR;
char szTemp2[256];
- mir_snprintf(szTemp2, SIZEOF(szTemp2), "%s DCC", m_szModuleName);
+ mir_snprintf(szTemp2, _countof(szTemp2), "%s DCC", m_szModuleName);
nlu.szSettingsModule = szTemp2;
- mir_sntprintf(name, SIZEOF(name), TranslateT("%s client-to-client connections"), m_tszUserName);
+ mir_sntprintf(name, _countof(name), TranslateT("%s client-to-client connections"), m_tszUserName);
nlu.ptszDescriptiveName = name;
hNetlibDCC = (HANDLE)CallService(MS_NETLIB_REGISTERUSER, 0, (LPARAM)&nlu);
@@ -277,13 +277,13 @@ int CIrcProto::OnModulesLoaded(WPARAM, LPARAM)
if (m_nick[0]) {
TCHAR szBuf[40];
if (mir_tstrlen(m_alternativeNick) == 0) {
- mir_sntprintf(szBuf, SIZEOF(szBuf), _T("%s%u"), m_nick, rand() % 9999);
+ mir_sntprintf(szBuf, _countof(szBuf), _T("%s%u"), m_nick, rand() % 9999);
setTString("AlernativeNick", szBuf);
mir_tstrncpy(m_alternativeNick, szBuf, 30);
}
if (mir_tstrlen(m_name) == 0) {
- mir_sntprintf(szBuf, SIZEOF(szBuf), _T("Miranda%u"), rand() % 9999);
+ mir_sntprintf(szBuf, _countof(szBuf), _T("Miranda%u"), rand() % 9999);
setTString("Name", szBuf);
mir_tstrncpy(m_name, szBuf, 200);
}
diff --git a/protocols/IRCG/src/options.cpp b/protocols/IRCG/src/options.cpp
index 5ca6da4826..5d68c0ee30 100644
--- a/protocols/IRCG/src/options.cpp
+++ b/protocols/IRCG/src/options.cpp
@@ -207,12 +207,12 @@ static IconItem iconList[] =
void InitIcons(void)
{
- Icon_Register(hInst, "Protocols/IRC", iconList, SIZEOF(iconList), "IRC");
+ Icon_Register(hInst, "Protocols/IRC", iconList, _countof(iconList), "IRC");
}
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);
@@ -221,7 +221,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;
@@ -373,7 +373,7 @@ struct CServerDlg : public CProtoDlgBase<CIrcProto>
void OnOk(CCtrlButton*)
{
- for (int k = 0; k < SIZEOF(sttRequiredFields); k++)
+ for (int k = 0; k < _countof(sttRequiredFields); k++)
if (!GetWindowTextLength(GetDlgItem(m_hwnd, sttRequiredFields[k]))) {
MessageBox(m_hwnd, TranslateT("Please complete all fields"), TranslateT("IRC error"), MB_OK | MB_ICONERROR);
return;
@@ -398,7 +398,7 @@ struct CServerDlg : public CProtoDlgBase<CIrcProto>
pData->m_name = m_server.GetTextA();
char temp[255];
- mir_snprintf(temp, SIZEOF(temp), "%s: %s", pData->m_group, pData->m_name);
+ mir_snprintf(temp, _countof(temp), "%s: %s", pData->m_group, pData->m_name);
mir_free(pData->m_name);
pData->m_name = mir_strdup(temp);
@@ -416,24 +416,24 @@ struct CServerDlg : public CProtoDlgBase<CIrcProto>
static TDbSetting ConnectSettings[] =
{
- { FIELD_OFFSET(CIrcProto, m_userID), "UserID", DBVT_TCHAR, SIZEOF(pZero->m_userID) },
- { FIELD_OFFSET(CIrcProto, m_identSystem), "IdentSystem", DBVT_TCHAR, SIZEOF(pZero->m_identSystem) },
- { FIELD_OFFSET(CIrcProto, m_identPort), "IdentPort", DBVT_TCHAR, SIZEOF(pZero->m_identPort) },
+ { FIELD_OFFSET(CIrcProto, m_userID), "UserID", DBVT_TCHAR, _countof(pZero->m_userID) },
+ { FIELD_OFFSET(CIrcProto, m_identSystem), "IdentSystem", DBVT_TCHAR, _countof(pZero->m_identSystem) },
+ { FIELD_OFFSET(CIrcProto, m_identPort), "IdentPort", DBVT_TCHAR, _countof(pZero->m_identPort) },
- { FIELD_OFFSET(CIrcProto, m_serverName ), "ServerName", DBVT_ASCIIZ, SIZEOF(pZero->m_serverName) },
- { FIELD_OFFSET(CIrcProto, m_portStart ), "PortStart", DBVT_ASCIIZ, SIZEOF(pZero->m_portStart) },
- { FIELD_OFFSET(CIrcProto, m_portEnd ), "PortEnd", DBVT_ASCIIZ, SIZEOF(pZero->m_portEnd ) },
- { FIELD_OFFSET(CIrcProto, m_password ), "Password", DBVT_ASCIIZ, SIZEOF(pZero->m_password ) },
+ { FIELD_OFFSET(CIrcProto, m_serverName ), "ServerName", DBVT_ASCIIZ, _countof(pZero->m_serverName) },
+ { FIELD_OFFSET(CIrcProto, m_portStart ), "PortStart", DBVT_ASCIIZ, _countof(pZero->m_portStart) },
+ { FIELD_OFFSET(CIrcProto, m_portEnd ), "PortEnd", DBVT_ASCIIZ, _countof(pZero->m_portEnd ) },
+ { FIELD_OFFSET(CIrcProto, m_password ), "Password", DBVT_ASCIIZ, _countof(pZero->m_password ) },
{ FIELD_OFFSET(CIrcProto, m_joinOnInvite ), "JoinOnInvite", DBVT_BYTE },
- { FIELD_OFFSET(CIrcProto, m_network ), "Network", DBVT_ASCIIZ, SIZEOF(pZero->m_network ) },
+ { FIELD_OFFSET(CIrcProto, m_network ), "Network", DBVT_ASCIIZ, _countof(pZero->m_network ) },
{ FIELD_OFFSET(CIrcProto, m_iSSL ), "UseSSL", DBVT_BYTE },
{ FIELD_OFFSET(CIrcProto, m_onlineNotificationTime) , "OnlineNotificationTime", DBVT_WORD, 0, 30 },
{ FIELD_OFFSET(CIrcProto, m_onlineNotificationLimit) , "OnlineNotificationLimit", DBVT_WORD, 0, 50 },
{ FIELD_OFFSET(CIrcProto, m_channelAwayNotification), "ChannelAwayNotification", DBVT_BYTE, 0, 1 },
- { FIELD_OFFSET(CIrcProto, m_nick), "Nick", DBVT_TCHAR, SIZEOF(pZero->m_nick) },
- { FIELD_OFFSET(CIrcProto, m_pNick), "PNick", DBVT_TCHAR, SIZEOF(pZero->m_pNick) },
- { FIELD_OFFSET(CIrcProto, m_alternativeNick), "AlernativeNick", DBVT_TCHAR, SIZEOF(pZero->m_alternativeNick) },
- { FIELD_OFFSET(CIrcProto, m_name), "Name", DBVT_TCHAR, SIZEOF(pZero->m_name) },
+ { FIELD_OFFSET(CIrcProto, m_nick), "Nick", DBVT_TCHAR, _countof(pZero->m_nick) },
+ { FIELD_OFFSET(CIrcProto, m_pNick), "PNick", DBVT_TCHAR, _countof(pZero->m_pNick) },
+ { FIELD_OFFSET(CIrcProto, m_alternativeNick), "AlernativeNick", DBVT_TCHAR, _countof(pZero->m_alternativeNick) },
+ { FIELD_OFFSET(CIrcProto, m_name), "Name", DBVT_TCHAR, _countof(pZero->m_name) },
{ FIELD_OFFSET(CIrcProto, m_disableDefaultServer), "DisableDefaultServer", DBVT_BYTE },
{ FIELD_OFFSET(CIrcProto, m_ident), "Ident", DBVT_BYTE },
{ FIELD_OFFSET(CIrcProto, m_identTimer), "IdentTimer", DBVT_BYTE },
@@ -698,10 +698,10 @@ void CConnectPrefsDlg::OnApply()
{
//Save the setting in the CONNECT dialog
if (m_enableServer.GetState()) {
- m_server.GetTextA(m_proto->m_serverName, SIZEOF(m_proto->m_serverName));
- m_port.GetTextA(m_proto->m_portStart, SIZEOF(m_proto->m_portStart));
- m_port2.GetTextA(m_proto->m_portEnd, SIZEOF(m_proto->m_portEnd));
- m_pass.GetTextA(m_proto->m_password, SIZEOF(m_proto->m_password));
+ m_server.GetTextA(m_proto->m_serverName, _countof(m_proto->m_serverName));
+ m_port.GetTextA(m_proto->m_portStart, _countof(m_proto->m_portStart));
+ m_port2.GetTextA(m_proto->m_portEnd, _countof(m_proto->m_portEnd));
+ m_pass.GetTextA(m_proto->m_password, _countof(m_proto->m_password));
}
else m_proto->m_serverName[0] = m_proto->m_portStart[0] = m_proto->m_portEnd[0] = m_proto->m_password[0] = 0;
@@ -709,16 +709,16 @@ void CConnectPrefsDlg::OnApply()
m_proto->m_onlineNotificationLimit = SendDlgItemMessage(m_hwnd, IDC_SPIN2, UDM_GETPOS, 0, 0);
m_proto->m_channelAwayNotification = m_channelAway.GetState();
- m_nick.GetText(m_proto->m_nick, SIZEOF(m_proto->m_nick));
+ m_nick.GetText(m_proto->m_nick, _countof(m_proto->m_nick));
removeSpaces(m_proto->m_nick);
_tcsncpy_s(m_proto->m_pNick, m_proto->m_nick, _TRUNCATE);
- m_nick2.GetText(m_proto->m_alternativeNick, SIZEOF(m_proto->m_alternativeNick));
+ m_nick2.GetText(m_proto->m_alternativeNick, _countof(m_proto->m_alternativeNick));
removeSpaces(m_proto->m_alternativeNick);
- m_userID.GetText(m_proto->m_userID, SIZEOF(m_proto->m_userID));
+ m_userID.GetText(m_proto->m_userID, _countof(m_proto->m_userID));
removeSpaces(m_proto->m_userID);
- m_name.GetText(m_proto->m_name, SIZEOF(m_proto->m_name));
- m_identSystem.GetText(m_proto->m_identSystem, SIZEOF(m_proto->m_identSystem));
- m_identPort.GetText(m_proto->m_identPort, SIZEOF(m_proto->m_identPort));
+ m_name.GetText(m_proto->m_name, _countof(m_proto->m_name));
+ m_identSystem.GetText(m_proto->m_identSystem, _countof(m_proto->m_identSystem));
+ m_identPort.GetText(m_proto->m_identPort, _countof(m_proto->m_identPort));
m_proto->m_disableDefaultServer = !m_enableServer.GetState();
m_proto->m_ident = m_ident.GetState();
m_proto->m_identTimer = m_identTimer.GetState();
@@ -780,9 +780,9 @@ void CConnectPrefsDlg::OnApply()
char TextLine[512];
if (pData->m_iSSL > 0)
- mir_snprintf(TextLine, SIZEOF(TextLine), "SERVER:SSL%u%s:%d-%dGROUP:%s", pData->m_iSSL, pData->m_address, pData->m_portStart, pData->m_portEnd, pData->m_group);
+ mir_snprintf(TextLine, _countof(TextLine), "SERVER:SSL%u%s:%d-%dGROUP:%s", pData->m_iSSL, pData->m_address, pData->m_portStart, pData->m_portEnd, pData->m_group);
else
- mir_snprintf(TextLine, SIZEOF(TextLine), "SERVER:%s:%d-%dGROUP:%s", pData->m_address, pData->m_portStart, pData->m_portEnd, pData->m_group);
+ mir_snprintf(TextLine, _countof(TextLine), "SERVER:%s:%d-%dGROUP:%s", pData->m_address, pData->m_portStart, pData->m_portEnd, pData->m_group);
db_set_s(NULL, SERVERSMODULE, pData->m_name, TextLine);
// combobox might contain new items
@@ -792,7 +792,7 @@ void CConnectPrefsDlg::OnApply()
}
}
- m_proto->WriteSettings(ConnectSettings, SIZEOF(ConnectSettings));
+ m_proto->WriteSettings(ConnectSettings, _countof(ConnectSettings));
}
/////////////////////////////////////////////////////////////////////////////////////////
@@ -800,14 +800,14 @@ void CConnectPrefsDlg::OnApply()
static TDbSetting CtcpSettings[] =
{
- { FIELD_OFFSET(CIrcProto, m_userInfo), "UserInfo", DBVT_TCHAR, SIZEOF(pZero->m_userInfo) },
+ { FIELD_OFFSET(CIrcProto, m_userInfo), "UserInfo", DBVT_TCHAR, _countof(pZero->m_userInfo) },
{ FIELD_OFFSET(CIrcProto, m_DCCPacketSize), "DccPacketSize", DBVT_WORD, 0, 4096 },
{ FIELD_OFFSET(CIrcProto, m_DCCPassive), "DccPassive", DBVT_BYTE },
{ FIELD_OFFSET(CIrcProto, m_DCCMode), "DCCMode", DBVT_BYTE },
{ FIELD_OFFSET(CIrcProto, m_manualHost), "ManualHost", DBVT_BYTE },
{ FIELD_OFFSET(CIrcProto, m_IPFromServer), "IPFromServer", DBVT_BYTE, 0, 1 },
{ FIELD_OFFSET(CIrcProto, m_disconnectDCCChats), "DisconnectDCCChats", DBVT_BYTE },
- { FIELD_OFFSET(CIrcProto, m_mySpecifiedHost), "SpecHost", DBVT_ASCIIZ, SIZEOF(pZero->m_mySpecifiedHost) },
+ { FIELD_OFFSET(CIrcProto, m_mySpecifiedHost), "SpecHost", DBVT_ASCIIZ, _countof(pZero->m_mySpecifiedHost) },
{ FIELD_OFFSET(CIrcProto, m_DCCChatAccept), "CtcpChatAccept", DBVT_BYTE, 0, 1 },
{ FIELD_OFFSET(CIrcProto, m_sendNotice), "SendNotice", DBVT_BYTE, 0, 1 }
};
@@ -913,7 +913,7 @@ void CCtcpPrefsDlg::OnClicked(CCtrlData*)
void CCtcpPrefsDlg::OnApply()
{
- m_userInfo.GetText(m_proto->m_userInfo, SIZEOF(m_proto->m_userInfo));
+ m_userInfo.GetText(m_proto->m_userInfo, _countof(m_proto->m_userInfo));
m_proto->m_DCCPacketSize = m_combo.GetInt();
m_proto->m_DCCPassive = m_passive.GetState();
@@ -939,7 +939,7 @@ void CCtcpPrefsDlg::OnApply()
if (m_radio3.GetState())
m_proto->m_DCCChatAccept = 3;
- m_proto->WriteSettings(CtcpSettings, SIZEOF(CtcpSettings));
+ m_proto->WriteSettings(CtcpSettings, _countof(CtcpSettings));
}
/////////////////////////////////////////////////////////////////////////////////////////
@@ -947,7 +947,7 @@ void CCtcpPrefsDlg::OnApply()
static TDbSetting OtherSettings[] =
{
- { FIELD_OFFSET(CIrcProto, m_quitMessage), "QuitMessage", DBVT_TCHAR, SIZEOF(pZero->m_quitMessage) },
+ { FIELD_OFFSET(CIrcProto, m_quitMessage), "QuitMessage", DBVT_TCHAR, _countof(pZero->m_quitMessage) },
{ FIELD_OFFSET(CIrcProto, m_alias), "Alias", DBVT_TCHAR, -1 },
{ FIELD_OFFSET(CIrcProto, m_codepage), "Codepage", DBVT_DWORD, 0, CP_ACP },
{ FIELD_OFFSET(CIrcProto, m_utfAutodetect), "UtfAutodetect", DBVT_BYTE },
@@ -1055,7 +1055,7 @@ void COtherPrefsDlg::OnInitDialog()
}
}
- for (int i = 0; i < SIZEOF(sttPerformEvents); i++) {
+ for (int i = 0; i < _countof(sttPerformEvents); i++) {
int idx = m_performCombo.InsertString(_A2T(Translate(sttPerformEvents[i])), i);
addPerformComboValue(idx, sttPerformEvents[i]);
}
@@ -1161,7 +1161,7 @@ void COtherPrefsDlg::OnApply()
{
mir_free(m_proto->m_alias);
m_proto->m_alias = m_alias.GetText();
- m_quitMessage.GetText(m_proto->m_quitMessage, SIZEOF(m_proto->m_quitMessage));
+ m_quitMessage.GetText(m_proto->m_quitMessage, _countof(m_proto->m_quitMessage));
int curSel = m_codepage.GetCurSel();
m_proto->m_codepage = m_codepage.GetItemData(curSel);
@@ -1187,7 +1187,7 @@ void COtherPrefsDlg::OnApply()
db_unset(NULL, m_proto->m_szModuleName, pPerf->mSetting.c_str());
}
}
- m_proto->WriteSettings(OtherSettings, SIZEOF(OtherSettings));
+ m_proto->WriteSettings(OtherSettings, _countof(OtherSettings));
}
void COtherPrefsDlg::addPerformComboValue(int idx, const char* szValueName)
@@ -1218,7 +1218,7 @@ CAddIgnoreDlg::CAddIgnoreDlg(CIrcProto* _pro, const TCHAR* mask, CIgnorePrefsDlg
if (mask == NULL)
szOldMask[0] = 0;
else
- _tcsncpy(szOldMask, mask, SIZEOF(szOldMask));
+ _tcsncpy(szOldMask, mask, _countof(szOldMask));
m_Ok.OnClick = Callback(this, &CAddIgnoreDlg::OnOk);
}
@@ -1248,8 +1248,8 @@ void CAddIgnoreDlg::OnOk(CCtrlButton*)
if (IsDlgButtonChecked(m_hwnd, IDC_C) == BST_CHECKED) flags += 'c';
if (IsDlgButtonChecked(m_hwnd, IDC_M) == BST_CHECKED) flags += 'm';
- GetDlgItemText(m_hwnd, IDC_MASK, szMask, SIZEOF(szMask));
- GetDlgItemText(m_hwnd, IDC_NETWORK, szNetwork, SIZEOF(szNetwork));
+ GetDlgItemText(m_hwnd, IDC_MASK, szMask, _countof(szMask));
+ GetDlgItemText(m_hwnd, IDC_NETWORK, szNetwork, _countof(szNetwork));
CMString Mask = GetWord(szMask, 0);
if (Mask.GetLength() != 0) {
@@ -1293,7 +1293,7 @@ static int CALLBACK IgnoreListSort(LPARAM lParam1, LPARAM lParam2, LPARAM lParam
LVITEM lvm;
lvm.mask = LVIF_TEXT;
lvm.iSubItem = 0;
- lvm.cchTextMax = SIZEOF(temp1);
+ lvm.cchTextMax = _countof(temp1);
lvm.iItem = lParam1;
lvm.pszText = temp1;
@@ -1376,7 +1376,7 @@ void CIrcProto::InitIgnore(void)
int idx = 0;
char settingName[40];
for (;;) {
- mir_snprintf(settingName, SIZEOF(settingName), "IGNORE:%d", idx++);
+ mir_snprintf(settingName, _countof(settingName), "IGNORE:%d", idx++);
DBVARIANT dbv;
if (getTString(settingName, &dbv))
@@ -1396,13 +1396,13 @@ void CIrcProto::RewriteIgnoreSettings(void)
int i = 0;
for (;;) {
- mir_snprintf(settingName, SIZEOF(settingName), "IGNORE:%d", i++);
+ mir_snprintf(settingName, _countof(settingName), "IGNORE:%d", i++);
if (db_unset(NULL, m_szModuleName, settingName))
break;
}
for (i = 0; i < m_ignoreItems.getCount(); i++) {
- mir_snprintf(settingName, SIZEOF(settingName), "IGNORE:%d", i);
+ mir_snprintf(settingName, _countof(settingName), "IGNORE:%d", i);
CIrcIgnoreItem& C = m_ignoreItems[i];
setTString(settingName, (C.mask + _T(" ") + C.flags + _T(" ") + C.network).c_str());
@@ -1553,7 +1553,7 @@ void CIgnorePrefsDlg::OnDelete(CCtrlButton*)
TCHAR szMask[512];
int i = m_list.GetSelectionMark();
- m_list.GetItemText(i, 0, szMask, SIZEOF(szMask));
+ m_list.GetItemText(i, 0, szMask, _countof(szMask));
m_proto->RemoveIgnore(szMask);
}
@@ -1570,7 +1570,7 @@ void CIgnorePrefsDlg::OnApply()
m_proto->m_ignore = m_enable.GetState();
m_proto->m_ignoreChannelDefault = m_ignoreChannel.GetState();
m_proto->m_DCCChatIgnore = m_ignoreUnknown.GetState() ? 2 : 1;
- m_proto->WriteSettings(IgnoreSettings, SIZEOF(IgnoreSettings));
+ m_proto->WriteSettings(IgnoreSettings, _countof(IgnoreSettings));
}
void CIgnorePrefsDlg::OnDestroy()
@@ -1581,9 +1581,9 @@ void CIgnorePrefsDlg::OnDestroy()
int i = m_list.GetItemCount();
for (int j = 0; j < i; j++) {
TCHAR szMask[512], szFlags[40], szNetwork[100];
- m_list.GetItemText(j, 0, szMask, SIZEOF(szMask));
- m_list.GetItemText(j, 1, szFlags, SIZEOF(szFlags));
- m_list.GetItemText(j, 2, szNetwork, SIZEOF(szNetwork));
+ m_list.GetItemText(j, 0, szMask, _countof(szMask));
+ m_list.GetItemText(j, 1, szFlags, _countof(szFlags));
+ m_list.GetItemText(j, 2, szNetwork, _countof(szNetwork));
m_proto->m_ignoreItems.insert(new CIrcIgnoreItem(szMask, szFlags, szNetwork));
}
@@ -1694,10 +1694,10 @@ void CIrcProto::InitPrefs(void)
OtherSettings[0].defStr = STR_QUITMESSAGE;
- ReadSettings(ConnectSettings, SIZEOF(ConnectSettings));
- ReadSettings(CtcpSettings, SIZEOF(CtcpSettings));
- ReadSettings(OtherSettings, SIZEOF(OtherSettings));
- ReadSettings(IgnoreSettings, SIZEOF(IgnoreSettings));
+ ReadSettings(ConnectSettings, _countof(ConnectSettings));
+ ReadSettings(CtcpSettings, _countof(CtcpSettings));
+ ReadSettings(OtherSettings, _countof(OtherSettings));
+ ReadSettings(IgnoreSettings, _countof(IgnoreSettings));
int x = getDword("SizeOfListBottom", -1);
if (x != -1) {
@@ -1797,20 +1797,20 @@ struct CDlgAccMgrUI : public CProtoDlgBase<CIrcProto>
virtual void OnApply()
{
m_proto->m_serverComboSelection = m_serverCombo.GetCurSel();
- m_server.GetTextA(m_proto->m_serverName, SIZEOF(m_proto->m_serverName));
- m_port.GetTextA(m_proto->m_portStart, SIZEOF(m_proto->m_portStart));
- m_port2.GetTextA(m_proto->m_portEnd, SIZEOF(m_proto->m_portEnd));
- m_pass.GetTextA(m_proto->m_password, SIZEOF(m_proto->m_password));
+ m_server.GetTextA(m_proto->m_serverName, _countof(m_proto->m_serverName));
+ m_port.GetTextA(m_proto->m_portStart, _countof(m_proto->m_portStart));
+ m_port2.GetTextA(m_proto->m_portEnd, _countof(m_proto->m_portEnd));
+ m_pass.GetTextA(m_proto->m_password, _countof(m_proto->m_password));
- m_nick.GetText(m_proto->m_nick, SIZEOF(m_proto->m_nick));
+ m_nick.GetText(m_proto->m_nick, _countof(m_proto->m_nick));
removeSpaces(m_proto->m_nick);
_tcsncpy_s(m_proto->m_pNick, m_proto->m_nick, _TRUNCATE);
- m_nick2.GetText(m_proto->m_alternativeNick, SIZEOF(m_proto->m_alternativeNick));
+ m_nick2.GetText(m_proto->m_alternativeNick, _countof(m_proto->m_alternativeNick));
removeSpaces(m_proto->m_alternativeNick);
- m_userID.GetText(m_proto->m_userID, SIZEOF(m_proto->m_userID));
+ m_userID.GetText(m_proto->m_userID, _countof(m_proto->m_userID));
removeSpaces(m_proto->m_userID);
- m_name.GetText(m_proto->m_name, SIZEOF(m_proto->m_name));
- m_proto->WriteSettings(ConnectSettings, SIZEOF(ConnectSettings));
+ m_name.GetText(m_proto->m_name, _countof(m_proto->m_name));
+ m_proto->WriteSettings(ConnectSettings, _countof(ConnectSettings));
}
void OnChangeCombo(CCtrlCombo*)
diff --git a/protocols/IRCG/src/services.cpp b/protocols/IRCG/src/services.cpp
index c76371ffb6..466e4c35dc 100644
--- a/protocols/IRCG/src/services.cpp
+++ b/protocols/IRCG/src/services.cpp
@@ -24,7 +24,7 @@ Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
void CIrcProto::InitMainMenus(void)
{
char temp[MAXMODULELABELLENGTH];
- char *d = temp + mir_snprintf(temp, SIZEOF(temp), m_szModuleName);
+ char *d = temp + mir_snprintf(temp, _countof(temp), m_szModuleName);
CLISTMENUITEM mi = { sizeof(mi) };
mi.pszService = temp;
@@ -137,7 +137,7 @@ int IrcPrebuildContactMenu(WPARAM wParam, LPARAM lParam)
void InitContactMenus(void)
{
char temp[MAXMODULELABELLENGTH];
- char *d = temp + mir_snprintf(temp, SIZEOF(temp), "IRC");
+ char *d = temp + mir_snprintf(temp, _countof(temp), "IRC");
CLISTMENUITEM mi = { sizeof(mi) };
mi.pszService = temp;
@@ -459,7 +459,7 @@ static void DoChatFormatting(TCHAR* pszText)
if (p1 - 3 >= pszText && p1[-3] == '\003')
mir_tstrcpy(InsertThis, _T(","));
else if (iFG >= 0)
- mir_sntprintf(InsertThis, SIZEOF(InsertThis), _T("\x03%u,"), iFG);
+ mir_sntprintf(InsertThis, _countof(InsertThis), _T("\x03%u,"), iFG);
else
mir_tstrcpy(InsertThis, _T("\x0399,"));
@@ -468,7 +468,7 @@ static void DoChatFormatting(TCHAR* pszText)
case 'F':
if (iFG >= 0)
- mir_sntprintf(InsertThis, SIZEOF(InsertThis), _T("\x03%u,99"), iFG);
+ mir_sntprintf(InsertThis, _countof(InsertThis), _T("\x03%u,99"), iFG);
else
mir_tstrcpy(InsertThis, _T("\x0399,99"));
iRemoveChars = 2;
@@ -853,7 +853,7 @@ int __cdecl CIrcProto::GCMenuHook(WPARAM, LPARAM lParam)
if (!mir_strcmpi(gcmi->pszModule, m_szModuleName)) {
if (gcmi->Type == MENU_ON_LOG) {
if (mir_tstrcmpi(gcmi->pszID, SERVERWINDOW)) {
- gcmi->nItems = SIZEOF(logItems);
+ gcmi->nItems = _countof(logItems);
gcmi->Item = logItems;
}
else gcmi->nItems = 0;
@@ -863,7 +863,7 @@ int __cdecl CIrcProto::GCMenuHook(WPARAM, LPARAM lParam)
CONTACT user = { (TCHAR*)gcmi->pszUID, NULL, NULL, false, false, false };
MCONTACT hContact = CList_FindContact(&user);
- gcmi->nItems = SIZEOF(nickItems);
+ gcmi->nItems = _countof(nickItems);
gcmi->Item = nickItems;
BOOL bIsInList = (hContact && db_get_b(hContact, "CList", "NotOnList", 0) == 0);
gcmi->Item[gcmi->nItems - 1].bDisabled = bIsInList;
@@ -877,7 +877,7 @@ int __cdecl CIrcProto::GCMenuHook(WPARAM, LPARAM lParam)
TCHAR stzChanName[100];
const TCHAR* temp = _tcschr(gcmi->pszID, ' ');
- size_t len = min(((temp == NULL) ? mir_tstrlen(gcmi->pszID) : (int)(temp - gcmi->pszID + 1)), SIZEOF(stzChanName) - 1);
+ size_t len = min(((temp == NULL) ? mir_tstrlen(gcmi->pszID) : (int)(temp - gcmi->pszID + 1)), _countof(stzChanName) - 1);
mir_tstrncpy(stzChanName, gcmi->pszID, len);
stzChanName[len] = 0;
CHANNELINFO *wi = (CHANNELINFO *)DoEvent(GC_EVENT_GETITEMDATA, stzChanName, NULL, NULL, NULL, NULL, NULL, false, false, 0);
diff --git a/protocols/IRCG/src/tools.cpp b/protocols/IRCG/src/tools.cpp
index 55dfc734f5..97b5bcf6d9 100644
--- a/protocols/IRCG/src/tools.cpp
+++ b/protocols/IRCG/src/tools.cpp
@@ -628,7 +628,7 @@ void CIrcProto::DoUserhostWithReason(int type, CMString reason, bool bSendComman
va_list ap;
va_start(ap, userhostparams);
- mir_vsntprintf(temp, SIZEOF(temp), (S + _T(" ") + userhostparams).c_str(), ap);
+ mir_vsntprintf(temp, _countof(temp), (S + _T(" ") + userhostparams).c_str(), ap);
va_end(ap);
// Add reason
diff --git a/protocols/IRCG/src/userinfo.cpp b/protocols/IRCG/src/userinfo.cpp
index cbc85fe2c9..c3ed0b36bf 100644
--- a/protocols/IRCG/src/userinfo.cpp
+++ b/protocols/IRCG/src/userinfo.cpp
@@ -100,7 +100,7 @@ INT_PTR CALLBACK UserDetailsDlgProc(HWND m_hwnd, UINT msg, WPARAM wParam, LPARAM
if (HIWORD(wParam) == BN_CLICKED && LOWORD(wParam) == IDC_BUTTON) {
TCHAR temp[500];
- GetDlgItemText(m_hwnd, IDC_WILDCARD, temp, SIZEOF(temp));
+ GetDlgItemText(m_hwnd, IDC_WILDCARD, temp, _countof(temp));
BYTE bAdvanced = IsDlgButtonChecked(m_hwnd, IDC_RADIO1) ? 0 : 1;
if (bAdvanced) {
@@ -125,7 +125,7 @@ INT_PTR CALLBACK UserDetailsDlgProc(HWND m_hwnd, UINT msg, WPARAM wParam, LPARAM
db_free(&dbv);
}
- GetDlgItemText(m_hwnd, IDC_WILDCARD, temp, SIZEOF(temp));
+ GetDlgItemText(m_hwnd, IDC_WILDCARD, temp, _countof(temp));
if (mir_tstrlen(GetWord(temp, 0).c_str()))
p->ppro->setTString(p->hContact, "UWildcard", GetWord(temp, 0).c_str());
else
@@ -134,13 +134,13 @@ INT_PTR CALLBACK UserDetailsDlgProc(HWND m_hwnd, UINT msg, WPARAM wParam, LPARAM
p->ppro->setByte(p->hContact, "AdvancedMode", bAdvanced);
- GetDlgItemText(m_hwnd, IDC_USER, temp, SIZEOF(temp));
+ GetDlgItemText(m_hwnd, IDC_USER, temp, _countof(temp));
if (mir_tstrlen(GetWord(temp, 0).c_str()))
p->ppro->setTString(p->hContact, "UUser", GetWord(temp, 0).c_str());
else
db_unset(p->hContact, p->ppro->m_szModuleName, "UUser");
- GetDlgItemText(m_hwnd, IDC_HOST, temp, SIZEOF(temp));
+ GetDlgItemText(m_hwnd, IDC_HOST, temp, _countof(temp));
if (mir_tstrlen(GetWord(temp, 0).c_str()))
p->ppro->setTString(p->hContact, "UHost", GetWord(temp, 0).c_str());
else
diff --git a/protocols/IRCG/src/windows.cpp b/protocols/IRCG/src/windows.cpp
index 0de5d3b1b7..2b40c291fe 100644
--- a/protocols/IRCG/src/windows.cpp
+++ b/protocols/IRCG/src/windows.cpp
@@ -110,21 +110,21 @@ void CWhoisDlg::OnDestroy()
void CWhoisDlg::OnGo(CCtrlButton*)
{
TCHAR szTemp[255];
- m_InfoNick.GetText(szTemp, SIZEOF(szTemp));
+ m_InfoNick.GetText(szTemp, _countof(szTemp));
m_proto->PostIrcMessage(_T("/WHOIS %s %s"), szTemp, szTemp);
}
void CWhoisDlg::OnQuery(CCtrlButton*)
{
TCHAR szTemp[255];
- m_InfoNick.GetText(szTemp, SIZEOF(szTemp));
+ m_InfoNick.GetText(szTemp, _countof(szTemp));
m_proto->PostIrcMessage(_T("/QUERY %s"), szTemp);
}
void CWhoisDlg::OnPing(CCtrlButton*)
{
TCHAR szTemp[255];
- m_InfoNick.GetText(szTemp, SIZEOF(szTemp));
+ m_InfoNick.GetText(szTemp, _countof(szTemp));
m_Reply.SetText(TranslateT("Please wait..."));
m_proto->PostIrcMessage(_T("/PRIVMSG %s \001PING %u\001"), szTemp, time(0));
}
@@ -132,7 +132,7 @@ void CWhoisDlg::OnPing(CCtrlButton*)
void CWhoisDlg::OnUserInfo(CCtrlButton*)
{
TCHAR szTemp[255];
- m_InfoNick.GetText(szTemp, SIZEOF(szTemp));
+ m_InfoNick.GetText(szTemp, _countof(szTemp));
m_Reply.SetText(TranslateT("Please wait..."));
m_proto->PostIrcMessage(_T("/PRIVMSG %s \001USERINFO\001"), szTemp);
}
@@ -140,7 +140,7 @@ void CWhoisDlg::OnUserInfo(CCtrlButton*)
void CWhoisDlg::OnTime(CCtrlButton*)
{
TCHAR szTemp[255];
- m_InfoNick.GetText(szTemp, SIZEOF(szTemp));
+ m_InfoNick.GetText(szTemp, _countof(szTemp));
m_Reply.SetText(TranslateT("Please wait..."));
m_proto->PostIrcMessage(_T("/PRIVMSG %s \001TIME\001"), szTemp);
}
@@ -148,7 +148,7 @@ void CWhoisDlg::OnTime(CCtrlButton*)
void CWhoisDlg::OnVersion(CCtrlButton*)
{
TCHAR szTemp[255];
- m_InfoNick.GetText(szTemp, SIZEOF(szTemp));
+ m_InfoNick.GetText(szTemp, _countof(szTemp));
m_Reply.SetText(TranslateT("Please wait..."));
m_proto->PostIrcMessage(_T("/PRIVMSG %s \001VERSION\001"), szTemp);
}
@@ -229,7 +229,7 @@ void CNickDlg::OnDestroy()
void CNickDlg::OnOk(CCtrlButton*)
{
TCHAR szTemp[255];
- m_Enick.GetText(szTemp, SIZEOF(szTemp));
+ m_Enick.GetText(szTemp, _countof(szTemp));
m_proto->PostIrcMessage(_T("/NICK %s"), szTemp);
CMString S = szTemp;
@@ -304,7 +304,7 @@ INT_PTR CListDlg::DlgProc(UINT msg, WPARAM wParam, LPARAM lParam)
// Retrieve the input text
TCHAR strFilterText[255];
TCHAR newTitle[255];
- m_filter.GetText(strFilterText, SIZEOF(strFilterText));
+ m_filter.GetText(strFilterText, _countof(strFilterText));
if (strFilterText[0]) {
int itemCount = 0;
@@ -318,7 +318,7 @@ INT_PTR CListDlg::DlgProc(UINT msg, WPARAM wParam, LPARAM lParam)
LVITEM lvm;
TCHAR text[255];
lvm.pszText = text; // Set buffer for texts
- lvm.cchTextMax = SIZEOF(text);
+ lvm.cchTextMax = _countof(text);
lvm.mask = LVIF_TEXT;
for (int i = 0; i < j; i++) {
lvm.iSubItem = 0; // First column
@@ -376,13 +376,13 @@ INT_PTR CListDlg::DlgProc(UINT msg, WPARAM wParam, LPARAM lParam)
ShowWindow(m_list.GetHwnd(), SW_HIDE);
// New dialog title
- mir_sntprintf(newTitle, SIZEOF(newTitle), TranslateT("%s - Filtered - %d items"), strFilterText, itemCount);
+ mir_sntprintf(newTitle, _countof(newTitle), TranslateT("%s - Filtered - %d items"), strFilterText, itemCount);
SetWindowText(m_hwnd, newTitle);
}
else {
ShowWindow(m_list.GetHwnd(), SW_SHOW);
ShowWindow(m_list2.GetHwnd(), SW_HIDE);
- mir_sntprintf(newTitle, SIZEOF(newTitle), TranslateT("Channels on server"));
+ mir_sntprintf(newTitle, _countof(newTitle), TranslateT("Channels on server"));
SetWindowText(m_hwnd, newTitle);
}
}
@@ -423,7 +423,7 @@ static int CALLBACK ListViewSort(LPARAM lParam1, LPARAM lParam2, LPARAM lParamSo
lvm.iItem = lParam1;
lvm.iSubItem = param->iSubItem;
lvm.pszText = temp1;
- lvm.cchTextMax = SIZEOF(temp1);
+ lvm.cchTextMax = _countof(temp1);
param->pList->GetItem(&lvm);
lvm.iItem = lParam2;
lvm.pszText = temp2;
@@ -464,7 +464,7 @@ void CListDlg::List_OnColumnClick(CCtrlListView::TEventInfo *ev)
void CListDlg::OnJoin(CCtrlButton*)
{
TCHAR szTemp[255];
- m_filter.GetText(szTemp, SIZEOF(szTemp));
+ m_filter.GetText(szTemp, _countof(szTemp));
if (szTemp[0])
m_list2.GetItemText(m_list2.GetSelectionMark(), 0, szTemp, 255);
@@ -524,7 +524,7 @@ void CJoinDlg::OnDestroy()
void CJoinDlg::OnOk(CCtrlButton*)
{
TCHAR szTemp[255];
- GetDlgItemText(m_hwnd, IDC_ENICK, szTemp, SIZEOF(szTemp));
+ GetDlgItemText(m_hwnd, IDC_ENICK, szTemp, _countof(szTemp));
if (m_proto->IsChannel(szTemp))
m_proto->PostIrcMessage(_T("/JOIN %s"), szTemp);
else
@@ -614,10 +614,10 @@ void CQuickDlg::OnDestroy()
void CQuickDlg::OnOk(CCtrlButton*)
{
- GetDlgItemTextA(m_hwnd, IDC_SERVER, m_proto->m_serverName, SIZEOF(m_proto->m_serverName));
- GetDlgItemTextA(m_hwnd, IDC_PORT, m_proto->m_portStart, SIZEOF(m_proto->m_portStart));
- GetDlgItemTextA(m_hwnd, IDC_PORT2, m_proto->m_portEnd, SIZEOF(m_proto->m_portEnd));
- GetDlgItemTextA(m_hwnd, IDC_PASS, m_proto->m_password, SIZEOF(m_proto->m_password));
+ GetDlgItemTextA(m_hwnd, IDC_SERVER, m_proto->m_serverName, _countof(m_proto->m_serverName));
+ GetDlgItemTextA(m_hwnd, IDC_PORT, m_proto->m_portStart, _countof(m_proto->m_portStart));
+ GetDlgItemTextA(m_hwnd, IDC_PORT2, m_proto->m_portEnd, _countof(m_proto->m_portEnd));
+ GetDlgItemTextA(m_hwnd, IDC_PASS, m_proto->m_password, _countof(m_proto->m_password));
int i = m_serverCombo.GetCurSel();
SERVER_INFO* pData = (SERVER_INFO*)m_serverCombo.GetItemData(i);
@@ -632,7 +632,7 @@ void CQuickDlg::OnOk(CCtrlButton*)
}
TCHAR windowname[20];
- GetWindowText(m_hwnd, windowname, SIZEOF(windowname));
+ GetWindowText(m_hwnd, windowname, _countof(windowname));
if (mir_tstrcmpi(windowname, _T("Miranda IRC")) == 0) {
m_proto->m_serverComboSelection = m_serverCombo.GetCurSel() - 1;
m_proto->setDword("ServerComboSelection", m_proto->m_serverComboSelection);
@@ -908,7 +908,7 @@ void CManagerDlg::OnClose()
}
TCHAR window[256];
- GetDlgItemText(m_hwnd, IDC_CAPTION, window, SIZEOF(window));
+ GetDlgItemText(m_hwnd, IDC_CAPTION, window, _countof(window));
CMString S = _T("");
TCHAR temp[1000];
for (int i = 0; i < 5; i++) {
@@ -966,8 +966,8 @@ void CManagerDlg::OnAdd(CCtrlButton*)
TCHAR temp2[450];
TCHAR window[256];
- GetDlgItemText(m_hwnd, IDC_CAPTION, window, SIZEOF(window));
- mir_sntprintf(temp2, SIZEOF(temp2), _T("/MODE %s %s %s"), window, mode, _T("%question"));
+ GetDlgItemText(m_hwnd, IDC_CAPTION, window, _countof(window));
+ mir_sntprintf(temp2, _countof(temp2), _T("/MODE %s %s %s"), window, mode, _T("%question"));
SetDlgItemText(addban_hWnd, IDC_HIDDENEDIT, temp2);
dlg->Activate();
}
@@ -1009,8 +1009,8 @@ void CManagerDlg::OnEdit(CCtrlButton*)
TCHAR temp2[450];
TCHAR window[256];
- GetDlgItemText(m_hwnd, IDC_CAPTION, window, SIZEOF(window));
- mir_sntprintf(temp2, SIZEOF(temp2), _T("/MODE %s -%s %s%s/MODE %s +%s %s"), window, mode, user.c_str(), _T("%newl"), window, mode, _T("%question"));
+ GetDlgItemText(m_hwnd, IDC_CAPTION, window, _countof(window));
+ mir_sntprintf(temp2, _countof(temp2), _T("/MODE %s -%s %s%s/MODE %s +%s %s"), window, mode, user.c_str(), _T("%newl"), window, mode, _T("%question"));
SetDlgItemText(addban_hWnd, IDC_HIDDENEDIT, temp2);
dlg->Activate();
}
@@ -1026,7 +1026,7 @@ void CManagerDlg::OnRemove(CCtrlButton*)
m_remove.Disable();
TCHAR temp[100], mode[3];
- TCHAR* m = m_list.GetItemText(i, temp, SIZEOF(temp));
+ TCHAR* m = m_list.GetItemText(i, temp, _countof(temp));
CMString user = GetWord(m, 0);
if (m_radio1.GetState()) {
@@ -1043,7 +1043,7 @@ void CManagerDlg::OnRemove(CCtrlButton*)
}
TCHAR window[256];
- GetDlgItemText(m_hwnd, IDC_CAPTION, window, SIZEOF(window));
+ GetDlgItemText(m_hwnd, IDC_CAPTION, window, _countof(window));
if (MessageBox(m_hwnd, user.c_str(), temp, MB_YESNO | MB_ICONQUESTION | MB_DEFBUTTON2) == IDYES) {
m_proto->PostIrcMessage(_T("/MODE %s %s %s"), window, mode, user.c_str());
ApplyQuestion();
@@ -1078,7 +1078,7 @@ void CManagerDlg::OnChangeTopic(CCtrlData*)
void CManagerDlg::OnApplyModes(CCtrlButton*)
{
TCHAR window[256];
- GetDlgItemText(m_hwnd, IDC_CAPTION, window, SIZEOF(window));
+ GetDlgItemText(m_hwnd, IDC_CAPTION, window, _countof(window));
CHANNELINFO *wi = (CHANNELINFO *)m_proto->DoEvent(GC_EVENT_GETITEMDATA, window, NULL, NULL, NULL, NULL, NULL, FALSE, FALSE, 0);
if (wi) {
TCHAR toadd[10]; *toadd = '\0';
@@ -1158,7 +1158,7 @@ void CManagerDlg::OnApplyModes(CCtrlButton*)
appendixadd += _T(" ");
TCHAR temp[400];
- m_key.GetText(temp, SIZEOF(temp));
+ m_key.GetText(temp, _countof(temp));
appendixadd += temp;
}
@@ -1167,7 +1167,7 @@ void CManagerDlg::OnApplyModes(CCtrlButton*)
mir_tstrcat(toremove, _T("l"));
else if (GetWindowTextLength(GetDlgItem(m_hwnd, IDC_LIMIT))) {
TCHAR temp[15];
- GetDlgItemText(m_hwnd, IDC_LIMIT, temp, SIZEOF(temp));
+ GetDlgItemText(m_hwnd, IDC_LIMIT, temp, _countof(temp));
if (wi->pszLimit && mir_tstrcmpi(wi->pszLimit, temp)) {
mir_tstrcat(toadd, _T("l"));
appendixadd += _T(" ") + CMString(temp);
@@ -1179,7 +1179,7 @@ void CManagerDlg::OnApplyModes(CCtrlButton*)
appendixadd += _T(" ");
TCHAR temp[15];
- m_limit.GetText(temp, SIZEOF(temp));
+ m_limit.GetText(temp, _countof(temp));
appendixadd += temp;
}
@@ -1207,8 +1207,8 @@ void CManagerDlg::OnApplyTopic(CCtrlButton*)
{
TCHAR temp[470];
TCHAR window[256];
- GetDlgItemText(m_hwnd, IDC_CAPTION, window, SIZEOF(window));
- m_topic.GetText(temp, SIZEOF(temp));
+ GetDlgItemText(m_hwnd, IDC_CAPTION, window, _countof(window));
+ m_topic.GetText(temp, _countof(temp));
m_proto->PostIrcMessage(_T("/TOPIC %s %s"), window, temp);
int i = m_topic.SendMsg(CB_FINDSTRINGEXACT, -1, (LPARAM)temp);
if (i != LB_ERR)
@@ -1243,7 +1243,7 @@ void CManagerDlg::OnRadio(CCtrlData*)
void CManagerDlg::ApplyQuestion()
{
TCHAR window[256];
- GetDlgItemText(m_hwnd, IDC_CAPTION, window, SIZEOF(window));
+ GetDlgItemText(m_hwnd, IDC_CAPTION, window, _countof(window));
TCHAR mode[3];
mir_tstrcpy(mode, _T("+b"));
diff --git a/protocols/IcqOscarJ/src/capabilities.cpp b/protocols/IcqOscarJ/src/capabilities.cpp
index b6af33a09c..6e84fbd13f 100644
--- a/protocols/IcqOscarJ/src/capabilities.cpp
+++ b/protocols/IcqOscarJ/src/capabilities.cpp
@@ -84,7 +84,7 @@ void NetLog_CapabilityChange(CIcqProto *ppro, const char *szChange, DWORD fdwCap
if (!fdwCapabilities) return;
- for (int nIndex = 0; nIndex < SIZEOF(CapabilityNames); nIndex++) {
+ for (int nIndex = 0; nIndex < _countof(CapabilityNames); nIndex++) {
// Check if the current capability is present
if ((fdwCapabilities & CapabilityNames[nIndex].capID) == CapabilityNames[nIndex].capID) {
if (mir_strlen(szBuffer))
@@ -182,7 +182,7 @@ DWORD GetCapabilitiesFromBuffer(BYTE *pBuffer, int nLength)
DWORD fdwCaps = 0;
// Calculate the number of records
- int nRecordSize = SIZEOF(CapabilityRecord);
+ int nRecordSize = _countof(CapabilityRecord);
// Loop over all capabilities in the buffer and
// compare them to our own record of capabilities
diff --git a/protocols/IcqOscarJ/src/constants.cpp b/protocols/IcqOscarJ/src/constants.cpp
index f97298b955..a5543315ee 100644
--- a/protocols/IcqOscarJ/src/constants.cpp
+++ b/protocols/IcqOscarJ/src/constants.cpp
@@ -128,4 +128,4 @@ const SettingItem setting[] =
{ LPGEN("Interest areas 4"), LI_STRING, DBVT_UTF8, "Interest3Text" },
};
-const int settingCount = SIZEOF(setting);
+const int settingCount = _countof(setting);
diff --git a/protocols/IcqOscarJ/src/db.cpp b/protocols/IcqOscarJ/src/db.cpp
index a17d929da8..cadfd7eab6 100644
--- a/protocols/IcqOscarJ/src/db.cpp
+++ b/protocols/IcqOscarJ/src/db.cpp
@@ -85,7 +85,7 @@ void ChangeInfoData::LoadSettingsFromDb(int keepChanged)
char buf[MAX_PATH];
TCHAR tbuf[MAX_PATH];
- if (utf8_to_tchar_static(GetItemSettingText(i, buf, SIZEOF(buf)), tbuf, SIZEOF(tbuf)))
+ if (utf8_to_tchar_static(GetItemSettingText(i, buf, _countof(buf)), tbuf, _countof(tbuf)))
ListView_SetItemText(hwndList, i, 1, tbuf);
}
}
@@ -136,7 +136,7 @@ static INT_PTR CALLBACK PwConfirmDlgProc(HWND hwndDlg, UINT msg, WPARAM wParam,
{
char szTest[16];
- GetDlgItemTextA(hwndDlg, IDC_OLDPASS, szTest, SIZEOF(szTest));
+ GetDlgItemTextA(hwndDlg, IDC_OLDPASS, szTest, _countof(szTest));
if (mir_strcmp(szTest, dat->ppro->GetUserPassword(TRUE))) {
MessageBox(hwndDlg, TranslateT("The password does not match your current password. Check Caps Lock and try again."), TranslateT("Change ICQ Details"), MB_OK);
@@ -145,7 +145,7 @@ static INT_PTR CALLBACK PwConfirmDlgProc(HWND hwndDlg, UINT msg, WPARAM wParam,
break;
}
- GetDlgItemTextA(hwndDlg, IDC_PASSWORD, szTest, SIZEOF(szTest));
+ GetDlgItemTextA(hwndDlg, IDC_PASSWORD, szTest, _countof(szTest));
if (mir_strcmp(szTest, dat->Pass)) {
MessageBox(hwndDlg, TranslateT("The password does not match the password you originally entered. Check Caps Lock and try again."), TranslateT("Change ICQ Details"), MB_OK);
SendDlgItemMessage(hwndDlg, IDC_PASSWORD, EM_SETSEL, 0, (LPARAM)-1);
diff --git a/protocols/IcqOscarJ/src/dlgproc.cpp b/protocols/IcqOscarJ/src/dlgproc.cpp
index 704764c848..3b0cc7f6ab 100644
--- a/protocols/IcqOscarJ/src/dlgproc.cpp
+++ b/protocols/IcqOscarJ/src/dlgproc.cpp
@@ -125,7 +125,7 @@ char* ChangeInfoData::GetItemSettingText(int i, char *buf, size_t bufsize)
void ChangeInfoData::PaintItemSetting(HDC hdc, RECT *rc, int i, UINT itemState)
{
char str[MAX_PATH];
- char *text = GetItemSettingText(i, str, SIZEOF(str));
+ char *text = GetItemSettingText(i, str, _countof(str));
const SettingItem &si = setting[i];
SettingItemData &sid = settingData[i];
@@ -204,7 +204,7 @@ INT_PTR CALLBACK ChangeInfoDlgProc(HWND hwndDlg, UINT msg, WPARAM wParam, LPARAM
TCHAR text[MAX_PATH];
lvi.lParam = lvi.iItem;
lvi.pszText = text;
- utf8_to_tchar_static(setting[lvi.iItem].szDescription, text, SIZEOF(text));
+ utf8_to_tchar_static(setting[lvi.iItem].szDescription, text, _countof(text));
ListView_InsertItem(dat->hwndList, &lvi);
}
}
@@ -467,17 +467,17 @@ INT_PTR CALLBACK ChangeInfoDlgProc(HWND hwndDlg, UINT msg, WPARAM wParam, LPARAM
if (ack->type != ACKTYPE_SETINFO) break;
if (ack->result == ACKRESULT_SUCCESS) {
- for (i = 0; i < SIZEOF(dat->hUpload); i++)
+ for (i = 0; i < _countof(dat->hUpload); i++)
if (dat->hUpload[i] && ack->hProcess == dat->hUpload[i]) break;
- if (i == SIZEOF(dat->hUpload)) break;
+ if (i == _countof(dat->hUpload)) break;
dat->hUpload[i] = NULL;
- for (done = 0, i = 0; i < SIZEOF(dat->hUpload); i++)
+ for (done = 0, i = 0; i < _countof(dat->hUpload); i++)
done += dat->hUpload[i] == NULL;
TCHAR buf[MAX_PATH];
- mir_sntprintf(buf, TranslateT("Upload in progress...%d%%"), 100 * done / (SIZEOF(dat->hUpload)));
+ mir_sntprintf(buf, TranslateT("Upload in progress...%d%%"), 100 * done / (_countof(dat->hUpload)));
SetDlgItemText(hwndDlg, IDC_UPLOADING, buf);
- if (done < SIZEOF(dat->hUpload)) break;
+ if (done < _countof(dat->hUpload)) break;
dat->ClearChangeFlags();
UnhookEvent(dat->hAckHook);
diff --git a/protocols/IcqOscarJ/src/editlist.cpp b/protocols/IcqOscarJ/src/editlist.cpp
index df632256d5..dfaebb4c85 100644
--- a/protocols/IcqOscarJ/src/editlist.cpp
+++ b/protocols/IcqOscarJ/src/editlist.cpp
@@ -175,7 +175,7 @@ void ChangeInfoData::EndListEdit(int save)
if (sid.changed) {
char buf[MAX_PATH];
TCHAR tbuf[MAX_PATH];
- if (utf8_to_tchar_static(ICQTranslateUtfStatic(pItem.text, buf, SIZEOF(buf)), tbuf, SIZEOF(buf)))
+ if (utf8_to_tchar_static(ICQTranslateUtfStatic(pItem.text, buf, _countof(buf)), tbuf, _countof(buf)))
ListView_SetItemText(hwndList, iEditItem, 1, tbuf);
EnableDlgItem(GetParent(hwndList), IDC_SAVE, TRUE);
diff --git a/protocols/IcqOscarJ/src/editstring.cpp b/protocols/IcqOscarJ/src/editstring.cpp
index 2ea8f8eb1c..1cd3a2f805 100644
--- a/protocols/IcqOscarJ/src/editstring.cpp
+++ b/protocols/IcqOscarJ/src/editstring.cpp
@@ -79,7 +79,7 @@ static void EscapesToBinary(char *str)
memmove(str+1,codeend,mir_strlen(codeend)+1);
continue;
}
- for(int i=0;i<SIZEOF(escapes);i+=2)
+ for(int i=0;i<_countof(escapes);i+=2)
if(str[1]==escapes[i])
{
*str=escapes[i+1];
@@ -117,14 +117,14 @@ char *BinaryToEscapes(char *str)
pout=out=(char*)SAFE_REALLOC(out,len);
}
*pout++='\\';
- for(i = 0; i < SIZEOF(escapes); i += 2)
+ for(i = 0; i < _countof(escapes); i += 2)
if (*str==escapes[i+1])
{
*pout++=escapes[i];
extra--;
break;
}
- if(i < SIZEOF(escapes)) continue;
+ if(i < _countof(escapes)) continue;
*pout++='0'; extra--;
if (*str>=8)
{
@@ -325,7 +325,7 @@ void ChangeInfoData::EndStringEdit(int save)
if (sid.changed) {
TCHAR tbuf[MAX_PATH];
- GetWindowText(hwndEdit, tbuf, SIZEOF(tbuf));
+ GetWindowText(hwndEdit, tbuf, _countof(tbuf));
ListView_SetItemText(hwndList, iEditItem, 1, tbuf);
EnableDlgItem(hwndDlg, IDC_SAVE, TRUE);
diff --git a/protocols/IcqOscarJ/src/fam_01service.cpp b/protocols/IcqOscarJ/src/fam_01service.cpp
index 2f31a8a890..d1361cf9f3 100644
--- a/protocols/IcqOscarJ/src/fam_01service.cpp
+++ b/protocols/IcqOscarJ/src/fam_01service.cpp
@@ -735,7 +735,7 @@ void CIcqProto::handleServUINSettings(int nPort, serverthread_info *info)
// prepare mood id
if (m_bMoodsEnabled && bXStatus && moodXStatus[bXStatus - 1] != -1)
- mir_snprintf(szMoodData, SIZEOF(szMoodData), "icqmood%d", moodXStatus[bXStatus - 1]);
+ mir_snprintf(szMoodData, _countof(szMoodData), "icqmood%d", moodXStatus[bXStatus - 1]);
else
szMoodData[0] = '\0';
diff --git a/protocols/IcqOscarJ/src/fam_04message.cpp b/protocols/IcqOscarJ/src/fam_04message.cpp
index 9715065269..2b9c68bfca 100644
--- a/protocols/IcqOscarJ/src/fam_04message.cpp
+++ b/protocols/IcqOscarJ/src/fam_04message.cpp
@@ -1517,7 +1517,7 @@ void CIcqProto::handleMessageTypes(DWORD dwUin, char *szUID, DWORD dwTimestamp,
if ((BYTE)*pszMsg == 0xFE) {
*pszMsg = '\0';
pszMsgField[nMsgFields++] = pszMsg + 1;
- if (nMsgFields >= SIZEOF(pszMsgField))
+ if (nMsgFields >= _countof(pszMsgField))
break;
}
}
@@ -2605,7 +2605,7 @@ void CIcqProto::handleTypingNotification(BYTE *buf, size_t wLen)
char szMsg[MAX_PATH];
char *nick = NickFromHandleUtf(hContact);
- mir_snprintf(szMsg, SIZEOF(szMsg), ICQTranslateUtfStatic(LPGEN("Contact \"%s\" has closed the message window."), szFormat, MAX_PATH), nick);
+ mir_snprintf(szMsg, _countof(szMsg), ICQTranslateUtfStatic(LPGEN("Contact \"%s\" has closed the message window."), szFormat, MAX_PATH), nick);
ShowPopupMsg(hContact, ICQTranslateUtfStatic(LPGEN("ICQ Note"), szFormat, MAX_PATH), szMsg, LOG_NOTE);
SAFE_FREE((void**)&nick);
diff --git a/protocols/IcqOscarJ/src/fam_13servclist.cpp b/protocols/IcqOscarJ/src/fam_13servclist.cpp
index 83e28ffa0f..4d52f6fc21 100644
--- a/protocols/IcqOscarJ/src/fam_13servclist.cpp
+++ b/protocols/IcqOscarJ/src/fam_13servclist.cpp
@@ -181,7 +181,7 @@ void CIcqProto::handleServCListFam(BYTE *pBuffer, size_t wBufferLength, snac_hea
break;
char szLogText[MAX_PATH];
- mir_snprintf(szLogText, SIZEOF(szLogText), szChange, nItems);
+ mir_snprintf(szLogText, _countof(szLogText), szChange, nItems);
debugLogA("Server sent SNAC(x13,x%02x) - %s", pSnacHeader->wSubtype, szLogText);
}
break;
@@ -288,7 +288,7 @@ void CIcqProto::handleServerCListRightsReply(BYTE *buf, size_t wLen)
for (int i = 0; i < pTLV->wLen / 2; i++) {
m_wServerListLimits[i] = (pLimits[i] & 0xFF) << 8 | (pLimits[i] >> 8);
- if (i + 1 >= SIZEOF(m_wServerListLimits))
+ if (i + 1 >= _countof(m_wServerListLimits))
break;
}
@@ -1248,7 +1248,7 @@ void CIcqProto::handleServerCListItemUpdate(const char *szRecordName, WORD wItem
char *nick = NickFromHandleUtf(hContact);
setByte(hContact, "Auth", 0);
- mir_snprintf(str, ICQTranslateUtfStatic(LPGEN("Contact \"%s\" was authorized in the server list."), msg, SIZEOF(msg)), nick);
+ mir_snprintf(str, ICQTranslateUtfStatic(LPGEN("Contact \"%s\" was authorized in the server list."), msg, _countof(msg)), nick);
icq_LogMessage(LOG_WARNING, str);
SAFE_FREE(&nick);
}
@@ -1258,7 +1258,7 @@ void CIcqProto::handleServerCListItemUpdate(const char *szRecordName, WORD wItem
char *nick = NickFromHandleUtf(hContact);
setByte(hContact, "Auth", 1);
- mir_snprintf(str, ICQTranslateUtfStatic(LPGEN("Contact \"%s\" lost its authorization in the server list."), msg, SIZEOF(msg)), nick);
+ mir_snprintf(str, ICQTranslateUtfStatic(LPGEN("Contact \"%s\" lost its authorization in the server list."), msg, _countof(msg)), nick);
icq_LogMessage(LOG_WARNING, str);
SAFE_FREE(&nick);
}
@@ -1348,7 +1348,7 @@ void CIcqProto::handleServerCListItemDelete(const char *szRecordName, WORD wItem
char msg[MAX_PATH];
char *nick = NickFromHandleUtf(hContact);
- mir_snprintf(str, ICQTranslateUtfStatic(LPGEN("User \"%s\" was removed from server list."), msg, SIZEOF(msg)), nick);
+ mir_snprintf(str, ICQTranslateUtfStatic(LPGEN("User \"%s\" was removed from server list."), msg, _countof(msg)), nick);
icq_LogMessage(LOG_WARNING, str);
SAFE_FREE(&nick);
}
diff --git a/protocols/IcqOscarJ/src/fam_15icqserver.cpp b/protocols/IcqOscarJ/src/fam_15icqserver.cpp
index 7ecfae6408..7c6a406454 100644
--- a/protocols/IcqOscarJ/src/fam_15icqserver.cpp
+++ b/protocols/IcqOscarJ/src/fam_15icqserver.cpp
@@ -525,7 +525,7 @@ int CIcqProto::parseUserInfoRecord(MCONTACT hContact, oscar_tlv *pData, UserInfo
for (int i = 0; i < nRecordDef; i++) {
char szItemKey[MAX_PATH];
- mir_snprintf(szItemKey, SIZEOF(szItemKey), pRecordDef[i].szDbSetting, nRecords);
+ mir_snprintf(szItemKey, _countof(szItemKey), pRecordDef[i].szDbSetting, nRecords);
switch (pRecordDef[i].dbType) {
case DBVT_UTF8:
@@ -550,7 +550,7 @@ int CIcqProto::parseUserInfoRecord(MCONTACT hContact, oscar_tlv *pData, UserInfo
for (int i = nRecords; i <= nMaxRecords; i++)
for (int j = 0; j < nRecordDef; j++) {
char szItemKey[MAX_PATH];
- mir_snprintf(szItemKey, SIZEOF(szItemKey), pRecordDef[j].szDbSetting, i);
+ mir_snprintf(szItemKey, _countof(szItemKey), pRecordDef[j].szDbSetting, i);
delSetting(hContact, szItemKey);
}
@@ -784,9 +784,9 @@ void CIcqProto::parseDirectoryUserDetailsData(MCONTACT hContact, oscar_tlv_chain
writeDbInfoSettingTLVStringUtf(hContact, "LastName", cDetails, 0x6E);
writeDbInfoSettingTLVStringUtf(hContact, "Nick", cDetails, 0x78);
// Home Address
- parseUserInfoRecord(hContact, cDetails->getTLV(0x96, 1), rAddress, SIZEOF(rAddress), 1);
+ parseUserInfoRecord(hContact, cDetails->getTLV(0x96, 1), rAddress, _countof(rAddress), 1);
// Origin Address
- parseUserInfoRecord(hContact, cDetails->getTLV(0xA0, 1), rOriginAddress, SIZEOF(rOriginAddress), 1);
+ parseUserInfoRecord(hContact, cDetails->getTLV(0xA0, 1), rOriginAddress, _countof(rOriginAddress), 1);
// Phones
pTLV = cDetails->getTLV(0xC8, 1);
if (pTLV && pTLV->wLen >= 2) {
@@ -825,13 +825,13 @@ void CIcqProto::parseDirectoryUserDetailsData(MCONTACT hContact, oscar_tlv_chain
delSetting(hContact, "CompanyFax");
}
// Emails
- parseUserInfoRecord(hContact, cDetails->getTLV(0x8C, 1), rEmail, SIZEOF(rEmail), 4);
+ parseUserInfoRecord(hContact, cDetails->getTLV(0x8C, 1), rEmail, _countof(rEmail), 4);
writeDbInfoSettingTLVByte(hContact, "Timezone", cDetails, 0x17C);
// Company
- parseUserInfoRecord(hContact, cDetails->getTLV(0x118, 1), rCompany, SIZEOF(rCompany), 1);
+ parseUserInfoRecord(hContact, cDetails->getTLV(0x118, 1), rCompany, _countof(rCompany), 1);
// Education
- parseUserInfoRecord(hContact, cDetails->getTLV(0x10E, 1), rEducation, SIZEOF(rEducation), 1);
+ parseUserInfoRecord(hContact, cDetails->getTLV(0x10E, 1), rEducation, _countof(rEducation), 1);
switch (cDetails->getNumber(0x82, 1)) {
case 1:
@@ -853,7 +853,7 @@ void CIcqProto::parseDirectoryUserDetailsData(MCONTACT hContact, oscar_tlv_chain
writeDbInfoSettingTLVByte(hContact, "MaritalStatus", cDetails, 0x12C);
// Interests
- parseUserInfoRecord(hContact, cDetails->getTLV(0x122, 1), rInterest, SIZEOF(rInterest), 4);
+ parseUserInfoRecord(hContact, cDetails->getTLV(0x122, 1), rInterest, _countof(rInterest), 4);
writeDbInfoSettingTLVStringUtf(hContact, "About", cDetails, 0x186);
diff --git a/protocols/IcqOscarJ/src/icq_advsearch.cpp b/protocols/IcqOscarJ/src/icq_advsearch.cpp
index 647faf6392..1d69353995 100644
--- a/protocols/IcqOscarJ/src/icq_advsearch.cpp
+++ b/protocols/IcqOscarJ/src/icq_advsearch.cpp
@@ -72,7 +72,7 @@ static void searchPackTLVLNTS(PBYTE *buf, size_t *buflen, HWND hwndDlg, UINT idC
{
char str[512];
- GetDlgItemTextA(hwndDlg, idControl, str, SIZEOF(str));
+ GetDlgItemTextA(hwndDlg, idControl, str, _countof(str));
ppackLETLVLNTS(buf, buflen, str, wType, 0);
}
@@ -81,7 +81,7 @@ static void searchPackTLVWordLNTS(PBYTE *buf, size_t *buflen, HWND hwndDlg, UINT
{
char str[512];
- GetDlgItemTextA(hwndDlg, idControl, str, SIZEOF(str));
+ GetDlgItemTextA(hwndDlg, idControl, str, _countof(str));
ppackLETLVWordLNTS(buf, buflen, w, str, wType, 0);
}
diff --git a/protocols/IcqOscarJ/src/icq_avatar.cpp b/protocols/IcqOscarJ/src/icq_avatar.cpp
index bf14253fca..53caf1b702 100644
--- a/protocols/IcqOscarJ/src/icq_avatar.cpp
+++ b/protocols/IcqOscarJ/src/icq_avatar.cpp
@@ -79,7 +79,7 @@ void CIcqProto::GetAvatarFileName(int dwUin, const char *szUid, TCHAR *pszDest,
mir_sntprintf(szPath, _T("%s\\%S\\"), VARST(_T("%miranda_avatarcache%")), m_szModuleName);
FOLDERSGETDATA fgd = { sizeof(fgd) };
- fgd.nMaxPathSize = SIZEOF(szPath);
+ fgd.nMaxPathSize = _countof(szPath);
fgd.szPathT = szPath;
fgd.flags = FF_TCHAR;
@@ -1158,7 +1158,7 @@ void avatars_server_connection::handleAvatarFam(BYTE *pBuffer, size_t wBufferLen
PROTO_AVATAR_INFORMATION ai = { 0 };
ai.format = PA_FORMAT_JPEG; // this is for error only
ai.hContact = pCookieData->hContact;
- mir_tstrncpy(ai.filename, pCookieData->szFile, SIZEOF(ai.filename));
+ mir_tstrncpy(ai.filename, pCookieData->szFile, _countof(ai.filename));
AddAvatarExt(PA_FORMAT_JPEG, ai.filename);
ppro->FreeCookie(pSnacHeader->dwRef);
@@ -1211,11 +1211,11 @@ void avatars_server_connection::handleAvatarFam(BYTE *pBuffer, size_t wBufferLen
const TCHAR *ptszExt;
int dwPaFormat = ProtoGetBufferFormat(pBuffer, &ptszExt);
TCHAR tszImageFile[MAX_PATH];
- mir_sntprintf(tszImageFile, SIZEOF(tszImageFile), _T("%s%s"), pCookieData->szFile, ptszExt);
+ mir_sntprintf(tszImageFile, _countof(tszImageFile), _T("%s%s"), pCookieData->szFile, ptszExt);
ppro->setByte(pCookieData->hContact, "AvatarType", (BYTE)dwPaFormat);
ai.format = dwPaFormat; // set the format
- mir_tstrncpy(ai.filename, tszImageFile, SIZEOF(ai.filename));
+ mir_tstrncpy(ai.filename, tszImageFile, _countof(ai.filename));
int out = _topen(tszImageFile, _O_BINARY | _O_CREAT | _O_TRUNC | _O_WRONLY, _S_IREAD | _S_IWRITE);
if (out != -1) {
diff --git a/protocols/IcqOscarJ/src/icq_clients.cpp b/protocols/IcqOscarJ/src/icq_clients.cpp
index 275dce0f04..0993175820 100644
--- a/protocols/IcqOscarJ/src/icq_clients.cpp
+++ b/protocols/IcqOscarJ/src/icq_clients.cpp
@@ -473,7 +473,7 @@ const char* CIcqProto::detectUserClient(
else if (MatchCapability(caps, wLen, &capQipInfium)) {
mir_strcpy(szClientBuf, "QIP Infium");
if (dwFT1) {
- mir_snprintf(ver, SIZEOF(ver), " (%d)", dwFT1);
+ mir_snprintf(ver, _countof(ver), " (%d)", dwFT1);
mir_strcat(szClientBuf, ver);
}
if (dwFT2 == 0x0B)
@@ -484,7 +484,7 @@ const char* CIcqProto::detectUserClient(
else if (MatchCapability(caps, wLen, &capQip2010, 12)) {
mir_strcpy(szClientBuf, "QIP 2010");
if (dwFT1) {
- mir_snprintf(ver, SIZEOF(ver), " (%d)", dwFT1);
+ mir_snprintf(ver, _countof(ver), " (%d)", dwFT1);
mir_strcat(szClientBuf, ver);
}
@@ -493,7 +493,7 @@ const char* CIcqProto::detectUserClient(
else if (MatchCapability(caps, wLen, &capQip2012, 12)) {
mir_strcpy(szClientBuf, "QIP 2012");
if (dwFT1) {
- mir_snprintf(ver, SIZEOF(ver), " (%d)", dwFT1);
+ mir_snprintf(ver, _countof(ver), " (%d)", dwFT1);
mir_strcat(szClientBuf, ver);
}
@@ -507,7 +507,7 @@ const char* CIcqProto::detectUserClient(
mir_snprintf(szClientBuf, 64, cliQip, ver);
if (dwFT1 && dwFT2 == 0x0E) {
- mir_snprintf(ver, SIZEOF(ver), " (%d%d%d%d)", dwFT1 >> 0x18, (dwFT1 >> 0x10) & 0xFF, (dwFT1 >> 0x08) & 0xFF, dwFT1 & 0xFF);
+ mir_snprintf(ver, _countof(ver), " (%d%d%d%d)", dwFT1 >> 0x18, (dwFT1 >> 0x10) & 0xFF, (dwFT1 >> 0x08) & 0xFF, dwFT1 & 0xFF);
mir_strcat(szClientBuf, ver);
}
szClient = szClientBuf;
@@ -528,7 +528,7 @@ const char* CIcqProto::detectUserClient(
if (dwFT2 == 0x0FFFF0011 && dwFT3 == 0x1100FFFF && (dwFT1 >> 0x18)) {
char ver[16];
- mir_snprintf(ver, SIZEOF(ver), " %d.%d", dwFT1 >> 0x18, (dwFT1 >> 0x10) & 0xFF);
+ mir_snprintf(ver, _countof(ver), " %d.%d", dwFT1 >> 0x18, (dwFT1 >> 0x10) & 0xFF);
if ((dwFT1 & 0xFF) == 0x0B)
mir_strcat(ver, " Beta");
mir_strcat(szClientBuf, ver);
@@ -943,7 +943,7 @@ const char* CIcqProto::detectUserClient(
capstr *capId = MatchCapability(caps, wLen, &capMimPack, 4);
if (capId) {
char szPack[16];
- mir_snprintf(szPack, SIZEOF(szPack), " [%.12s]", (*capId) + 4);
+ mir_snprintf(szPack, _countof(szPack), " [%.12s]", (*capId) + 4);
// make sure client string is not constant
if (szClient != szClientBuf) {
diff --git a/protocols/IcqOscarJ/src/icq_firstrun.cpp b/protocols/IcqOscarJ/src/icq_firstrun.cpp
index cf065c1664..571e4949de 100644
--- a/protocols/IcqOscarJ/src/icq_firstrun.cpp
+++ b/protocols/IcqOscarJ/src/icq_firstrun.cpp
@@ -30,7 +30,7 @@ static void accountLoadDetails(CIcqProto *ppro, HWND hwndDlg)
char pszUIN[20];
DWORD dwUIN = ppro->getContactUin(NULL);
if (dwUIN) {
- mir_snprintf(pszUIN, SIZEOF(pszUIN), "%u", dwUIN);
+ mir_snprintf(pszUIN, _countof(pszUIN), "%u", dwUIN);
SetDlgItemTextA(hwndDlg, IDC_UIN, pszUIN);
}
@@ -86,10 +86,10 @@ INT_PTR CALLBACK icq_FirstRunDlgProc(HWND hwndDlg, UINT msg, WPARAM wParam, LPAR
switch (((LPNMHDR)lParam)->code) {
case PSN_APPLY:
char str[128];
- GetDlgItemTextA(hwndDlg, IDC_UIN, str, SIZEOF(str));
+ GetDlgItemTextA(hwndDlg, IDC_UIN, str, _countof(str));
ppro->setDword(UNIQUEIDSETTING, atoi(str));
- GetDlgItemTextA(hwndDlg, IDC_PW, str, SIZEOF(ppro->m_szPassword));
+ GetDlgItemTextA(hwndDlg, IDC_PW, str, _countof(ppro->m_szPassword));
mir_strcpy(ppro->m_szPassword, str);
ppro->setString("Password", str);
break;
diff --git a/protocols/IcqOscarJ/src/icq_http.cpp b/protocols/IcqOscarJ/src/icq_http.cpp
index 3620340f28..6a46f8e35b 100644
--- a/protocols/IcqOscarJ/src/icq_http.cpp
+++ b/protocols/IcqOscarJ/src/icq_http.cpp
@@ -54,7 +54,7 @@ int icq_httpGatewayInit(HANDLE hConn, NETLIBOPENCONNECTION*, NETLIBHTTPREQUEST *
unpackDWord(&buf, &dwSid2);
unpackDWord(&buf, &dwSid3);
unpackDWord(&buf, &dwSid4);
- mir_snprintf(szSid, SIZEOF(szSid), "%08x%08x%08x%08x", dwSid1, dwSid2, dwSid3, dwSid4);
+ mir_snprintf(szSid, _countof(szSid), "%08x%08x%08x%08x", dwSid1, dwSid2, dwSid3, dwSid4);
unpackWord(&buf, &wIpLen);
if(nlhr->dataLength < 30 + wIpLen || wIpLen == 0 || wIpLen > sizeof(szHttpServer) - 1)
@@ -73,8 +73,8 @@ int icq_httpGatewayInit(HANDLE hConn, NETLIBOPENCONNECTION*, NETLIBHTTPREQUEST *
nlhpi.szHttpGetUrl = szHttpGetUrl;
nlhpi.szHttpPostUrl = szHttpPostUrl;
nlhpi.firstPostSequence = 1;
- mir_snprintf(szHttpGetUrl, SIZEOF(szHttpGetUrl), "http://%s/monitor?sid=%s", szHttpServer, szSid);
- mir_snprintf(szHttpPostUrl, SIZEOF(szHttpPostUrl), "http://%s/data?sid=%s&seq=", szHttpServer, szSid);
+ mir_snprintf(szHttpGetUrl, _countof(szHttpGetUrl), "http://%s/monitor?sid=%s", szHttpServer, szSid);
+ mir_snprintf(szHttpPostUrl, _countof(szHttpPostUrl), "http://%s/data?sid=%s&seq=", szHttpServer, szSid);
return CallService(MS_NETLIB_SETHTTPPROXYINFO, (WPARAM)hConn, (LPARAM)&nlhpi);
}
diff --git a/protocols/IcqOscarJ/src/icq_menu.cpp b/protocols/IcqOscarJ/src/icq_menu.cpp
index afe7cfedfb..b9c66d361a 100644
--- a/protocols/IcqOscarJ/src/icq_menu.cpp
+++ b/protocols/IcqOscarJ/src/icq_menu.cpp
@@ -177,7 +177,7 @@ INT_PTR CIcqProto::OpenWebProfile(WPARAM hContact, LPARAM)
{
DWORD dwUin = getContactUin(hContact);
char url[256];
- mir_snprintf(url, SIZEOF(url), "http://www.icq.com/people/%d",dwUin);
+ mir_snprintf(url, _countof(url), "http://www.icq.com/people/%d",dwUin);
return CallService(MS_UTILS_OPENURL, OUF_NEWWINDOW, (LPARAM)url);
}
diff --git a/protocols/IcqOscarJ/src/icq_opts.cpp b/protocols/IcqOscarJ/src/icq_opts.cpp
index 14d9e7b629..2559bdfb3b 100644
--- a/protocols/IcqOscarJ/src/icq_opts.cpp
+++ b/protocols/IcqOscarJ/src/icq_opts.cpp
@@ -146,7 +146,7 @@ static INT_PTR CALLBACK DlgProcIcqOpts(HWND hwndDlg, UINT msg, WPARAM wParam, LP
char str[128];
ppro->setDword(UNIQUEIDSETTING, GetDlgItemInt(hwndDlg, IDC_ICQNUM, NULL, FALSE));
- GetDlgItemTextA(hwndDlg, IDC_PASSWORD, str, SIZEOF(ppro->m_szPassword));
+ GetDlgItemTextA(hwndDlg, IDC_PASSWORD, str, _countof(ppro->m_szPassword));
if (mir_strlen(str)) {
mir_strcpy(ppro->m_szPassword, str);
ppro->m_bRememberPwd = true;
@@ -154,7 +154,7 @@ static INT_PTR CALLBACK DlgProcIcqOpts(HWND hwndDlg, UINT msg, WPARAM wParam, LP
else ppro->m_bRememberPwd = ppro->getByte("RememberPass", 0);
ppro->setString("Password", str);
- GetDlgItemTextA(hwndDlg, IDC_ICQSERVER, str, SIZEOF(str));
+ GetDlgItemTextA(hwndDlg, IDC_ICQSERVER, str, _countof(str));
ppro->setString("OscarServer", str);
ppro->setWord("OscarPort", (WORD)GetDlgItemInt(hwndDlg, IDC_ICQPORT, NULL, FALSE));
@@ -195,7 +195,7 @@ static INT_PTR CALLBACK DlgProcIcqPrivacyOpts(HWND hwndDlg, UINT msg, WPARAM wPa
int nAddAuth = ppro->getByte("Auth", 1);
if (!ppro->icqOnline()) {
- icq_EnableMultipleControls(hwndDlg, icqPrivacyControls, SIZEOF(icqPrivacyControls), FALSE);
+ icq_EnableMultipleControls(hwndDlg, icqPrivacyControls, _countof(icqPrivacyControls), FALSE);
ShowDlgItem(hwndDlg, IDC_STATIC_NOTONLINE, SW_SHOW);
}
else ShowDlgItem(hwndDlg, IDC_STATIC_NOTONLINE, SW_HIDE);
@@ -352,18 +352,18 @@ static INT_PTR CALLBACK DlgProcIcqFeaturesOpts(HWND hwndDlg, UINT msg, WPARAM wP
BOOL byData = ppro->getByte("DirectMessaging", DEFAULT_DCMSG_ENABLED);
CheckDlgButton(hwndDlg, IDC_DCENABLE, byData ? BST_CHECKED : BST_UNCHECKED);
CheckDlgButton(hwndDlg, IDC_DCPASSIVE, byData == 1 ? BST_CHECKED : BST_UNCHECKED);
- icq_EnableMultipleControls(hwndDlg, icqDCMsgControls, SIZEOF(icqDCMsgControls), byData ? TRUE : FALSE);
+ icq_EnableMultipleControls(hwndDlg, icqDCMsgControls, _countof(icqDCMsgControls), byData ? TRUE : FALSE);
BYTE byXStatusEnabled = ppro->getByte("XStatusEnabled", DEFAULT_XSTATUS_ENABLED);
CheckDlgButton(hwndDlg, IDC_XSTATUSENABLE, byXStatusEnabled ? BST_CHECKED : BST_UNCHECKED);
BYTE byMoodsEnabled = ppro->getByte("MoodsEnabled", DEFAULT_MOODS_ENABLED);
CheckDlgButton(hwndDlg, IDC_MOODSENABLE, byMoodsEnabled ? BST_CHECKED : BST_UNCHECKED);
- icq_EnableMultipleControls(hwndDlg, icqXStatusControls, SIZEOF(icqXStatusControls), byXStatusEnabled);
- icq_EnableMultipleControls(hwndDlg, icqCustomStatusControls, SIZEOF(icqCustomStatusControls), byXStatusEnabled || byMoodsEnabled);
+ icq_EnableMultipleControls(hwndDlg, icqXStatusControls, _countof(icqXStatusControls), byXStatusEnabled);
+ icq_EnableMultipleControls(hwndDlg, icqCustomStatusControls, _countof(icqCustomStatusControls), byXStatusEnabled || byMoodsEnabled);
LoadDBCheckState(ppro, hwndDlg, IDC_XSTATUSAUTO, "XStatusAuto", DEFAULT_XSTATUS_AUTO);
LoadDBCheckState(ppro, hwndDlg, IDC_XSTATUSRESET, "XStatusReset", DEFAULT_XSTATUS_RESET);
LoadDBCheckState(ppro, hwndDlg, IDC_KILLSPAMBOTS, "KillSpambots", DEFAULT_KILLSPAM_ENABLED);
LoadDBCheckState(ppro, hwndDlg, IDC_AIMENABLE, "AimEnabled", DEFAULT_AIM_ENABLED);
- icq_EnableMultipleControls(hwndDlg, icqAimControls, SIZEOF(icqAimControls), ppro->icqOnline() ? FALSE : TRUE);
+ icq_EnableMultipleControls(hwndDlg, icqAimControls, _countof(icqAimControls), ppro->icqOnline() ? FALSE : TRUE);
hCpCombo = GetDlgItem(hwndDlg, IDC_UTFCODEPAGE);
int sCodePage = ppro->getWord("AnsiCodePage", CP_ACP);
@@ -389,13 +389,13 @@ static INT_PTR CALLBACK DlgProcIcqFeaturesOpts(HWND hwndDlg, UINT msg, WPARAM wP
OptDlgChanged(hwndDlg);
break;
case IDC_DCENABLE:
- icq_EnableMultipleControls(hwndDlg, icqDCMsgControls, SIZEOF(icqDCMsgControls), IsDlgButtonChecked(hwndDlg, IDC_DCENABLE));
+ icq_EnableMultipleControls(hwndDlg, icqDCMsgControls, _countof(icqDCMsgControls), IsDlgButtonChecked(hwndDlg, IDC_DCENABLE));
OptDlgChanged(hwndDlg);
break;
case IDC_XSTATUSENABLE:
- icq_EnableMultipleControls(hwndDlg, icqXStatusControls, SIZEOF(icqXStatusControls), IsDlgButtonChecked(hwndDlg, IDC_XSTATUSENABLE));
+ icq_EnableMultipleControls(hwndDlg, icqXStatusControls, _countof(icqXStatusControls), IsDlgButtonChecked(hwndDlg, IDC_XSTATUSENABLE));
case IDC_MOODSENABLE:
- icq_EnableMultipleControls(hwndDlg, icqCustomStatusControls, SIZEOF(icqCustomStatusControls), IsDlgButtonChecked(hwndDlg, IDC_XSTATUSENABLE) || IsDlgButtonChecked(hwndDlg, IDC_MOODSENABLE));
+ icq_EnableMultipleControls(hwndDlg, icqCustomStatusControls, _countof(icqCustomStatusControls), IsDlgButtonChecked(hwndDlg, IDC_XSTATUSENABLE) || IsDlgButtonChecked(hwndDlg, IDC_MOODSENABLE));
default:
OptDlgChanged(hwndDlg);
break;
@@ -454,8 +454,8 @@ static INT_PTR CALLBACK DlgProcIcqContactsOpts(HWND hwndDlg, UINT msg, WPARAM wP
LoadDBCheckState(ppro, hwndDlg, IDC_AUTOLOADAVATARS, "AvatarsAutoLoad", DEFAULT_LOAD_AVATARS);
LoadDBCheckState(ppro, hwndDlg, IDC_STRICTAVATARCHECK, "StrictAvatarCheck", DEFAULT_AVATARS_CHECK);
- icq_EnableMultipleControls(hwndDlg, icqContactsControls, SIZEOF(icqContactsControls), ppro->getByte("UseServerCList", DEFAULT_SS_ENABLED) ? TRUE : FALSE);
- icq_EnableMultipleControls(hwndDlg, icqAvatarControls, SIZEOF(icqAvatarControls), ppro->getByte("AvatarsEnabled", DEFAULT_AVATARS_ENABLED) ? TRUE : FALSE);
+ icq_EnableMultipleControls(hwndDlg, icqContactsControls, _countof(icqContactsControls), ppro->getByte("UseServerCList", DEFAULT_SS_ENABLED) ? TRUE : FALSE);
+ icq_EnableMultipleControls(hwndDlg, icqAvatarControls, _countof(icqAvatarControls), ppro->getByte("AvatarsEnabled", DEFAULT_AVATARS_ENABLED) ? TRUE : FALSE);
if (ppro->icqOnline()) {
ShowDlgItem(hwndDlg, IDC_OFFLINETOENABLE, SW_SHOW);
@@ -473,14 +473,14 @@ static INT_PTR CALLBACK DlgProcIcqContactsOpts(HWND hwndDlg, UINT msg, WPARAM wP
ppro->ShowUploadContactsDialog();
return TRUE;
case IDC_ENABLE:
- icq_EnableMultipleControls(hwndDlg, icqContactsControls, SIZEOF(icqContactsControls), IsDlgButtonChecked(hwndDlg, IDC_ENABLE));
+ icq_EnableMultipleControls(hwndDlg, icqContactsControls, _countof(icqContactsControls), IsDlgButtonChecked(hwndDlg, IDC_ENABLE));
if (ppro->icqOnline())
ShowDlgItem(hwndDlg, IDC_RECONNECTREQD, SW_SHOW);
else
EnableDlgItem(hwndDlg, IDC_UPLOADNOW, FALSE);
break;
case IDC_ENABLEAVATARS:
- icq_EnableMultipleControls(hwndDlg, icqAvatarControls, SIZEOF(icqAvatarControls), IsDlgButtonChecked(hwndDlg, IDC_ENABLEAVATARS));
+ icq_EnableMultipleControls(hwndDlg, icqAvatarControls, _countof(icqAvatarControls), IsDlgButtonChecked(hwndDlg, IDC_ENABLEAVATARS));
break;
}
OptDlgChanged(hwndDlg);
diff --git a/protocols/IcqOscarJ/src/icq_popups.cpp b/protocols/IcqOscarJ/src/icq_popups.cpp
index 7c74c31169..8d3239c095 100644
--- a/protocols/IcqOscarJ/src/icq_popups.cpp
+++ b/protocols/IcqOscarJ/src/icq_popups.cpp
@@ -76,11 +76,11 @@ INT_PTR CALLBACK DlgProcIcqPopupOpts(HWND hwndDlg, UINT msg, WPARAM wParam, LPAR
CheckDlgButton(hwndDlg, IDC_USEWINCOLORS, bEnabled ? BST_CHECKED : BST_UNCHECKED);
bEnabled |= ppro->getByte(NULL,"PopupsDefColors",DEFAULT_POPUPS_DEF_COLORS);
CheckDlgButton(hwndDlg, IDC_USEDEFCOLORS, bEnabled ? BST_CHECKED : BST_UNCHECKED);
- icq_EnableMultipleControls(hwndDlg, icqPopupColorControls, SIZEOF(icqPopupColorControls), bEnabled);
+ icq_EnableMultipleControls(hwndDlg, icqPopupColorControls, _countof(icqPopupColorControls), bEnabled);
CheckDlgButton(hwndDlg, IDC_USESYSICONS, ppro->getByte(NULL,"PopupsSysIcons",DEFAULT_POPUPS_SYS_ICONS) ? BST_CHECKED : BST_UNCHECKED);
bEnabled = ppro->getByte(NULL,"PopupsEnabled",DEFAULT_POPUPS_ENABLED);
CheckDlgButton(hwndDlg, IDC_POPUPS_ENABLED, bEnabled ? BST_CHECKED : BST_UNCHECKED);
- icq_EnableMultipleControls(hwndDlg, icqPopupsControls, SIZEOF(icqPopupsControls), bEnabled);
+ icq_EnableMultipleControls(hwndDlg, icqPopupsControls, _countof(icqPopupsControls), bEnabled);
if (bEnabled)
{
if (IsDlgButtonChecked(hwndDlg, IDC_USEDEFCOLORS))
@@ -94,7 +94,7 @@ INT_PTR CALLBACK DlgProcIcqPopupOpts(HWND hwndDlg, UINT msg, WPARAM wParam, LPAR
EnableWindow(GetDlgItem(hwndDlg, IDC_USEDEFCOLORS), !WM_ENABLE);
}
}
- icq_EnableMultipleControls(hwndDlg, icqPopupColorControls, SIZEOF(icqPopupColorControls), bEnabled & (BST_UNCHECKED == IsDlgButtonChecked(hwndDlg,IDC_USEWINCOLORS) && BST_UNCHECKED == IsDlgButtonChecked(hwndDlg,IDC_USEDEFCOLORS)));
+ icq_EnableMultipleControls(hwndDlg, icqPopupColorControls, _countof(icqPopupColorControls), bEnabled & (BST_UNCHECKED == IsDlgButtonChecked(hwndDlg,IDC_USEWINCOLORS) && BST_UNCHECKED == IsDlgButtonChecked(hwndDlg,IDC_USEDEFCOLORS)));
bInitDone = true;
return TRUE;
@@ -130,7 +130,7 @@ INT_PTR CALLBACK DlgProcIcqPopupOpts(HWND hwndDlg, UINT msg, WPARAM wParam, LPAR
EnableWindow(GetDlgItem(hwndDlg, IDC_USEWINCOLORS), !WM_ENABLE);
EnableWindow(GetDlgItem(hwndDlg, IDC_USEDEFCOLORS), !WM_ENABLE);
}
- icq_EnableMultipleControls(hwndDlg, icqPopupsControls, SIZEOF(icqPopupsControls), bEnabled);
+ icq_EnableMultipleControls(hwndDlg, icqPopupsControls, _countof(icqPopupsControls), bEnabled);
case IDC_USEWINCOLORS:
bEnabled = IsDlgButtonChecked(hwndDlg,IDC_POPUPS_ENABLED);
@@ -141,7 +141,7 @@ INT_PTR CALLBACK DlgProcIcqPopupOpts(HWND hwndDlg, UINT msg, WPARAM wParam, LPAR
else
EnableWindow(GetDlgItem(hwndDlg, IDC_USEDEFCOLORS), WM_ENABLE);
}
- icq_EnableMultipleControls(hwndDlg, icqPopupColorControls, SIZEOF(icqPopupColorControls), !IsDlgButtonChecked(hwndDlg,IDC_USEWINCOLORS));
+ icq_EnableMultipleControls(hwndDlg, icqPopupColorControls, _countof(icqPopupColorControls), !IsDlgButtonChecked(hwndDlg,IDC_USEWINCOLORS));
case IDC_USEDEFCOLORS:
bEnabled = IsDlgButtonChecked(hwndDlg,IDC_POPUPS_ENABLED);
@@ -152,7 +152,7 @@ INT_PTR CALLBACK DlgProcIcqPopupOpts(HWND hwndDlg, UINT msg, WPARAM wParam, LPAR
else
EnableWindow(GetDlgItem(hwndDlg, IDC_USEWINCOLORS), WM_ENABLE);
}
- icq_EnableMultipleControls(hwndDlg, icqPopupColorControls, SIZEOF(icqPopupColorControls), !IsDlgButtonChecked(hwndDlg,IDC_USEDEFCOLORS));
+ icq_EnableMultipleControls(hwndDlg, icqPopupColorControls, _countof(icqPopupColorControls), !IsDlgButtonChecked(hwndDlg,IDC_USEDEFCOLORS));
SendMessage(GetParent(hwndDlg), PSM_CHANGED, 0, 0);
break;
case IDC_POPUP_LOG0_TIMEOUT:
diff --git a/protocols/IcqOscarJ/src/icq_proto.cpp b/protocols/IcqOscarJ/src/icq_proto.cpp
index 7b672381ea..f420108707 100644
--- a/protocols/IcqOscarJ/src/icq_proto.cpp
+++ b/protocols/IcqOscarJ/src/icq_proto.cpp
@@ -172,7 +172,7 @@ CIcqProto::CIcqProto(const char* aProtoName, const TCHAR* aUserName) :
m_hNetlibUser = (HANDLE)CallService(MS_NETLIB_REGISTERUSER, 0, (LPARAM)&nlu);
char szP2PModuleName[MAX_PATH];
- mir_snprintf(szP2PModuleName, SIZEOF(szP2PModuleName), "%sP2P", m_szModuleName);
+ mir_snprintf(szP2PModuleName, _countof(szP2PModuleName), "%sP2P", m_szModuleName);
mir_sntprintf(szBuffer, TranslateT("%s client-to-client connections"), m_tszUserName);
nlu.flags = NUF_OUTGOING | NUF_INCOMING | NUF_TCHAR;
nlu.ptszDescriptiveName = szBuffer;
@@ -241,9 +241,9 @@ int CIcqProto::OnModulesLoaded(WPARAM, LPARAM)
char pszSrvGroupsName[MAX_PATH];
char* modules[5] = { 0, 0, 0, 0, 0 };
- mir_snprintf(pszP2PName, SIZEOF(pszP2PName), "%sP2P", m_szModuleName);
- mir_snprintf(pszGroupsName, SIZEOF(pszGroupsName), "%sGroups", m_szModuleName);
- mir_snprintf(pszSrvGroupsName, SIZEOF(pszSrvGroupsName), "%sSrvGroups", m_szModuleName);
+ mir_snprintf(pszP2PName, _countof(pszP2PName), "%sP2P", m_szModuleName);
+ mir_snprintf(pszGroupsName, _countof(pszGroupsName), "%sGroups", m_szModuleName);
+ mir_snprintf(pszSrvGroupsName, _countof(pszSrvGroupsName), "%sSrvGroups", m_szModuleName);
modules[0] = m_szModuleName;
modules[1] = pszP2PName;
modules[2] = pszGroupsName;
@@ -1215,7 +1215,7 @@ HANDLE __cdecl CIcqProto::SendFile(MCONTACT hContact, const TCHAR* szDescription
}
else {
char tmp[64];
- mir_snprintf(szFiles, SIZEOF(szFiles), ICQTranslateUtfStatic("%d Files", tmp, SIZEOF(tmp)), ft->dwFileCount);
+ mir_snprintf(szFiles, _countof(szFiles), ICQTranslateUtfStatic("%d Files", tmp, _countof(tmp)), ft->dwFileCount);
pszFiles = szFiles;
}
@@ -1857,11 +1857,11 @@ int __cdecl CIcqProto::OnEvent(PROTOEVENTTYPE eventType, WPARAM wParam, LPARAM l
case EV_PROTO_ONERASE:
{
char szDbSetting[MAX_PATH];
- mir_snprintf(szDbSetting, SIZEOF(szDbSetting), "%sP2P", m_szModuleName);
+ mir_snprintf(szDbSetting, _countof(szDbSetting), "%sP2P", m_szModuleName);
CallService(MS_DB_MODULE_DELETE, 0, (LPARAM)szDbSetting);
- mir_snprintf(szDbSetting, SIZEOF(szDbSetting), "%sSrvGroups", m_szModuleName);
+ mir_snprintf(szDbSetting, _countof(szDbSetting), "%sSrvGroups", m_szModuleName);
CallService(MS_DB_MODULE_DELETE, 0, (LPARAM)szDbSetting);
- mir_snprintf(szDbSetting, SIZEOF(szDbSetting), "%sGroups", m_szModuleName);
+ mir_snprintf(szDbSetting, _countof(szDbSetting), "%sGroups", m_szModuleName);
CallService(MS_DB_MODULE_DELETE, 0, (LPARAM)szDbSetting);
}
break;
diff --git a/protocols/IcqOscarJ/src/icq_servlist.cpp b/protocols/IcqOscarJ/src/icq_servlist.cpp
index a361615d41..3b7745d7d0 100644
--- a/protocols/IcqOscarJ/src/icq_servlist.cpp
+++ b/protocols/IcqOscarJ/src/icq_servlist.cpp
@@ -850,7 +850,7 @@ void CIcqProto::LoadServerIDs()
int nStart = nServerIDListCount;
char szModule[MAX_PATH];
- mir_snprintf(szModule, SIZEOF(szModule), "%sSrvGroups", m_szModuleName);
+ mir_snprintf(szModule, _countof(szModule), "%sSrvGroups", m_szModuleName);
GroupReserveIdsEnumParam param = { this, szModule };
DBCONTACTENUMSETTINGS dbces = { 0 };
@@ -1178,7 +1178,7 @@ int CIcqProto::IsServerGroupsDefined()
char szModule[MAX_PATH];
// flush obsolete linking data
- mir_snprintf(szModule, SIZEOF(szModule), "%sGroups", m_szModuleName);
+ mir_snprintf(szModule, _countof(szModule), "%sGroups", m_szModuleName);
CallService(MS_DB_MODULE_DELETE, 0, (LPARAM)szModule);
iRes = 0; // no groups defined, or older version
@@ -1193,7 +1193,7 @@ void CIcqProto::FlushSrvGroupsCache()
{
char szModule[MAX_PATH];
- mir_snprintf(szModule, SIZEOF(szModule), "%sSrvGroups", m_szModuleName);
+ mir_snprintf(szModule, _countof(szModule), "%sSrvGroups", m_szModuleName);
CallService(MS_DB_MODULE_DELETE, 0, (LPARAM)szModule);
}
@@ -1273,7 +1273,7 @@ void CIcqProto::removeGroupPathLinks(WORD wGroupID)
char szModule[MAX_PATH];
char* pars[3];
- mir_snprintf(szModule, SIZEOF(szModule), "%sGroups", m_szModuleName);
+ mir_snprintf(szModule, _countof(szModule), "%sGroups", m_szModuleName);
pars[0] = NULL;
pars[1] = (char*)wGroupID;
@@ -1308,7 +1308,7 @@ char* CIcqProto::getServListGroupName(WORD wGroupID)
return NULL;
}
- mir_snprintf(szModule, SIZEOF(szModule), "%sSrvGroups", m_szModuleName);
+ mir_snprintf(szModule, _countof(szModule), "%sSrvGroups", m_szModuleName);
_itoa(wGroupID, szGroup, 0x10);
if (!CheckServerID(wGroupID, 0)) { // check if valid id, if not give empty and remove
@@ -1330,7 +1330,7 @@ void CIcqProto::setServListGroupName(WORD wGroupID, const char *szGroupName)
return;
}
- mir_snprintf(szModule, SIZEOF(szModule), "%sSrvGroups", m_szModuleName);
+ mir_snprintf(szModule, _countof(szModule), "%sSrvGroups", m_szModuleName);
_itoa(wGroupID, szGroup, 0x10);
if (szGroupName)
@@ -1344,7 +1344,7 @@ void CIcqProto::setServListGroupName(WORD wGroupID, const char *szGroupName)
WORD CIcqProto::getServListGroupLinkID(const char *szPath)
{
char szModule[MAX_PATH];
- mir_snprintf(szModule, SIZEOF(szModule), "%sGroups", m_szModuleName);
+ mir_snprintf(szModule, _countof(szModule), "%sGroups", m_szModuleName);
WORD wGroupId = db_get_w(NULL, szModule, szPath, 0);
@@ -1360,7 +1360,7 @@ WORD CIcqProto::getServListGroupLinkID(const char *szPath)
void CIcqProto::setServListGroupLinkID(const char *szPath, WORD wGroupID)
{
char szModule[MAX_PATH];
- mir_snprintf(szModule, SIZEOF(szModule), "%sGroups", m_szModuleName);
+ mir_snprintf(szModule, _countof(szModule), "%sGroups", m_szModuleName);
if (wGroupID)
db_set_w(NULL, szModule, szPath, wGroupID);
@@ -1530,7 +1530,7 @@ char* CIcqProto::getServListUniqueGroupName(const char *szGroupName, int bAlloce
szGroupNameBase = null_strdup(szGroupName);
null_strcut(szGroupNameBase, m_wServerListRecordNameMaxLength);
- mir_snprintf(szModule, SIZEOF(szModule), "%sSrvGroups", m_szModuleName);
+ mir_snprintf(szModule, _countof(szModule), "%sSrvGroups", m_szModuleName);
do {
pars[0] = (char*)this;
diff --git a/protocols/IcqOscarJ/src/icq_uploadui.cpp b/protocols/IcqOscarJ/src/icq_uploadui.cpp
index d99f10f2bc..edb1b0075d 100644
--- a/protocols/IcqOscarJ/src/icq_uploadui.cpp
+++ b/protocols/IcqOscarJ/src/icq_uploadui.cpp
@@ -155,7 +155,7 @@ static int GroupEnumIdsEnumProc(const char *szSetting,LPARAM lParam)
static void enumServerGroups(CIcqProto* ppro)
{
char szModule[MAX_PATH+9];
- mir_snprintf(szModule, SIZEOF(szModule), "%s%s", ppro->m_szModuleName, "SrvGroups");
+ mir_snprintf(szModule, _countof(szModule), "%s%s", ppro->m_szModuleName, "SrvGroups");
DBCONTACTENUMSETTINGS dbces = { 0 };
dbces.pfnEnumProc = &GroupEnumIdsEnumProc;
@@ -809,7 +809,7 @@ static INT_PTR CALLBACK DlgProcUploadList(HWND hwndDlg, UINT message, WPARAM wPa
hCurrentContact = NULL;
currentState = STATE_REGROUP;
currentAction = ACTION_NONE;
- icq_ShowMultipleControls(hwndDlg, settingsControls, SIZEOF(settingsControls), SW_HIDE);
+ icq_ShowMultipleControls(hwndDlg, settingsControls, _countof(settingsControls), SW_HIDE);
// SendDlgItemMessage(hwndDlg, IDC_CLIST, CLM_SETGREYOUTFLAGS, 0xFFFFFFFF, 0);
// InvalidateRect(GetDlgItem(hwndDlg, IDC_CLIST), NULL, FALSE);
EnableDlgItem(hwndDlg, IDC_CLIST, FALSE);
diff --git a/protocols/IcqOscarJ/src/icq_xstatus.cpp b/protocols/IcqOscarJ/src/icq_xstatus.cpp
index 0e040ddb91..d9d87ad116 100644
--- a/protocols/IcqOscarJ/src/icq_xstatus.cpp
+++ b/protocols/IcqOscarJ/src/icq_xstatus.cpp
@@ -418,7 +418,7 @@ void CIcqProto::handleXStatusCaps(DWORD dwUIN, char *szUID, MCONTACT hContact, B
null_strcpy(szMoodData, moods, moodsize);
if (moodXStatus[i] == -1) continue;
- mir_snprintf(szMoodId, SIZEOF(szMoodId), "0icqmood%d", moodXStatus[i]);
+ mir_snprintf(szMoodId, _countof(szMoodId), "0icqmood%d", moodXStatus[i]);
if (!mir_strcmp(szMoodId, szMoodData)) {
BYTE bXStatusId = (BYTE)(i+1);
char str[MAX_PATH];
@@ -510,7 +510,7 @@ void CIcqProto::updateServerCustomStatus(int fullUpdate)
// prepare mood id
if (m_bMoodsEnabled && bXStatus && moodXStatus[bXStatus-1] != -1)
- mir_snprintf(szMoodData, SIZEOF(szMoodData), "0icqmood%d", moodXStatus[bXStatus-1]);
+ mir_snprintf(szMoodData, _countof(szMoodData), "0icqmood%d", moodXStatus[bXStatus-1]);
else
szMoodData[0] = '\0';
@@ -717,7 +717,7 @@ static INT_PTR CALLBACK SetXStatusDlgProc(HWND hwndDlg,UINT message,WPARAM wPara
break;
}
- mir_snprintf(str,SIZEOF(str),dat->okButtonFormat,dat->countdown);
+ mir_snprintf(str,_countof(str),dat->okButtonFormat,dat->countdown);
SetDlgItemTextUtf(hwndDlg,IDOK,str);
dat->countdown--;
break;
@@ -857,7 +857,7 @@ void CIcqProto::InitXStatusItems(BOOL bAllowStatus)
if (m_bHideXStatusUI || m_bHideXStatusMenu)
return;
- mir_snprintf(szItem, SIZEOF(szItem), Translate("%s Custom Status"), m_szModuleName);
+ mir_snprintf(szItem, _countof(szItem), Translate("%s Custom Status"), m_szModuleName);
CLISTMENUITEM mi = { sizeof(mi) };
mi.pszPopupName = szItem;
@@ -865,7 +865,7 @@ void CIcqProto::InitXStatusItems(BOOL bAllowStatus)
mi.position = 2000040000;
for (int i = 0; i <= XSTATUS_COUNT; i++) {
- mir_snprintf(srvFce, SIZEOF(srvFce), "%s/menuXStatus%d", m_szModuleName, i);
+ mir_snprintf(srvFce, _countof(srvFce), "%s/menuXStatus%d", m_szModuleName, i);
mi.position++;
@@ -893,7 +893,7 @@ void InitXStatusIcons()
SKINICONDESC sid = { 0 };
sid.section.a = "Protocols/" ICQ_PROTOCOL_NAME "/"LPGEN("Custom Status");
sid.flags = SIDF_PATH_TCHAR;
- sid.defaultFile.t = InitXStatusIconLibrary(lib, SIZEOF(lib));
+ sid.defaultFile.t = InitXStatusIconLibrary(lib, _countof(lib));
for (int i = 0; i < XSTATUS_COUNT; i++) {
char szTemp[100];
diff --git a/protocols/IcqOscarJ/src/icqosc_svcs.cpp b/protocols/IcqOscarJ/src/icqosc_svcs.cpp
index 6d4b130956..268904a0a1 100644
--- a/protocols/IcqOscarJ/src/icqosc_svcs.cpp
+++ b/protocols/IcqOscarJ/src/icqosc_svcs.cpp
@@ -352,7 +352,7 @@ INT_PTR CIcqProto::GetAvatarInfo(WPARAM wParam, LPARAM lParam)
GetFullAvatarFileName(dwUIN, szUID, dwPaFormat, tszFile, MAX_PATH * 2);
- mir_tstrncpy(pai->filename, tszFile, SIZEOF(pai->filename)); // Avatar API does not support unicode :-(
+ mir_tstrncpy(pai->filename, tszFile, _countof(pai->filename)); // Avatar API does not support unicode :-(
pai->format = dwPaFormat;
if (!IsAvatarChanged(pai->hContact, dbv.pbVal, dbv.cpbVal)) { // hashes are the same
@@ -370,7 +370,7 @@ INT_PTR CIcqProto::GetAvatarInfo(WPARAM wParam, LPARAM lParam)
GetAvatarFileName(dwUIN, szUID, tszFile, MAX_PATH * 2);
GetAvatarData(pai->hContact, dwUIN, szUID, dbv.pbVal, dbv.cpbVal, tszFile);
- mir_tstrncpy(pai->filename, tszFile, SIZEOF(pai->filename)); // Avatar API does not support unicode :-(
+ mir_tstrncpy(pai->filename, tszFile, _countof(pai->filename)); // Avatar API does not support unicode :-(
db_free(&dbv);
diff --git a/protocols/IcqOscarJ/src/log.cpp b/protocols/IcqOscarJ/src/log.cpp
index cd3b3297de..644fef9e5c 100644
--- a/protocols/IcqOscarJ/src/log.cpp
+++ b/protocols/IcqOscarJ/src/log.cpp
@@ -119,14 +119,14 @@ void CIcqProto::icq_LogUsingErrorCode(int level, DWORD dwError, const char *szMs
default:
TCHAR err[512];
- if (FormatMessage(FORMAT_MESSAGE_FROM_SYSTEM, NULL, dwError, 0, err, SIZEOF(err), NULL)) {
+ if (FormatMessage(FORMAT_MESSAGE_FROM_SYSTEM, NULL, dwError, 0, err, _countof(err), NULL)) {
pszErrorMsg = make_utf8_string(err);
bNeedFree = TRUE;
}
break;
}
- mir_snprintf(szBuf, SIZEOF(szBuf), "%s%s%s (%s %d)",
+ mir_snprintf(szBuf, _countof(szBuf), "%s%s%s (%s %d)",
szMsg ? ICQTranslateUtfStatic(szMsg, str, 1024) : "",
szMsg ? "\r\n\r\n" : "",
ICQTranslateUtfStatic(pszErrorMsg, szErrorMsg, 512),
@@ -144,6 +144,6 @@ void CIcqProto::icq_LogFatalParam(const char *szMsg, WORD wError)
char str[MAX_PATH];
char buf[MAX_PATH];
- mir_snprintf(buf, ICQTranslateUtfStatic(szMsg, str, SIZEOF(str)), wError);
+ mir_snprintf(buf, ICQTranslateUtfStatic(szMsg, str, _countof(str)), wError);
icq_LogMessage(LOG_FATAL, buf);
}
diff --git a/protocols/IcqOscarJ/src/loginpassword.cpp b/protocols/IcqOscarJ/src/loginpassword.cpp
index c7a448b11f..2b19ad07eb 100644
--- a/protocols/IcqOscarJ/src/loginpassword.cpp
+++ b/protocols/IcqOscarJ/src/loginpassword.cpp
@@ -42,7 +42,7 @@ INT_PTR CALLBACK LoginPasswdDlgProc(HWND hwndDlg, UINT msg, WPARAM wParam, LPARA
DWORD dwUin = ppro->getContactUin(NULL);
TCHAR pszUIN[MAX_PATH];
- mir_sntprintf(pszUIN, SIZEOF(pszUIN), TranslateT("Enter a password for UIN %u:"), dwUin);
+ mir_sntprintf(pszUIN, _countof(pszUIN), TranslateT("Enter a password for UIN %u:"), dwUin);
SetDlgItemText(hwndDlg, IDC_INSTRUCTION, pszUIN);
SendDlgItemMessage(hwndDlg, IDC_LOGINPW, EM_LIMITTEXT, PASSWORDMAXLEN - 1, 0);
@@ -66,7 +66,7 @@ INT_PTR CALLBACK LoginPasswdDlgProc(HWND hwndDlg, UINT msg, WPARAM wParam, LPARA
ppro->m_bRememberPwd = (BYTE)IsDlgButtonChecked(hwndDlg, IDC_SAVEPASS);
ppro->setByte("RememberPass", ppro->m_bRememberPwd);
- GetDlgItemTextA(hwndDlg, IDC_LOGINPW, ppro->m_szPassword, SIZEOF(ppro->m_szPassword));
+ GetDlgItemTextA(hwndDlg, IDC_LOGINPW, ppro->m_szPassword, _countof(ppro->m_szPassword));
ppro->icq_login(ppro->m_szPassword);
diff --git a/protocols/IcqOscarJ/src/oscar_filetransfer.cpp b/protocols/IcqOscarJ/src/oscar_filetransfer.cpp
index cb070ec4bd..d378d71dba 100644
--- a/protocols/IcqOscarJ/src/oscar_filetransfer.cpp
+++ b/protocols/IcqOscarJ/src/oscar_filetransfer.cpp
@@ -474,7 +474,7 @@ void CIcqProto::handleRecvServMsgOFT(BYTE *buf, size_t wLen, DWORD dwUin, char *
pszFileName = (char*)_alloca(64);
char tmp[64];
- mir_snprintf(pszFileName, 64, ICQTranslateUtfStatic(LPGEN("%d Files"), tmp, SIZEOF(tmp)), ft->wFilesCount);
+ mir_snprintf(pszFileName, 64, ICQTranslateUtfStatic(LPGEN("%d Files"), tmp, _countof(tmp)), ft->wFilesCount);
}
}
// Total Size TLV (ICQ 6 and AIM 6)
@@ -1586,7 +1586,7 @@ int CIcqProto::oft_handleFileData(oscar_connection *oc, BYTE *buf, size_t len)
char *pszMsg = ICQTranslateUtf(LPGEN("The checksum of file \"%s\" does not match, the file is probably damaged."));
char szBuf[MAX_PATH];
- mir_snprintf(szBuf, SIZEOF(szBuf), pszMsg, ExtractFileName(ft->szThisFile));
+ mir_snprintf(szBuf, _countof(szBuf), pszMsg, ExtractFileName(ft->szThisFile));
icq_LogMessage(LOG_ERROR, szBuf);
SAFE_FREE(&pszMsg);
diff --git a/protocols/IcqOscarJ/src/userinfotab.cpp b/protocols/IcqOscarJ/src/userinfotab.cpp
index b286579faf..1b475a068b 100644
--- a/protocols/IcqOscarJ/src/userinfotab.cpp
+++ b/protocols/IcqOscarJ/src/userinfotab.cpp
@@ -97,7 +97,7 @@ static void SetValue(CIcqProto* ppro, HWND hwndDlg, int idCtrl, MCONTACT hContac
pstr = str;
if (hContact && ppro->IsDirectConnectionOpen(hContact, DIRECTCONN_STANDARD, 1)) {
- ICQTranslateUtfStatic(LPGEN(" (DC Established)"), szExtra, SIZEOF(szExtra));
+ ICQTranslateUtfStatic(LPGEN(" (DC Established)"), szExtra, _countof(szExtra));
mir_strcat(str, (char*)szExtra);
bUtf = 1;
}
diff --git a/protocols/JabberG/src/jabber.cpp b/protocols/JabberG/src/jabber.cpp
index 697dcfa3da..a78d4512ef 100644
--- a/protocols/JabberG/src/jabber.cpp
+++ b/protocols/JabberG/src/jabber.cpp
@@ -136,7 +136,7 @@ static int OnModulesLoaded(WPARAM, LPARAM)
fontid.deffontsettings.charset = DEFAULT_CHARSET;
fontid.deffontsettings.colour = GetSysColor(COLOR_WINDOWTEXT);
fontid.deffontsettings.size = -11;
- mir_tstrncpy(fontid.deffontsettings.szFace, _T("MS Shell Dlg"), SIZEOF(fontid.deffontsettings.szFace));
+ mir_tstrncpy(fontid.deffontsettings.szFace, _T("MS Shell Dlg"), _countof(fontid.deffontsettings.szFace));
fontid.deffontsettings.style = 0;
_tcsncpy_s(fontid.name, LPGENT("Frame title"), _TRUNCATE);
@@ -196,7 +196,7 @@ extern "C" int __declspec(dllexport) Load()
WORD v[4];
CallService(MS_SYSTEM_GETFILEVERSION, 0, (LPARAM)v);
- mir_sntprintf(szCoreVersion, SIZEOF(szCoreVersion), _T("%d.%d.%d.%d"), v[0], v[1], v[2], v[3]);
+ mir_sntprintf(szCoreVersion, _countof(szCoreVersion), _T("%d.%d.%d.%d"), v[0], v[1], v[2], v[3]);
CallService(MS_UTILS_GETCOUNTRYLIST, (WPARAM)&g_cbCountries, (LPARAM)&g_countries);
diff --git a/protocols/JabberG/src/jabber_adhoc.cpp b/protocols/JabberG/src/jabber_adhoc.cpp
index 723b45a43a..348f7cabf5 100644
--- a/protocols/JabberG/src/jabber_adhoc.cpp
+++ b/protocols/JabberG/src/jabber_adhoc.cpp
@@ -385,7 +385,7 @@ static INT_PTR CALLBACK JabberAdHoc_CommandDlgProc(HWND hwndDlg, UINT msg, WPARA
dat->proto->AdHoc_RequestListOfCommands(pStartupParams->m_szJid, hwndDlg);
TCHAR Caption[512];
- mir_sntprintf(Caption, SIZEOF(Caption), TranslateT("Jabber Ad-Hoc commands at %s"), dat->ResponderJID);
+ mir_sntprintf(Caption, _countof(Caption), TranslateT("Jabber Ad-Hoc commands at %s"), dat->ResponderJID);
SetWindowText(hwndDlg, Caption);
}
else {
@@ -398,7 +398,7 @@ static INT_PTR CALLBACK JabberAdHoc_CommandDlgProc(HWND hwndDlg, UINT msg, WPARA
SetDlgItemText(hwndDlg, IDC_SUBMIT, TranslateT("OK"));
TCHAR Caption[512];
- mir_sntprintf(Caption, SIZEOF(Caption), TranslateT("Sending Ad-Hoc command to %s"), dat->ResponderJID);
+ mir_sntprintf(Caption, _countof(Caption), TranslateT("Sending Ad-Hoc command to %s"), dat->ResponderJID);
SetWindowText(hwndDlg, Caption);
}
@@ -541,8 +541,8 @@ int __cdecl CJabberProto::ContactMenuRunCommands(WPARAM hContact, LPARAM lParam)
if (selected > 0) {
JABBER_RESOURCE_STATUS *r = item->arResources[selected - 1];
if (r) {
- mir_tstrncat(jid, _T("/"), SIZEOF(jid) - mir_tstrlen(jid));
- mir_tstrncat(jid, r->m_tszResourceName, SIZEOF(jid) - mir_tstrlen(jid));
+ mir_tstrncat(jid, _T("/"), _countof(jid) - mir_tstrlen(jid));
+ mir_tstrncat(jid, r->m_tszResourceName, _countof(jid) - mir_tstrlen(jid));
}
selected = 1;
}
diff --git a/protocols/JabberG/src/jabber_archive.cpp b/protocols/JabberG/src/jabber_archive.cpp
index 21e686c742..f12dbd5c4b 100644
--- a/protocols/JabberG/src/jabber_archive.cpp
+++ b/protocols/JabberG/src/jabber_archive.cpp
@@ -45,7 +45,7 @@ void CJabberProto::RetrieveMessageArchive(MCONTACT hContact, JABBER_LIST_ITEM *p
time_t tmLast = getDword(hContact, "LastCollection", 0);
if (tmLast) {
TCHAR buf[40];
- list << XATTR(_T("start"), time2str(tmLast, buf, SIZEOF(buf)));
+ list << XATTR(_T("start"), time2str(tmLast, buf, _countof(buf)));
}
m_ThreadInfo->send(iq);
}
diff --git a/protocols/JabberG/src/jabber_bookmarks.cpp b/protocols/JabberG/src/jabber_bookmarks.cpp
index 6a75105d87..bc33468517 100644
--- a/protocols/JabberG/src/jabber_bookmarks.cpp
+++ b/protocols/JabberG/src/jabber_bookmarks.cpp
@@ -104,12 +104,12 @@ static INT_PTR CALLBACK JabberAddBookmarkDlgProc(HWND hwndDlg, UINT msg, WPARAM
switch (LOWORD(wParam)) {
case IDC_ROOM_JID:
if ((HWND)lParam==GetFocus() && HIWORD(wParam)==EN_CHANGE)
- EnableWindow(GetDlgItem(hwndDlg, IDOK), GetDlgItemText(hwndDlg, IDC_ROOM_JID, text, SIZEOF(text)));
+ EnableWindow(GetDlgItem(hwndDlg, IDOK), GetDlgItemText(hwndDlg, IDC_ROOM_JID, text, _countof(text)));
break;
case IDOK:
{
- GetDlgItemText(hwndDlg, IDC_ROOM_JID, text, SIZEOF(text));
+ GetDlgItemText(hwndDlg, IDC_ROOM_JID, text, _countof(text));
TCHAR *roomJID = NEWTSTR_ALLOCA(text);
if (param->m_item)
@@ -122,13 +122,13 @@ static INT_PTR CALLBACK JabberAddBookmarkDlgProc(HWND hwndDlg, UINT msg, WPARAM
else
replaceStrT(item->type, _T("conference"));
- GetDlgItemText(hwndDlg, IDC_NICK, text, SIZEOF(text));
+ GetDlgItemText(hwndDlg, IDC_NICK, text, _countof(text));
replaceStrT(item->nick, text);
- GetDlgItemText(hwndDlg, IDC_PASSWORD, text, SIZEOF(text));
+ GetDlgItemText(hwndDlg, IDC_PASSWORD, text, _countof(text));
replaceStrT(item->password, text);
- GetDlgItemText(hwndDlg, IDC_NAME, text, SIZEOF(text));
+ GetDlgItemText(hwndDlg, IDC_NAME, text, _countof(text));
replaceStrT(item->name, (text[0] == 0) ? roomJID : text);
item->bAutoJoin = (IsDlgButtonChecked(hwndDlg, IDC_CHECK_BM_AUTOJOIN) == BST_CHECKED);
diff --git a/protocols/JabberG/src/jabber_byte.cpp b/protocols/JabberG/src/jabber_byte.cpp
index 914a528824..fcde4046de 100644
--- a/protocols/JabberG/src/jabber_byte.cpp
+++ b/protocols/JabberG/src/jabber_byte.cpp
@@ -94,7 +94,7 @@ void JabberByteSendConnection(HANDLE hConn, DWORD /*dwRemoteIP*/, void* extra)
NETLIBCONNINFO connInfo = { sizeof(connInfo) };
CallService(MS_NETLIB_GETCONNECTIONINFO, (WPARAM)hConn, (LPARAM)&connInfo);
- mir_sntprintf(szPort, SIZEOF(szPort), _T("%u"), connInfo.wPort);
+ mir_sntprintf(szPort, _countof(szPort), _T("%u"), connInfo.wPort);
ppro->debugLogA("bytestream_send_connection incoming connection accepted: %s", connInfo.szIpPort);
if ((item = ppro->ListGetItemPtr(LIST_BYTE, szPort)) == NULL) {
@@ -208,7 +208,7 @@ void CJabberProto::ByteSendThread(JABBER_BYTE_TRANSFER *jbt)
if (localAddr == NULL)
localAddr = (char*)CallService(MS_NETLIB_ADDRESSTOSTRING, 1, nlb.dwExternalIP);
- mir_sntprintf(szPort, SIZEOF(szPort), _T("%d"), nlb.wPort);
+ mir_sntprintf(szPort, _countof(szPort), _T("%d"), nlb.wPort);
JABBER_LIST_ITEM *item = ListAdd(LIST_BYTE, szPort);
item->jbt = jbt;
hEvent = CreateEvent(NULL, FALSE, FALSE, NULL);
@@ -406,7 +406,7 @@ void CJabberProto::IqResultStreamActivate(HXML iqNode, CJabberIqInfo*)
int id = JabberGetPacketID(iqNode);
TCHAR listJid[JABBER_MAX_JID_LEN];
- mir_sntprintf(listJid, SIZEOF(listJid), _T("ftproxy_%d"), id);
+ mir_sntprintf(listJid, _countof(listJid), _T("ftproxy_%d"), id);
JABBER_LIST_ITEM *item = ListGetItemPtr(LIST_FTIQID, listJid);
if (item == NULL)
@@ -555,7 +555,7 @@ int CJabberProto::ByteSendProxyParse(HANDLE hConn, JABBER_BYTE_TRANSFER *jbt, ch
int iqId = SerialNext();
TCHAR listJid[256];
- mir_sntprintf(listJid, SIZEOF(listJid), _T("ftproxy_%d"), iqId);
+ mir_sntprintf(listJid, _countof(listJid), _T("ftproxy_%d"), iqId);
JABBER_LIST_ITEM *item = ListAdd(LIST_FTIQID, listJid);
item->jbt = jbt;
diff --git a/protocols/JabberG/src/jabber_caps.cpp b/protocols/JabberG/src/jabber_caps.cpp
index a68814d7cf..6b0581032a 100644
--- a/protocols/JabberG/src/jabber_caps.cpp
+++ b/protocols/JabberG/src/jabber_caps.cpp
@@ -183,7 +183,7 @@ JabberCapsBits CJabberProto::GetTotalJidCapabilites(const TCHAR *jid)
return JABBER_RESOURCE_CAPS_NONE;
TCHAR szBareJid[JABBER_MAX_JID_LEN];
- JabberStripJid(jid, szBareJid, SIZEOF(szBareJid));
+ JabberStripJid(jid, szBareJid, _countof(szBareJid));
JABBER_LIST_ITEM *item = ListGetItemPtr(LIST_ROSTER, szBareJid);
if (item == NULL)
@@ -201,7 +201,7 @@ JabberCapsBits CJabberProto::GetTotalJidCapabilites(const TCHAR *jid)
if (item) {
for (int i = 0; i < item->arResources.getCount(); i++) {
TCHAR szFullJid[JABBER_MAX_JID_LEN];
- mir_sntprintf(szFullJid, SIZEOF(szFullJid), _T("%s/%s"), szBareJid, item->arResources[i]->m_tszResourceName);
+ mir_sntprintf(szFullJid, _countof(szFullJid), _T("%s/%s"), szBareJid, item->arResources[i]->m_tszResourceName);
JabberCapsBits jcb = GetResourceCapabilites(szFullJid, FALSE);
if (!(jcb & JABBER_RESOURCE_CAPS_ERROR))
jcbToReturn |= jcb;
@@ -214,7 +214,7 @@ JabberCapsBits CJabberProto::GetResourceCapabilites(const TCHAR *jid, BOOL appen
{
TCHAR fullJid[JABBER_MAX_JID_LEN];
if (appendBestResource)
- GetClientJID(jid, fullJid, SIZEOF(fullJid));
+ GetClientJID(jid, fullJid, _countof(fullJid));
else
_tcsncpy_s(fullJid, jid, _TRUNCATE);
@@ -240,7 +240,7 @@ JabberCapsBits CJabberProto::GetResourceCapabilites(const TCHAR *jid, BOOL appen
r->m_dwDiscoInfoRequestTime = pInfo->GetRequestTime();
TCHAR queryNode[512];
- mir_sntprintf(queryNode, SIZEOF(queryNode), _T("%s#%s"), r->m_tszCapsNode, r->m_tszCapsVer);
+ mir_sntprintf(queryNode, _countof(queryNode), _T("%s#%s"), r->m_tszCapsNode, r->m_tszCapsVer);
m_ThreadInfo->send(XmlNodeIq(pInfo) << XQUERY(JABBER_FEAT_DISCO_INFO) << XATTR(_T("node"), queryNode));
bRequestSent = TRUE;
@@ -615,7 +615,7 @@ BOOL CJabberClientCapsManager::HandleInfoRequest(HXML, CJabberIqInfo *pInfo, con
continue;
TCHAR szExtCap[ 512 ];
- mir_sntprintf(szExtCap, SIZEOF(szExtCap), _T("%s#%s"), JABBER_CAPS_MIRANDA_NODE, g_JabberFeatCapPairsExt[i].szFeature);
+ mir_sntprintf(szExtCap, _countof(szExtCap), _T("%s#%s"), JABBER_CAPS_MIRANDA_NODE, g_JabberFeatCapPairsExt[i].szFeature);
if (!mir_tstrcmp(szNode, szExtCap)) {
jcb = g_JabberFeatCapPairsExt[i].jcbCap;
break;
@@ -625,7 +625,7 @@ BOOL CJabberClientCapsManager::HandleInfoRequest(HXML, CJabberIqInfo *pInfo, con
// check features registered through IJabberNetInterface::RegisterFeature() and IJabberNetInterface::AddFeatures()
for (i=0; i < ppro->m_lstJabberFeatCapPairsDynamic.getCount(); i++) {
TCHAR szExtCap[ 512 ];
- mir_sntprintf(szExtCap, SIZEOF(szExtCap), _T("%s#%s"), JABBER_CAPS_MIRANDA_NODE, ppro->m_lstJabberFeatCapPairsDynamic[i]->szExt);
+ mir_sntprintf(szExtCap, _countof(szExtCap), _T("%s#%s"), JABBER_CAPS_MIRANDA_NODE, ppro->m_lstJabberFeatCapPairsDynamic[i]->szExt);
if (!mir_tstrcmp(szNode, szExtCap)) {
jcb = ppro->m_lstJabberFeatCapPairsDynamic[i]->jcbCap;
break;
@@ -667,8 +667,8 @@ BOOL CJabberClientCapsManager::HandleInfoRequest(HXML, CJabberIqInfo *pInfo, con
TCHAR *os = szOsBuffer;
if (ppro->m_options.ShowOSVersion) {
- if (!GetOSDisplayString(szOsBuffer, SIZEOF(szOsBuffer)))
- mir_tstrncpy(szOsBuffer, _T(""), SIZEOF(szOsBuffer));
+ if (!GetOSDisplayString(szOsBuffer, _countof(szOsBuffer)))
+ mir_tstrncpy(szOsBuffer, _T(""), _countof(szOsBuffer));
else {
TCHAR *szOsWindows = _T("Microsoft Windows");
size_t nOsWindowsLength = mir_tstrlen(szOsWindows);
diff --git a/protocols/JabberG/src/jabber_captcha.cpp b/protocols/JabberG/src/jabber_captcha.cpp
index 4e9bcc331c..c923fee4a1 100644
--- a/protocols/JabberG/src/jabber_captcha.cpp
+++ b/protocols/JabberG/src/jabber_captcha.cpp
@@ -93,7 +93,7 @@ INT_PTR CALLBACK JabberCaptchaFormDlgProc(HWND hwndDlg, UINT msg, WPARAM wParam,
return TRUE;
case IDC_SUBMIT:
- GetDlgItemText(hwndDlg, IDC_VALUE, params->Result, SIZEOF(params->Result));
+ GetDlgItemText(hwndDlg, IDC_VALUE, params->Result, _countof(params->Result));
EndDialog(hwndDlg, 1);
return TRUE;
}
diff --git a/protocols/JabberG/src/jabber_chat.cpp b/protocols/JabberG/src/jabber_chat.cpp
index e5cdc1e3e0..ee686bddb7 100644
--- a/protocols/JabberG/src/jabber_chat.cpp
+++ b/protocols/JabberG/src/jabber_chat.cpp
@@ -120,8 +120,8 @@ int CJabberProto::GcInit(JABBER_LIST_ITEM *item)
int i;
// translate string for menus (this can't be done in initializer)
- for (i = 0; i < SIZEOF(sttAffiliationItems); i++) sttAffiliationItems[i].translate();
- for (i = 0; i < SIZEOF(sttRoleItems); i++) sttRoleItems[i].translate();
+ for (i = 0; i < _countof(sttAffiliationItems); i++) sttAffiliationItems[i].translate();
+ for (i = 0; i < _countof(sttRoleItems); i++) sttRoleItems[i].translate();
ptrT szNick(JabberNickFromJID(item->jid));
@@ -163,7 +163,7 @@ int CJabberProto::GcInit(JABBER_LIST_ITEM *item)
GCDEST gcd = { m_szModuleName, item->jid, GC_EVENT_ADDGROUP };
GCEVENT gce = { sizeof(gce), &gcd };
- for (i = SIZEOF(sttStatuses) - 1; i >= 0; i--) {
+ for (i = _countof(sttStatuses) - 1; i >= 0; i--) {
gce.ptszStatus = TranslateTS(sttStatuses[i]);
CallServiceSync(MS_GC_EVENT, NULL, (LPARAM)&gce);
}
@@ -355,7 +355,7 @@ void CJabberProto::GcQuit(JABBER_LIST_ITEM *item, int code, HXML reason)
if (m_bJabberOnline) {
TCHAR szPresenceTo[JABBER_MAX_JID_LEN];
- mir_sntprintf(szPresenceTo, SIZEOF(szPresenceTo), _T("%s/%s"), item->jid, item->nick);
+ mir_sntprintf(szPresenceTo, _countof(szPresenceTo), _T("%s/%s"), item->jid, item->nick);
m_ThreadInfo->send(
XmlNode(_T("presence")) << XATTR(_T("to"), szPresenceTo) << XATTR(_T("type"), _T("unavailable"))
@@ -524,7 +524,7 @@ int CJabberProto::JabberGcMenuHook(WPARAM, LPARAM lParam)
if (gcmi->Type == MENU_ON_LOG) {
static TCHAR url_buf[1024] = { 0 };
- gcmi->nItems = SIZEOF(sttLogListItems);
+ gcmi->nItems = _countof(sttLogListItems);
gcmi->Item = sttLogListItems;
static DWORD sttModeratorItems[] = { IDM_LST_PARTICIPANT, 0 };
@@ -539,7 +539,7 @@ int CJabberProto::JabberGcMenuHook(WPARAM, LPARAM lParam)
TCHAR *bufPtr = url_buf;
for (TCHAR *p = _tcsstr(ptszStatusMsg, _T("http")); p && *p; p = _tcsstr(p + 1, _T("http"))) {
if (!_tcsncmp(p, _T("http://"), 7) || !_tcsncmp(p, _T("https://"), 8)) {
- mir_tstrncpy(bufPtr, p, SIZEOF(url_buf) - (bufPtr - url_buf));
+ mir_tstrncpy(bufPtr, p, _countof(url_buf) - (bufPtr - url_buf));
gc_item *pItem = sttFindGcMenuItem(gcmi, idx);
pItem->pszDesc = bufPtr;
pItem->uType = MENU_POPUPITEM;
@@ -565,7 +565,7 @@ int CJabberProto::JabberGcMenuHook(WPARAM, LPARAM lParam)
}
}
else if (gcmi->Type == MENU_ON_NICKLIST) {
- gcmi->nItems = SIZEOF(sttListItems);
+ gcmi->nItems = _countof(sttListItems);
gcmi->Item = sttListItems;
static DWORD sttRJidItems[] = { IDM_RJID_VCARD, IDM_RJID_ADD, IDM_RJID_COPY, 0 };
@@ -587,20 +587,20 @@ int CJabberProto::JabberGcMenuHook(WPARAM, LPARAM lParam)
for (; idx <= IDM_LINK9; ++idx)
sttFindGcMenuItem(gcmi, idx)->uType = 0;
- for (i = 0; i < SIZEOF(sttAffiliationItems); i++) {
+ for (i = 0; i < _countof(sttAffiliationItems); i++) {
gc_item *item = sttFindGcMenuItem(gcmi, sttAffiliationItems[i].id);
item->uType = (him->m_affiliation == sttAffiliationItems[i].value) ? MENU_POPUPCHECK : MENU_POPUPITEM;
item->bDisabled = !(force || sttAffiliationItems[i].check(me, him));
}
- for (i = 0; i < SIZEOF(sttRoleItems); i++) {
+ for (i = 0; i < _countof(sttRoleItems); i++) {
gc_item *item = sttFindGcMenuItem(gcmi, sttRoleItems[i].id);
item->uType = (him->m_role == sttRoleItems[i].value) ? MENU_POPUPCHECK : MENU_POPUPITEM;
item->bDisabled = !(force || sttRoleItems[i].check(me, him));
}
if (him->m_tszRealJid && *him->m_tszRealJid) {
- mir_sntprintf(sttRJidBuf, SIZEOF(sttRJidBuf), TranslateT("Real &JID: %s"), him->m_tszRealJid);
+ mir_sntprintf(sttRJidBuf, _countof(sttRJidBuf), TranslateT("Real &JID: %s"), him->m_tszRealJid);
if (TCHAR *tmp = _tcschr(sttRJidBuf, _T('/'))) *tmp = 0;
if (MCONTACT hContact = HContactFromJID(him->m_tszRealJid)) {
@@ -740,7 +740,7 @@ public:
void OnCommand_AddJid(CCtrlButton*)
{
TCHAR buf[JABBER_MAX_JID_LEN];
- m_txtNewJid.GetText(buf, SIZEOF(buf));
+ m_txtNewJid.GetText(buf, _countof(buf));
m_txtNewJid.SetTextA("");
MCONTACT hContact = m_proto->HContactFromJID(buf);
@@ -865,7 +865,7 @@ static INT_PTR CALLBACK sttUserInfoDlgProc(HWND hwndDlg, UINT msg, WPARAM wParam
SetDlgItemText(hwndDlg, IDC_TXT_JID, dat->him->m_tszRealJid ? dat->him->m_tszRealJid : TranslateT("Real JID not available"));
SetDlgItemText(hwndDlg, IDC_TXT_STATUS, dat->him->m_tszStatusMessage);
- for (int i = 0; i < SIZEOF(sttRoleItems); i++) {
+ for (int i = 0; i < _countof(sttRoleItems); i++) {
if ((sttRoleItems[i].value == dat->him->m_role) || sttRoleItems[i].check(dat->me, dat->him)) {
SendDlgItemMessage(hwndDlg, IDC_TXT_ROLE, CB_SETITEMDATA,
idx = SendDlgItemMessage(hwndDlg, IDC_TXT_ROLE, CB_ADDSTRING, 0, (LPARAM)sttRoleItems[i].title),
@@ -874,7 +874,7 @@ static INT_PTR CALLBACK sttUserInfoDlgProc(HWND hwndDlg, UINT msg, WPARAM wParam
SendDlgItemMessage(hwndDlg, IDC_TXT_ROLE, CB_SETCURSEL, idx, 0);
}
}
- for (int i = 0; i < SIZEOF(sttAffiliationItems); i++) {
+ for (int i = 0; i < _countof(sttAffiliationItems); i++) {
if ((sttAffiliationItems[i].value == dat->him->m_affiliation) || sttAffiliationItems[i].check(dat->me, dat->him)) {
SendDlgItemMessage(hwndDlg, IDC_TXT_AFFILIATION, CB_SETITEMDATA,
idx = SendDlgItemMessage(hwndDlg, IDC_TXT_AFFILIATION, CB_ADDSTRING, 0, (LPARAM)sttAffiliationItems[i].title),
@@ -912,7 +912,7 @@ static INT_PTR CALLBACK sttUserInfoDlgProc(HWND hwndDlg, UINT msg, WPARAM wParam
break;
TCHAR szBareJid[JABBER_MAX_JID_LEN];
- JabberStripJid(dat->him->m_tszRealJid, szBareJid, SIZEOF(szBareJid));
+ JabberStripJid(dat->him->m_tszRealJid, szBareJid, _countof(szBareJid));
switch (value) {
case AFFILIATION_NONE:
@@ -1019,7 +1019,7 @@ static void sttNickListHook(CJabberProto *ppro, JABBER_LIST_ITEM *item, GCHOOK*
*p = 0;
mir_sntprintf(buf, _T("%s%s%s"), szMessage, him->m_tszResourceName, p + 2);
}
- else mir_tstrncpy(buf, szMessage, SIZEOF(buf));
+ else mir_tstrncpy(buf, szMessage, _countof(buf));
UnEscapeChatTags(buf);
ppro->m_ThreadInfo->send(
@@ -1087,7 +1087,7 @@ static void sttNickListHook(CJabberProto *ppro, JABBER_LIST_ITEM *item, GCHOOK*
if (him->m_affiliation != AFFILIATION_NONE) {
if (him->m_tszRealJid) {
TCHAR szBareJid[JABBER_MAX_JID_LEN];
- JabberStripJid(him->m_tszRealJid, szBareJid, SIZEOF(szBareJid));
+ JabberStripJid(him->m_tszRealJid, szBareJid, _countof(szBareJid));
ppro->AdminSet(item->jid, JABBER_FEAT_MUC_ADMIN, _T("jid"), szBareJid, _T("affiliation"), _T("none"));
}
else ppro->AdminSet(item->jid, JABBER_FEAT_MUC_ADMIN, _T("nick"), him->m_tszResourceName, _T("affiliation"), _T("none"));
@@ -1098,7 +1098,7 @@ static void sttNickListHook(CJabberProto *ppro, JABBER_LIST_ITEM *item, GCHOOK*
if (him->m_affiliation != AFFILIATION_MEMBER) {
if (him->m_tszRealJid) {
TCHAR szBareJid[JABBER_MAX_JID_LEN];
- JabberStripJid(him->m_tszRealJid, szBareJid, SIZEOF(szBareJid));
+ JabberStripJid(him->m_tszRealJid, szBareJid, _countof(szBareJid));
ppro->AdminSet(item->jid, JABBER_FEAT_MUC_ADMIN, _T("jid"), szBareJid, _T("affiliation"), _T("member"));
}
else ppro->AdminSet(item->jid, JABBER_FEAT_MUC_ADMIN, _T("nick"), him->m_tszResourceName, _T("affiliation"), _T("member"));
@@ -1109,7 +1109,7 @@ static void sttNickListHook(CJabberProto *ppro, JABBER_LIST_ITEM *item, GCHOOK*
if (him->m_affiliation != AFFILIATION_ADMIN) {
if (him->m_tszRealJid) {
TCHAR szBareJid[JABBER_MAX_JID_LEN];
- JabberStripJid(him->m_tszRealJid, szBareJid, SIZEOF(szBareJid));
+ JabberStripJid(him->m_tszRealJid, szBareJid, _countof(szBareJid));
ppro->AdminSet(item->jid, JABBER_FEAT_MUC_ADMIN, _T("jid"), szBareJid, _T("affiliation"), _T("admin"));
}
else ppro->AdminSet(item->jid, JABBER_FEAT_MUC_ADMIN, _T("nick"), him->m_tszResourceName, _T("affiliation"), _T("admin"));
@@ -1120,7 +1120,7 @@ static void sttNickListHook(CJabberProto *ppro, JABBER_LIST_ITEM *item, GCHOOK*
if (him->m_affiliation != AFFILIATION_OWNER) {
if (him->m_tszRealJid) {
TCHAR szBareJid[JABBER_MAX_JID_LEN];
- JabberStripJid(him->m_tszRealJid, szBareJid, SIZEOF(szBareJid));
+ JabberStripJid(him->m_tszRealJid, szBareJid, _countof(szBareJid));
ppro->AdminSet(item->jid, JABBER_FEAT_MUC_ADMIN, _T("jid"), szBareJid, _T("affiliation"), _T("owner"));
}
else ppro->AdminSet(item->jid, JABBER_FEAT_MUC_ADMIN, _T("nick"), him->m_tszResourceName, _T("affiliation"), _T("owner"));
@@ -1131,7 +1131,7 @@ static void sttNickListHook(CJabberProto *ppro, JABBER_LIST_ITEM *item, GCHOOK*
if ((GetTickCount() - dwLastBanKickTime) > BAN_KICK_INTERVAL) {
if (him->m_tszRealJid && *him->m_tszRealJid) {
TCHAR szVictimBareJid[JABBER_MAX_JID_LEN];
- JabberStripJid(him->m_tszRealJid, szVictimBareJid, SIZEOF(szVictimBareJid));
+ JabberStripJid(him->m_tszRealJid, szVictimBareJid, _countof(szVictimBareJid));
szBuffer.Format(_T("%s: "), me->m_tszResourceName);
szTitle.Format(TranslateT("Reason to ban %s"), him->m_tszResourceName);
@@ -1357,7 +1357,7 @@ static void sttLogListHook(CJabberProto *ppro, JABBER_LIST_ITEM *item, GCHOOK* g
static void sttSendPrivateMessage(CJabberProto *ppro, JABBER_LIST_ITEM *item, const TCHAR *nick)
{
TCHAR szFullJid[JABBER_MAX_JID_LEN];
- mir_sntprintf(szFullJid, SIZEOF(szFullJid), _T("%s/%s"), item->jid, nick);
+ mir_sntprintf(szFullJid, _countof(szFullJid), _T("%s/%s"), item->jid, nick);
MCONTACT hContact = ppro->DBCreateContact(szFullJid, NULL, TRUE, FALSE);
if (hContact != NULL) {
pResourceStatus r(item->findResource(nick));
diff --git a/protocols/JabberG/src/jabber_console.cpp b/protocols/JabberG/src/jabber_console.cpp
index 57b968ce96..16de723cc1 100644
--- a/protocols/JabberG/src/jabber_console.cpp
+++ b/protocols/JabberG/src/jabber_console.cpp
@@ -194,7 +194,7 @@ static void sttEmptyBuf(StringBuf *buf)
static void sttRtfAppendXml(StringBuf *buf, HXML node, DWORD flags, int indent)
{
char indentLevel[128];
- mir_snprintf(indentLevel, SIZEOF(indentLevel), RTF_INDENT_FMT, (int)(indent*200));
+ mir_snprintf(indentLevel, _countof(indentLevel), RTF_INDENT_FMT, (int)(indent*200));
sttAppendBufRaw(buf, RTF_BEGINTAG);
sttAppendBufRaw(buf, indentLevel);
@@ -228,7 +228,7 @@ static void sttRtfAppendXml(StringBuf *buf, HXML node, DWORD flags, int indent)
if (xmlGetChildCount(node)) {
sttAppendBufRaw(buf, RTF_BEGINTEXT);
char indentTextLevel[128];
- mir_snprintf(indentTextLevel, SIZEOF(indentTextLevel), RTF_TEXTINDENT_FMT, (int)((indent + 1) * 200));
+ mir_snprintf(indentTextLevel, _countof(indentTextLevel), RTF_TEXTINDENT_FMT, (int)((indent + 1) * 200));
sttAppendBufRaw(buf, indentTextLevel);
}
@@ -348,7 +348,7 @@ void CJabberDlgConsole::OnInitDialog()
*m_proto->m_filterInfo.pattern = 0;
ptrT tszPattern( m_proto->getTStringA("consoleWnd_fpattern"));
if (tszPattern != NULL)
- mir_tstrncpy(m_proto->m_filterInfo.pattern, tszPattern, SIZEOF(m_proto->m_filterInfo.pattern));
+ mir_tstrncpy(m_proto->m_filterInfo.pattern, tszPattern, _countof(m_proto->m_filterInfo.pattern));
sttJabberConsoleRebuildStrings(m_proto, GetDlgItem(m_hwnd, IDC_CB_FILTER));
SetDlgItemText(m_hwnd, IDC_CB_FILTER, m_proto->m_filterInfo.pattern);
@@ -370,7 +370,7 @@ void CJabberDlgConsole::OnInitDialog()
{ IDC_BTN_FILTER_REFRESH, "Refresh list", "sd_nav_refresh", false, FALSE},
};
- for (int i=0; i < SIZEOF(buttons); i++) {
+ for (int i=0; i < _countof(buttons); i++) {
SendDlgItemMessage(m_hwnd, buttons[i].idc, BM_SETIMAGE, IMAGE_ICON, (LPARAM)m_proto->LoadIconEx(buttons[i].icon));
SendDlgItemMessage(m_hwnd, buttons[i].idc, BUTTONSETASFLATBTN, TRUE, 0);
SendDlgItemMessage(m_hwnd, buttons[i].idc, BUTTONADDTOOLTIP, (WPARAM)buttons[i].title, 0);
@@ -378,7 +378,7 @@ void CJabberDlgConsole::OnInitDialog()
if (buttons[i].pushed) CheckDlgButton(m_hwnd, buttons[i].idc, BST_CHECKED);
}
- for (int i=0; i < SIZEOF(filter_modes); i++)
+ for (int i=0; i < _countof(filter_modes); i++)
if (filter_modes[i].type == m_proto->m_filterInfo.type) {
g_ReleaseIcon((HICON)SendDlgItemMessage(m_hwnd, IDC_BTN_FILTER, BM_SETIMAGE, IMAGE_ICON, (LPARAM)m_proto->LoadIconEx(filter_modes[i].icon)));
SendDlgItemMessage(m_hwnd, IDC_BTN_FILTER, BM_SETIMAGE, IMAGE_ICON, (LPARAM)m_proto->LoadIconEx(filter_modes[i].icon));
@@ -549,23 +549,23 @@ INT_PTR CJabberDlgConsole::DlgProc(UINT msg, WPARAM wParam, LPARAM lParam)
mir_cslock lck(m_proto->m_filterInfo.csPatternLock);
- if (len > SIZEOF(m_proto->m_filterInfo.pattern)) {
+ if (len > _countof(m_proto->m_filterInfo.pattern)) {
TCHAR *buf = (TCHAR *)_alloca(len * sizeof(TCHAR));
SendDlgItemMessage(m_hwnd, IDC_CB_FILTER, CB_GETLBTEXT, idx, (LPARAM)buf);
- mir_tstrncpy(m_proto->m_filterInfo.pattern, buf, SIZEOF(m_proto->m_filterInfo.pattern));
+ mir_tstrncpy(m_proto->m_filterInfo.pattern, buf, _countof(m_proto->m_filterInfo.pattern));
}
else SendDlgItemMessage(m_hwnd, IDC_CB_FILTER, CB_GETLBTEXT, idx, (LPARAM)m_proto->m_filterInfo.pattern);
}
else if (HIWORD(wParam) == CBN_EDITCHANGE) {
mir_cslock lck(m_proto->m_filterInfo.csPatternLock);
- GetDlgItemText(m_hwnd, IDC_CB_FILTER, m_proto->m_filterInfo.pattern, SIZEOF(m_proto->m_filterInfo.pattern));
+ GetDlgItemText(m_hwnd, IDC_CB_FILTER, m_proto->m_filterInfo.pattern, _countof(m_proto->m_filterInfo.pattern));
}
break;
case IDC_BTN_FILTER:
int i;
HMENU hMenu = CreatePopupMenu();
- for (i = 0; i < SIZEOF(filter_modes); i++)
+ for (i = 0; i < _countof(filter_modes); i++)
AppendMenu(hMenu,
MF_STRING | ((filter_modes[i].type == m_proto->m_filterInfo.type) ? MF_CHECKED : 0),
filter_modes[i].type + 1, TranslateTS(filter_modes[i].title));
@@ -578,7 +578,7 @@ INT_PTR CJabberDlgConsole::DlgProc(UINT msg, WPARAM wParam, LPARAM lParam)
if (res) {
m_proto->m_filterInfo.type = (TFilterInfo::Type)(res - 1);
- for (i = 0; i < SIZEOF(filter_modes); i++) {
+ for (i = 0; i < _countof(filter_modes); i++) {
if (filter_modes[i].type == m_proto->m_filterInfo.type) {
g_ReleaseIcon((HICON)SendDlgItemMessage(m_hwnd, IDC_BTN_FILTER, BM_SETIMAGE, IMAGE_ICON, (LPARAM)m_proto->LoadIconEx(filter_modes[i].icon)));
break;
diff --git a/protocols/JabberG/src/jabber_disco.cpp b/protocols/JabberG/src/jabber_disco.cpp
index 425b6a18ef..99658d0a49 100644
--- a/protocols/JabberG/src/jabber_disco.cpp
+++ b/protocols/JabberG/src/jabber_disco.cpp
@@ -380,9 +380,9 @@ void CJabberProto::PerformBrowse(HWND hwndDlg)
{
TCHAR szJid[JABBER_MAX_JID_LEN];
TCHAR szNode[ 512 ];
- if (!GetDlgItemText(hwndDlg, IDC_COMBO_JID, szJid, SIZEOF(szJid)))
+ if (!GetDlgItemText(hwndDlg, IDC_COMBO_JID, szJid, _countof(szJid)))
szJid[ 0 ] = 0;
- if (!GetDlgItemText(hwndDlg, IDC_COMBO_NODE, szNode, SIZEOF(szNode)))
+ if (!GetDlgItemText(hwndDlg, IDC_COMBO_NODE, szNode, _countof(szNode)))
szNode[ 0 ] = 0;
ComboAddRecentString(hwndDlg, IDC_COMBO_JID, "discoWnd_rcJid", szJid);
@@ -504,7 +504,7 @@ void CJabberProto::ApplyNodeIcon(HTREELISTITEM hItem, CJabberSDNode *pNode)
iOverlay = SD_OVERLAY_NONE;
}
- for (int i=0; i < SIZEOF(sttNodeIcons); i++)
+ for (int i=0; i < _countof(sttNodeIcons); i++)
{
if (!sttNodeIcons[i].iconIndex && !sttNodeIcons[i].iconName) continue;
@@ -674,7 +674,7 @@ void CJabberDlgDiscovery::OnInitDialog()
TreeList_Create(hwndList);
TreeList_AddIcon(hwndList, m_proto->LoadIconEx("main"), 0);
- for (int i=0; i < SIZEOF(sttNodeIcons); i++)
+ for (int i=0; i < _countof(sttNodeIcons); i++)
{
bool needDestroy = false;
HICON hIcon;
@@ -1201,7 +1201,7 @@ void CJabberProto::ServiceDiscoveryShowMenu(CJabberSDNode *pNode, HTREELISTITEM
HMENU hMenu = CreatePopupMenu();
BOOL lastSeparator = TRUE;
bool bFilterItems = !GetAsyncKeyState(VK_CONTROL);
- for (int i=0; i < SIZEOF(items); i++) {
+ for (int i=0; i < _countof(items); i++) {
JABBER_LIST_ITEM *rosterItem = NULL;
if (bFilterItems) {
if ((items[i].flags & SD_FLG_NONODE) && pNode->GetNode())
@@ -1325,7 +1325,7 @@ void CJabberProto::ServiceDiscoveryShowMenu(CJabberSDNode *pNode, HTREELISTITEM
case SD_ACT_COPYINFO:
{
TCHAR buf[8192];
- pNode->GetTooltipText(buf, SIZEOF(buf));
+ pNode->GetTooltipText(buf, _countof(buf));
JabberCopyText(m_pDlgServiceDiscovery->GetHwnd(), buf);
}
break;
diff --git a/protocols/JabberG/src/jabber_events.cpp b/protocols/JabberG/src/jabber_events.cpp
index f45074ea30..1eb848004c 100644
--- a/protocols/JabberG/src/jabber_events.cpp
+++ b/protocols/JabberG/src/jabber_events.cpp
@@ -43,7 +43,7 @@ int CJabberProto::OnContactDeleted(WPARAM hContact, LPARAM)
if (ListGetItemPtr(LIST_ROSTER, jid)) {
if (!_tcschr(jid, _T('@'))) {
TCHAR szStrippedJid[JABBER_MAX_JID_LEN];
- JabberStripJid(m_ThreadInfo->fullJID, szStrippedJid, SIZEOF(szStrippedJid));
+ JabberStripJid(m_ThreadInfo->fullJID, szStrippedJid, _countof(szStrippedJid));
TCHAR *szDog = _tcschr(szStrippedJid, _T('@'));
if (szDog && mir_tstrcmpi(szDog + 1, jid))
m_ThreadInfo->send(XmlNodeIq(_T("set"), SerialNext(), jid) << XQUERY(JABBER_FEAT_REGISTER) << XCHILD(_T("remove")));
diff --git a/protocols/JabberG/src/jabber_file.cpp b/protocols/JabberG/src/jabber_file.cpp
index d4bfc3dd61..0160e65e96 100644
--- a/protocols/JabberG/src/jabber_file.cpp
+++ b/protocols/JabberG/src/jabber_file.cpp
@@ -178,7 +178,7 @@ void JabberFileServerConnection(JABBER_SOCKET hConnection, DWORD /*dwRemoteIP*/,
CallService(MS_NETLIB_GETCONNECTIONINFO, (WPARAM)hConnection, (LPARAM)&connInfo);
TCHAR szPort[10];
- mir_sntprintf(szPort, SIZEOF(szPort), _T("%d"), connInfo.wPort);
+ mir_sntprintf(szPort, _countof(szPort), _T("%d"), connInfo.wPort);
ppro->debugLogA("File server incoming connection accepted: %s", connInfo.szIpPort);
JABBER_LIST_ITEM *item = ppro->ListGetItemPtr(LIST_FILE, szPort);
@@ -258,7 +258,7 @@ void __cdecl CJabberProto::FileServerThread(filetransfer *ft)
ft->hFileEvent = hEvent;
TCHAR szPort[20];
- mir_sntprintf(szPort, SIZEOF(szPort), _T("%d"), nlb.wPort);
+ mir_sntprintf(szPort, _countof(szPort), _T("%d"), nlb.wPort);
JABBER_LIST_ITEM *item = ListAdd(LIST_FILE, szPort);
item->ft = ft;
@@ -288,7 +288,7 @@ void __cdecl CJabberProto::FileServerThread(filetransfer *ft)
myAddr = (char*)CallService(MS_NETLIB_ADDRESSTOSTRING, 1, nlb.dwExternalIP);
char szAddr[256];
- mir_snprintf(szAddr, SIZEOF(szAddr), "http://%s:%d/%s", myAddr, nlb.wPort, pFileName);
+ mir_snprintf(szAddr, _countof(szAddr), "http://%s:%d/%s", myAddr, nlb.wPort, pFileName);
size_t len = mir_tstrlen(ptszResource) + mir_tstrlen(ft->jid) + 2;
TCHAR *fulljid = (TCHAR *)alloca(sizeof(TCHAR) * len);
@@ -402,7 +402,7 @@ int CJabberProto::FileSendParse(JABBER_SOCKET s, filetransfer *ft, char* buffer,
}
char fileBuffer[2048];
- int bytes = mir_snprintf(fileBuffer, SIZEOF(fileBuffer), "HTTP/1.1 200 OK\r\nContent-Length: %I64u\r\n\r\n", statbuf.st_size);
+ int bytes = mir_snprintf(fileBuffer, _countof(fileBuffer), "HTTP/1.1 200 OK\r\nContent-Length: %I64u\r\n\r\n", statbuf.st_size);
WsSend(s, fileBuffer, bytes, MSG_DUMPASTEXT);
ft->std.flags |= PFTS_SENDING;
@@ -498,7 +498,7 @@ int filetransfer::create()
return fileId;
TCHAR filefull[MAX_PATH];
- mir_sntprintf(filefull, SIZEOF(filefull), _T("%s\\%s"), std.tszWorkingDir, std.tszCurrentFile);
+ mir_sntprintf(filefull, _countof(filefull), _T("%s\\%s"), std.tszWorkingDir, std.tszCurrentFile);
replaceStrT(std.tszCurrentFile, filefull);
if (hWaitEvent != INVALID_HANDLE_VALUE)
diff --git a/protocols/JabberG/src/jabber_filterlist.cpp b/protocols/JabberG/src/jabber_filterlist.cpp
index 5e769b42a5..0d8ff6e567 100644
--- a/protocols/JabberG/src/jabber_filterlist.cpp
+++ b/protocols/JabberG/src/jabber_filterlist.cpp
@@ -135,7 +135,7 @@ void CCtrlFilterListView::FilterHighlight(TCHAR *str)
bool found = false;
if (str) {
for (int j = 0; j < 10; ++j) {
- GetItemText(i, j, buf, SIZEOF(buf));
+ GetItemText(i, j, buf, _countof(buf));
if (!*buf)
break;
@@ -247,7 +247,7 @@ LRESULT CCtrlFilterListView::CustomWndProc(UINT msg, WPARAM wParam, LPARAM lPara
{rc.left+FILTER_BOX_HEIGHT, rc.top+FILTER_BOX_HEIGHT},
{rc.left, rc.top+FILTER_BOX_HEIGHT},
};
- HRGN hrgnFilter = CreatePolygonRgn(pts, SIZEOF(pts), ALTERNATE);
+ HRGN hrgnFilter = CreatePolygonRgn(pts, _countof(pts), ALTERNATE);
HDC hdc = GetWindowDC(m_hwnd);
diff --git a/protocols/JabberG/src/jabber_ft.cpp b/protocols/JabberG/src/jabber_ft.cpp
index 9b19832a8c..fbc4db5b45 100644
--- a/protocols/JabberG/src/jabber_ft.cpp
+++ b/protocols/JabberG/src/jabber_ft.cpp
@@ -100,7 +100,7 @@ void CJabberProto::FtInitiate(TCHAR* jid, filetransfer *ft)
filename = p+1;
TCHAR tszJid[ 512 ];
- mir_sntprintf(tszJid, SIZEOF(tszJid), _T("%s/%s"), jid, rs);
+ mir_sntprintf(tszJid, _countof(tszJid), _T("%s/%s"), jid, rs);
XmlNodeIq iq( AddIQ(&CJabberProto::OnFtSiResult, JABBER_IQ_TYPE_SET, tszJid, JABBER_IQ_PARSE_FROM | JABBER_IQ_PARSE_TO, -1, ft));
HXML si = iq << XCHILDNS(_T("si"), JABBER_FEAT_SI) << XATTR(_T("id"), sid)
diff --git a/protocols/JabberG/src/jabber_groupchat.cpp b/protocols/JabberG/src/jabber_groupchat.cpp
index 14aadd27d8..fb1e164ece 100644
--- a/protocols/JabberG/src/jabber_groupchat.cpp
+++ b/protocols/JabberG/src/jabber_groupchat.cpp
@@ -369,7 +369,7 @@ static void sttJoinDlgShowRecentItems(HWND hwndDlg, int newCount)
RECT rc;
int ctrls[] = { IDC_BOOKMARKS, IDOK, IDCANCEL };
- for (int i = 0; i < SIZEOF(ctrls); i++) {
+ for (int i = 0; i < _countof(ctrls); i++) {
GetWindowRect(GetDlgItem(hwndDlg, ctrls[i]), &rc);
MapWindowPoints(NULL, hwndDlg, (LPPOINT)&rc, 2);
SetWindowPos(GetDlgItem(hwndDlg, ctrls[i]), NULL, rc.left, rc.top + offset, 0, 0, SWP_NOSIZE | SWP_NOZORDER);
@@ -466,7 +466,7 @@ void CJabberDlgGcJoin::OnInitDialog()
if (!info.loadRecent(i))
break;
- mir_sntprintf(jid, SIZEOF(jid), _T("%s@%s (%s)"),
+ mir_sntprintf(jid, _countof(jid), _T("%s@%s (%s)"),
info.room, info.server,
info.nick ? info.nick : TranslateT("<no nick>"));
SetDlgItemText(m_hwnd, IDC_RECENT1 + i, jid);
@@ -687,18 +687,18 @@ INT_PTR CJabberDlgGcJoin::DlgProc(UINT msg, WPARAM wParam, LPARAM lParam)
// fall through
case IDOK:
{
- GetDlgItemText(m_hwnd, IDC_SERVER, text, SIZEOF(text));
+ GetDlgItemText(m_hwnd, IDC_SERVER, text, _countof(text));
TCHAR *server = NEWTSTR_ALLOCA(text), *room;
m_proto->ComboAddRecentString(m_hwnd, IDC_SERVER, "joinWnd_rcSvr", server);
- GetDlgItemText(m_hwnd, IDC_ROOM, text, SIZEOF(text));
+ GetDlgItemText(m_hwnd, IDC_ROOM, text, _countof(text));
room = NEWTSTR_ALLOCA(text);
- GetDlgItemText(m_hwnd, IDC_NICK, text, SIZEOF(text));
+ GetDlgItemText(m_hwnd, IDC_NICK, text, _countof(text));
TCHAR *nick = NEWTSTR_ALLOCA(text);
- GetDlgItemText(m_hwnd, IDC_PASSWORD, text, SIZEOF(text));
+ GetDlgItemText(m_hwnd, IDC_PASSWORD, text, _countof(text));
TCHAR *password = NEWTSTR_ALLOCA(text);
m_proto->GroupchatJoinRoom(server, room, nick, password);
}
@@ -1182,7 +1182,7 @@ public:
void OnCommand_Accept(CCtrlButton*)
{
TCHAR text[128];
- GetDlgItemText(m_hwnd, IDC_NICK, text, SIZEOF(text));
+ GetDlgItemText(m_hwnd, IDC_NICK, text, _countof(text));
m_proto->AcceptGroupchatInvite(m_info->roomJid, text, m_info->password);
EndDialog(m_hwnd, 0);
}
diff --git a/protocols/JabberG/src/jabber_icolib.cpp b/protocols/JabberG/src/jabber_icolib.cpp
index 3a5ba46a40..aca69dc538 100644
--- a/protocols/JabberG/src/jabber_icolib.cpp
+++ b/protocols/JabberG/src/jabber_icolib.cpp
@@ -113,7 +113,7 @@ CIconPool::~CIconPool()
void CIconPool::RegisterIcon(const char *name, TCHAR *filename, int iconid, TCHAR *szSection, TCHAR *szDescription)
{
char szSettingName[128];
- mir_snprintf(szSettingName, SIZEOF(szSettingName), "jabber_%s", name);
+ mir_snprintf(szSettingName, _countof(szSettingName), "jabber_%s", name);
CPoolItem *item = new CPoolItem;
item->m_name = mir_strdup(name);
@@ -167,8 +167,8 @@ CIconPool::CPoolItem *CIconPool::FindItemByName(const char *name)
void CJabberProto::IconsInit(void)
{
- m_transportProtoTableStartIndex = (int *)mir_alloc(sizeof(int) * SIZEOF(TransportProtoTable));
- for (int i=0; i < SIZEOF(TransportProtoTable); i++)
+ m_transportProtoTableStartIndex = (int *)mir_alloc(sizeof(int) * _countof(TransportProtoTable));
+ for (int i=0; i < _countof(TransportProtoTable); i++)
m_transportProtoTableStartIndex[i] = -1;
}
@@ -277,8 +277,8 @@ static HICON LoadTransportIcon(char *filename,int i,char *IconName,TCHAR *SectNa
GetModuleFileNameA(NULL, szPath, MAX_PATH);
str=strrchr(szPath,'\\');
if (str != NULL) *str=0;
- mir_snprintf(szMyPath, SIZEOF(szMyPath), "%s\\Icons\\%s", szPath, filename);
- mir_snprintf(szFullPath, SIZEOF(szFullPath), "%s\\Icons\\%s,%d", szPath, filename, i);
+ mir_snprintf(szMyPath, _countof(szMyPath), "%s\\Icons\\%s", szPath, filename);
+ mir_snprintf(szFullPath, _countof(szFullPath), "%s\\Icons\\%s,%d", szPath, filename, i);
BOOL nf;
HICON hi=ExtractIconFromPath(szFullPath,&nf);
if (hi) has_proto_icon=TRUE;
@@ -316,8 +316,8 @@ int CJabberProto::LoadAdvancedIcons(int iID)
int first=-1;
HICON empty=LoadSmallIcon(NULL,MAKEINTRESOURCE(102));
- mir_sntprintf(Group, SIZEOF(Group), LPGENT("Status icons")_T("/%s/%S %s"), m_tszUserName, proto, TranslateT("transport"));
- mir_snprintf(defFile, SIZEOF(defFile), "proto_%s.dll",proto);
+ mir_sntprintf(Group, _countof(Group), LPGENT("Status icons")_T("/%s/%S %s"), m_tszUserName, proto, TranslateT("transport"));
+ mir_snprintf(defFile, _countof(defFile), "proto_%s.dll",proto);
if (!hAdvancedStatusIcon)
hAdvancedStatusIcon=(HIMAGELIST)CallService(MS_CLIST_GETICONSIMAGELIST,0,0);
@@ -326,7 +326,7 @@ int CJabberProto::LoadAdvancedIcons(int iID)
BOOL needFree;
int n = skinStatusToJabberStatus[i];
TCHAR *descr = pcli->pfnGetStatusModeDescription(n+ID_STATUS_OFFLINE, 0);
- mir_snprintf(Uname, SIZEOF(Uname), "%s_Transport_%s_%d", m_szModuleName, proto, n);
+ mir_snprintf(Uname, _countof(Uname), "%s_Transport_%s_%d", m_szModuleName, proto, n);
HICON hicon = LoadTransportIcon(defFile,-skinIconStatusToResourceId[i],Uname,Group,descr,-(n+ID_STATUS_OFFLINE),&needFree);
int index = (m_transportProtoTableStartIndex[iID] == -1)?-1:m_transportProtoTableStartIndex[iID]+n;
int added = ImageList_ReplaceIcon(hAdvancedStatusIcon,index,hicon?hicon:empty);
@@ -343,7 +343,7 @@ int CJabberProto::LoadAdvancedIcons(int iID)
int CJabberProto::GetTransportProtoID(TCHAR* TransportDomain)
{
- for (int i=0; i<SIZEOF(TransportProtoTable); i++)
+ for (int i=0; i<_countof(TransportProtoTable); i++)
if ( MatchMask(TransportDomain, TransportProtoTable[i].mask))
return i;
@@ -352,7 +352,7 @@ int CJabberProto::GetTransportProtoID(TCHAR* TransportDomain)
int CJabberProto::GetTransportStatusIconIndex(int iID, int Status)
{
- if (iID < 0 || iID >= SIZEOF(TransportProtoTable))
+ if (iID < 0 || iID >= _countof(TransportProtoTable))
return -1;
//icons not loaded - loading icons
@@ -374,7 +374,7 @@ int CJabberProto::GetTransportStatusIconIndex(int iID, int Status)
int CJabberProto::OnReloadIcons(WPARAM, LPARAM)
{
- for (int i=0; i < SIZEOF(TransportProtoTable); i++)
+ for (int i=0; i < _countof(TransportProtoTable); i++)
if (m_transportProtoTableStartIndex[i] != -1)
LoadAdvancedIcons(i);
@@ -432,7 +432,7 @@ BOOL CJabberProto::DBCheckIsTransportedContact(const TCHAR *jid, MCONTACT hConta
if (resourcepos != NULL)
*resourcepos = '\0';
- for (int i=0; i < SIZEOF(TransportProtoTable); i++)
+ for (int i=0; i < _countof(TransportProtoTable); i++)
if (MatchMask(domain, TransportProtoTable[i].mask)) {
GetTransportStatusIconIndex(GetTransportProtoID(domain), ID_STATUS_OFFLINE);
isTransported = TRUE;
@@ -525,29 +525,29 @@ static IconItem sharedIconList4[] =
void g_IconsInit()
{
- Icon_Register(hInst, LPGEN("Protocols")"/"LPGEN("Jabber"), sharedIconList1, SIZEOF(sharedIconList1), GLOBAL_SETTING_PREFIX);
- Icon_Register(hInst, LPGEN("Protocols")"/"LPGEN("Jabber")"/"LPGEN("Dialogs"), sharedIconList2, SIZEOF(sharedIconList2), GLOBAL_SETTING_PREFIX);
- Icon_Register(hInst, LPGEN("Protocols")"/"LPGEN("Dialogs")"/"LPGEN("Discovery"), sharedIconList3, SIZEOF(sharedIconList3), GLOBAL_SETTING_PREFIX);
- Icon_Register(hInst, LPGEN("Protocols")"/"LPGEN("Dialogs")"/"LPGEN("Privacy"), sharedIconList4, SIZEOF(sharedIconList4), GLOBAL_SETTING_PREFIX);
+ Icon_Register(hInst, LPGEN("Protocols")"/"LPGEN("Jabber"), sharedIconList1, _countof(sharedIconList1), GLOBAL_SETTING_PREFIX);
+ Icon_Register(hInst, LPGEN("Protocols")"/"LPGEN("Jabber")"/"LPGEN("Dialogs"), sharedIconList2, _countof(sharedIconList2), GLOBAL_SETTING_PREFIX);
+ Icon_Register(hInst, LPGEN("Protocols")"/"LPGEN("Dialogs")"/"LPGEN("Discovery"), sharedIconList3, _countof(sharedIconList3), GLOBAL_SETTING_PREFIX);
+ Icon_Register(hInst, LPGEN("Protocols")"/"LPGEN("Dialogs")"/"LPGEN("Privacy"), sharedIconList4, _countof(sharedIconList4), GLOBAL_SETTING_PREFIX);
}
HANDLE g_GetIconHandle(int iconId)
{
int i;
- for (i=0; i < SIZEOF(sharedIconList1); i++)
+ for (i=0; i < _countof(sharedIconList1); i++)
if (sharedIconList1[i].defIconID == iconId)
return sharedIconList1[i].hIcolib;
- for (i=0; i < SIZEOF(sharedIconList2); i++)
+ for (i=0; i < _countof(sharedIconList2); i++)
if (sharedIconList2[i].defIconID == iconId)
return sharedIconList2[i].hIcolib;
- for (i=0; i < SIZEOF(sharedIconList3); i++)
+ for (i=0; i < _countof(sharedIconList3); i++)
if (sharedIconList3[i].defIconID == iconId)
return sharedIconList3[i].hIcolib;
- for (i=0; i < SIZEOF(sharedIconList4); i++)
+ for (i=0; i < _countof(sharedIconList4); i++)
if (sharedIconList4[i].defIconID == iconId)
return sharedIconList4[i].hIcolib;
@@ -557,7 +557,7 @@ HANDLE g_GetIconHandle(int iconId)
HICON g_LoadIconEx(const char* name, bool big)
{
char szSettingName[100];
- mir_snprintf(szSettingName, SIZEOF(szSettingName), "%s_%s", GLOBAL_SETTING_PREFIX, name);
+ mir_snprintf(szSettingName, _countof(szSettingName), "%s_%s", GLOBAL_SETTING_PREFIX, name);
return IcoLib_GetIcon(szSettingName, big);
}
diff --git a/protocols/JabberG/src/jabber_iq_handlers.cpp b/protocols/JabberG/src/jabber_iq_handlers.cpp
index c2b6dc5c67..909f05f939 100644
--- a/protocols/JabberG/src/jabber_iq_handlers.cpp
+++ b/protocols/JabberG/src/jabber_iq_handlers.cpp
@@ -335,8 +335,8 @@ BOOL CJabberProto::OnIqRequestVersion(HXML, CJabberIqInfo *pInfo)
if (m_options.ShowOSVersion) {
TCHAR os[256] = { 0 };
- if (!GetOSDisplayString(os, SIZEOF(os)))
- mir_tstrncpy(os, _T("Microsoft Windows"), SIZEOF(os));
+ if (!GetOSDisplayString(os, _countof(os)))
+ mir_tstrncpy(os, _T("Microsoft Windows"), _countof(os));
query << XCHILD(_T("os"), os);
}
@@ -393,10 +393,10 @@ BOOL CJabberProto::OnIqRequestTime(HXML, CJabberIqInfo *pInfo)
TCHAR stime[100];
TCHAR szTZ[10];
- TimeZone_PrintDateTime(UTC_TIME_HANDLE, _T("I"), stime, SIZEOF(stime), 0);
+ TimeZone_PrintDateTime(UTC_TIME_HANDLE, _T("I"), stime, _countof(stime), 0);
int nGmtOffset = GetGMTOffset();
- mir_sntprintf(szTZ, SIZEOF(szTZ), _T("%+03d:%02d"), nGmtOffset / 60, nGmtOffset % 60);
+ mir_sntprintf(szTZ, _countof(szTZ), _T("%+03d:%02d"), nGmtOffset / 60, nGmtOffset % 60);
XmlNodeIq iq(_T("result"), pInfo);
HXML timeNode = iq << XCHILDNS(_T("time"), JABBER_FEAT_ENTITY_TIME);
@@ -417,7 +417,7 @@ BOOL CJabberProto::OnIqProcessIqOldTime(HXML, CJabberIqInfo *pInfo)
_tzset();
time(&ltime);
gmt = gmtime(&ltime);
- mir_sntprintf(stime, SIZEOF(stime), _T("%.4i%.2i%.2iT%.2i:%.2i:%.2i"),
+ mir_sntprintf(stime, _countof(stime), _T("%.4i%.2i%.2iT%.2i:%.2i:%.2i"),
gmt->tm_year + 1900, gmt->tm_mon + 1,
gmt->tm_mday, gmt->tm_hour, gmt->tm_min, gmt->tm_sec);
dtime = _tctime(&ltime);
@@ -453,7 +453,7 @@ BOOL CJabberProto::OnIqRequestAvatar(HXML, CJabberIqInfo *pInfo)
}
TCHAR szFileName[MAX_PATH];
- GetAvatarFileName(NULL, szFileName, SIZEOF(szFileName));
+ GetAvatarFileName(NULL, szFileName, _countof(szFileName));
FILE* in = _tfopen(szFileName, _T("rb"));
if (in == NULL)
@@ -641,7 +641,7 @@ BOOL CJabberProto::OnIqRequestOOB(HXML, CJabberIqInfo *pInfo)
TCHAR *p = str + 7, *q;
if ((q = _tcschr(p, '/')) != NULL) {
TCHAR text[1024];
- if (q - p < SIZEOF(text)) {
+ if (q - p < _countof(text)) {
_tcsncpy_s(text, p, q - p);
text[q - p] = '\0';
if ((p = _tcschr(text, ':')) != NULL) {
diff --git a/protocols/JabberG/src/jabber_iqid.cpp b/protocols/JabberG/src/jabber_iqid.cpp
index 38712cd0c1..3e1b65b3f0 100644
--- a/protocols/JabberG/src/jabber_iqid.cpp
+++ b/protocols/JabberG/src/jabber_iqid.cpp
@@ -219,7 +219,7 @@ void CJabberProto::OnIqResultGetAuth(HXML iqNode, CJabberIqInfo*)
JabberShaStrBuf buf;
T2Utf str(m_ThreadInfo->conn.password);
char text[200];
- mir_snprintf(text, SIZEOF(text), "%s%s", m_ThreadInfo->szStreamId, str);
+ mir_snprintf(text, _countof(text), "%s%s", m_ThreadInfo->szStreamId, str);
query << XCHILD(_T("digest"), _A2T(JabberSha1(text, buf)));
}
else if (xmlGetChild(queryNode, "password") != NULL)
@@ -279,7 +279,7 @@ void CJabberProto::OnIqResultBind(HXML iqNode, CJabberIqInfo *pInfo)
if (pInfo->GetIqType() == JABBER_IQ_TYPE_RESULT) {
LPCTSTR szJid = XPathT(iqNode, "bind[@xmlns='urn:ietf:params:xml:ns:xmpp-bind']/jid");
if (szJid) {
- if (!_tcsncmp(m_ThreadInfo->fullJID, szJid, SIZEOF(m_ThreadInfo->fullJID)))
+ if (!_tcsncmp(m_ThreadInfo->fullJID, szJid, _countof(m_ThreadInfo->fullJID)))
debugLog(_T("Result Bind: %s confirmed "), m_ThreadInfo->fullJID);
else {
debugLog(_T("Result Bind: %s changed to %s"), m_ThreadInfo->fullJID, szJid);
@@ -589,7 +589,7 @@ void CJabberProto::OnIqResultGetVcardPhoto(HXML n, MCONTACT hContact, bool &hasP
return;
TCHAR szAvatarFileName[MAX_PATH];
- GetAvatarFileName(hContact, szAvatarFileName, SIZEOF(szAvatarFileName));
+ GetAvatarFileName(hContact, szAvatarFileName, _countof(szAvatarFileName));
debugLog(_T("Picture file name set to %s"), szAvatarFileName);
HANDLE hFile = CreateFile(szAvatarFileName, GENERIC_WRITE, 0, NULL, CREATE_ALWAYS, FILE_ATTRIBUTE_NORMAL, NULL);
@@ -752,13 +752,13 @@ void CJabberProto::OnIqResultGetVcard(HXML iqNode, CJabberIqInfo*)
if (nEmail == 0)
mir_strcpy(text, "e-mail");
else
- mir_snprintf(text, SIZEOF(text), "e-mail%d", nEmail - 1);
+ mir_snprintf(text, _countof(text), "e-mail%d", nEmail - 1);
}
- else mir_snprintf(text, SIZEOF(text), "e-mail%d", nEmail);
+ else mir_snprintf(text, _countof(text), "e-mail%d", nEmail);
setTString(hContact, text, xmlGetText(m));
if (hContact == NULL) {
- mir_snprintf(text, SIZEOF(text), "e-mailFlag%d", nEmail);
+ mir_snprintf(text, _countof(text), "e-mailFlag%d", nEmail);
int nFlag = 0;
if (xmlGetChild(n, "HOME") != NULL) nFlag |= JABBER_VCEMAIL_HOME;
if (xmlGetChild(n, "WORK") != NULL) nFlag |= JABBER_VCEMAIL_WORK;
@@ -820,7 +820,7 @@ void CJabberProto::OnIqResultGetVcard(HXML iqNode, CJabberIqInfo*)
mir_sntprintf(text, _T("%s\r\n%s"), xmlGetText(m), xmlGetText(o));
else
_tcsncpy_s(text, xmlGetText(m), _TRUNCATE);
- text[SIZEOF(text)-1] = '\0';
+ text[_countof(text)-1] = '\0';
setTString(hContact, "Street", text);
}
else {
@@ -863,7 +863,7 @@ void CJabberProto::OnIqResultGetVcard(HXML iqNode, CJabberIqInfo*)
mir_sntprintf(text, _T("%s\r\n%s"), xmlGetText(m), xmlGetText(o));
else
_tcsncpy_s(text, xmlGetText(m), _TRUNCATE);
- text[SIZEOF(text)-1] = '\0';
+ text[_countof(text)-1] = '\0';
setTString(hContact, "CompanyStreet", text);
}
else {
@@ -924,10 +924,10 @@ void CJabberProto::OnIqResultGetVcard(HXML iqNode, CJabberIqInfo*)
}
else {
char text[100];
- mir_snprintf(text, SIZEOF(text), "Phone%d", nPhone);
+ mir_snprintf(text, _countof(text), "Phone%d", nPhone);
setTString(text, xmlGetText(m));
- mir_snprintf(text, SIZEOF(text), "PhoneFlag%d", nPhone);
+ mir_snprintf(text, _countof(text), "PhoneFlag%d", nPhone);
int nFlag = 0;
if (xmlGetChild(n, "HOME") != NULL) nFlag |= JABBER_VCTEL_HOME;
if (xmlGetChild(n, "WORK") != NULL) nFlag |= JABBER_VCTEL_WORK;
@@ -1012,7 +1012,7 @@ void CJabberProto::OnIqResultGetVcard(HXML iqNode, CJabberIqInfo*)
delSetting(hContact, "e-mail");
else {
char text[100];
- mir_snprintf(text, SIZEOF(text), "e-mail%d", nEmail - 1);
+ mir_snprintf(text, _countof(text), "e-mail%d", nEmail - 1);
if (db_get_s(hContact, m_szModuleName, text, &dbv)) break;
db_free(&dbv);
delSetting(hContact, text);
@@ -1023,11 +1023,11 @@ void CJabberProto::OnIqResultGetVcard(HXML iqNode, CJabberIqInfo*)
else {
while (true) {
char text[100];
- mir_snprintf(text, SIZEOF(text), "e-mail%d", nEmail);
+ mir_snprintf(text, _countof(text), "e-mail%d", nEmail);
if (getString(text, &dbv)) break;
db_free(&dbv);
delSetting(text);
- mir_snprintf(text, SIZEOF(text), "e-mailFlag%d", nEmail);
+ mir_snprintf(text, _countof(text), "e-mailFlag%d", nEmail);
delSetting(text);
nEmail++;
}
@@ -1057,11 +1057,11 @@ void CJabberProto::OnIqResultGetVcard(HXML iqNode, CJabberIqInfo*)
else {
while (true) {
char text[100];
- mir_snprintf(text, SIZEOF(text), "Phone%d", nPhone);
+ mir_snprintf(text, _countof(text), "Phone%d", nPhone);
if (getString(text, &dbv)) break;
db_free(&dbv);
delSetting(text);
- mir_snprintf(text, SIZEOF(text), "PhoneFlag%d", nPhone);
+ mir_snprintf(text, _countof(text), "PhoneFlag%d", nPhone);
delSetting(text);
nPhone++;
}
@@ -1327,7 +1327,7 @@ void CJabberProto::OnIqResultGetClientAvatar(HXML iqNode, CJabberIqInfo*)
}
TCHAR szJid[JABBER_MAX_JID_LEN];
- mir_tstrncpy(szJid, from, SIZEOF(szJid));
+ mir_tstrncpy(szJid, from, _countof(szJid));
TCHAR *res = _tcschr(szJid, _T('/'));
if (res != NULL)
*res = 0;
@@ -1367,7 +1367,7 @@ void CJabberProto::OnIqResultGetServerAvatar(HXML iqNode, CJabberIqInfo*)
}
TCHAR szJid[JABBER_MAX_JID_LEN];
- mir_tstrncpy(szJid, from, SIZEOF(szJid));
+ mir_tstrncpy(szJid, from, _countof(szJid));
TCHAR *res = _tcschr(szJid, _T('/'));
if (res != NULL)
*res = 0;
@@ -1407,7 +1407,7 @@ LBL_ErrFormat:
TCHAR tszFileName[MAX_PATH];
if (getByte(hContact, "AvatarType", PA_FORMAT_UNKNOWN) != (unsigned char)pictureType) {
- GetAvatarFileName(hContact, tszFileName, SIZEOF(tszFileName));
+ GetAvatarFileName(hContact, tszFileName, _countof(tszFileName));
DeleteFile(tszFileName);
}
@@ -1419,7 +1419,7 @@ LBL_ErrFormat:
mir_sha1_append(&sha, (BYTE*)(char*)body, resultLen);
mir_sha1_finish(&sha, digest);
- GetAvatarFileName(hContact, tszFileName, SIZEOF(tszFileName));
+ GetAvatarFileName(hContact, tszFileName, _countof(tszFileName));
_tcsncpy_s(ai.filename, tszFileName, _TRUNCATE);
FILE *out = _tfopen(tszFileName, _T("wb"));
diff --git a/protocols/JabberG/src/jabber_iqid_muc.cpp b/protocols/JabberG/src/jabber_iqid_muc.cpp
index fde613418b..b66a55cf5b 100644
--- a/protocols/JabberG/src/jabber_iqid_muc.cpp
+++ b/protocols/JabberG/src/jabber_iqid_muc.cpp
@@ -117,14 +117,14 @@ static void sttFillJidList(HWND hwndDlg)
if (jidListInfo->type == MUC_BANLIST) {
LPCTSTR reason = xmlGetText(xmlGetChild(itemNode , _T("reason")));
if (reason != NULL) {
- mir_sntprintf(tszItemText, SIZEOF(tszItemText), _T("%s (%s)") , jid, reason);
+ mir_sntprintf(tszItemText, _countof(tszItemText), _T("%s (%s)") , jid, reason);
lvi.pszText = tszItemText;
}
}
else if (jidListInfo->type == MUC_VOICELIST || jidListInfo->type == MUC_MODERATORLIST) {
LPCTSTR nick = xmlGetAttrValue(itemNode, _T("nick"));
if (nick != NULL) {
- mir_sntprintf(tszItemText, SIZEOF(tszItemText), _T("%s (%s)") , nick, jid);
+ mir_sntprintf(tszItemText, _countof(tszItemText), _T("%s (%s)") , nick, jid);
lvi.pszText = tszItemText;
}
}
@@ -200,7 +200,7 @@ static INT_PTR CALLBACK JabberMucJidListDlgProc(HWND hwndDlg, UINT msg, WPARAM w
{IDC_BTN_FILTERAPPLY, "Apply filter", "sd_filter_apply", false},
{IDC_BTN_FILTERRESET, "Reset filter", "sd_filter_reset", false},
};
- for (int i=0; i < SIZEOF(buttons); i++)
+ for (int i=0; i < _countof(buttons); i++)
{
SendDlgItemMessage(hwndDlg, buttons[i].idc, BM_SETIMAGE, IMAGE_ICON, (LPARAM)dat->ppro->LoadIconEx(buttons[i].icon));
SendDlgItemMessage(hwndDlg, buttons[i].idc, BUTTONSETASFLATBTN, TRUE, 0);
@@ -248,7 +248,7 @@ static INT_PTR CALLBACK JabberMucJidListDlgProc(HWND hwndDlg, UINT msg, WPARAM w
SetWindowLongPtr(hwndDlg, GWLP_USERDATA, (LONG_PTR) dat);
// Populate displayed list from iqNode
- mir_tstrncpy(title, TranslateT("JID List"), SIZEOF(title));
+ mir_tstrncpy(title, TranslateT("JID List"), _countof(title));
if ((dat=(JABBER_MUC_JIDLIST_INFO *) lParam) != NULL) {
HXML iqNode = dat->iqNode;
if (iqNode != NULL) {
@@ -258,7 +258,7 @@ static INT_PTR CALLBACK JabberMucJidListDlgProc(HWND hwndDlg, UINT msg, WPARAM w
HXML queryNode = xmlGetChild(iqNode , _T("query"));
if (queryNode != NULL) {
TCHAR *localFrom = mir_tstrdup(from);
- mir_sntprintf(title, SIZEOF(title), TranslateT("%s, %d items (%s)"),
+ mir_sntprintf(title, _countof(title), TranslateT("%s, %d items (%s)"),
(dat->type == MUC_VOICELIST) ? TranslateT("Voice List") :
(dat->type == MUC_MEMBERLIST) ? TranslateT("Member List") :
(dat->type == MUC_MODERATORLIST) ? TranslateT("Moderator List") :
@@ -331,7 +331,7 @@ static INT_PTR CALLBACK JabberMucJidListDlgProc(HWND hwndDlg, UINT msg, WPARAM w
lvi.iItem = hti.iItem;
lvi.iSubItem = 0;
lvi.pszText = text;
- lvi.cchTextMax = SIZEOF(text);
+ lvi.cchTextMax = _countof(text);
ListView_GetItem(nm->hdr.hwndFrom, &lvi);
if (lvi.lParam == -1) {
CMString szBuffer(dat->type2str());
@@ -357,7 +357,7 @@ static INT_PTR CALLBACK JabberMucJidListDlgProc(HWND hwndDlg, UINT msg, WPARAM w
//delete
TCHAR msgText[128];
- mir_sntprintf(msgText, SIZEOF(msgText), TranslateT("Removing %s?"), text);
+ mir_sntprintf(msgText, _countof(msgText), TranslateT("Removing %s?"), text);
if (MessageBox(hwndDlg, msgText, dat->type2str(), MB_YESNO|MB_SETFOREGROUND) == IDYES) {
dat->ppro->DeleteMucListItem(dat, (TCHAR*)lvi.lParam);
mir_free((void *)lvi.lParam);
diff --git a/protocols/JabberG/src/jabber_menu.cpp b/protocols/JabberG/src/jabber_menu.cpp
index f100a5afbf..727f31b3a4 100644
--- a/protocols/JabberG/src/jabber_menu.cpp
+++ b/protocols/JabberG/src/jabber_menu.cpp
@@ -64,7 +64,7 @@ static PresenceModeArray[] =
{ SKINICON_STATUS_DND, ID_STATUS_DND },
{ SKINICON_STATUS_FREE4CHAT, ID_STATUS_FREECHAT },
};
-static HGENMENU g_hMenuDirectPresence[SIZEOF(PresenceModeArray) + 1];
+static HGENMENU g_hMenuDirectPresence[_countof(PresenceModeArray) + 1];
static INT_PTR JabberMenuChooseService(WPARAM wParam, LPARAM lParam)
{
@@ -287,9 +287,9 @@ void g_MenuInit(void)
g_hMenuDirectPresence[0] = Menu_AddContactMenuItem(&mi);
mi.flags |= CMIF_ROOTHANDLE | CMIF_TCHAR;
- for (int i=0; i < SIZEOF(PresenceModeArray); i++) {
+ for (int i=0; i < _countof(PresenceModeArray); i++) {
char buf[] = "Jabber/DirectPresenceX";
- buf[SIZEOF(buf)-2] = '0' + i;
+ buf[_countof(buf)-2] = '0' + i;
mi.pszService = buf;
mi.ptszName = pcli->pfnGetStatusModeDescription(PresenceModeArray[i].mode, 0);
mi.position = -1999901000;
@@ -368,7 +368,7 @@ int CJabberProto::OnPrebuildContactMenu(WPARAM hContact, LPARAM)
return 0;
Menu_ShowItem(g_hMenuDirectPresence[0], TRUE);
- for (int i=0; i < SIZEOF(PresenceModeArray); i++) {
+ for (int i=0; i < _countof(PresenceModeArray); i++) {
CLISTMENUITEM clmi = { sizeof(clmi) };
clmi.flags = CMIM_ICON | CMIM_FLAGS;
clmi.hIcon = (HICON)Skin_LoadProtoIcon(m_szModuleName, PresenceModeArray[i].mode);
@@ -445,7 +445,7 @@ int CJabberProto::OnPrebuildContactMenu(WPARAM hContact, LPARAM)
CMString szTmp;
for (int i=0; i < nMenuResourceItemsNew; i++) {
- mir_snprintf(tDest, SIZEOF(text) - nModuleNameLength, "/UseResource_%d", i);
+ mir_snprintf(tDest, _countof(text) - nModuleNameLength, "/UseResource_%d", i);
if (i >= m_nMenuResourceItems) {
CreateProtoServiceParam(tDest, &CJabberProto::OnMenuHandleResource, MENUITEM_RESOURCES+i);
mi.pszName = "";
@@ -734,19 +734,19 @@ void CJabberProto::MenuInit()
mi.flags = CMIF_CHILDPOPUP | CMIF_TCHAR | CMIF_KEEPUNTRANSLATED;
mi.hParentMenu = m_hMenuPriorityRoot;
- mir_snprintf(srvFce, SIZEOF(srvFce), "%s/menuSetPriority/0", m_szModuleName);
+ mir_snprintf(srvFce, _countof(srvFce), "%s/menuSetPriority/0", m_szModuleName);
bool needServices = !ServiceExists(srvFce);
if (needServices)
CreateProtoServiceParam(svcName, &CJabberProto::OnMenuSetPriority, 0);
int steps[] = { 10, 5, 1, 0, -1, -5, -10 };
- for (int i = 0; i < SIZEOF(steps); i++) {
+ for (int i = 0; i < _countof(steps); i++) {
if (!steps[i]) {
mi.position += 100000;
continue;
}
- mir_snprintf(srvFce, SIZEOF(srvFce), "%s/menuSetPriority/%d", m_szModuleName, steps[i]);
+ mir_snprintf(srvFce, _countof(srvFce), "%s/menuSetPriority/%d", m_szModuleName, steps[i]);
if (steps[i] > 0) {
mir_sntprintf(szName, TranslateT("Increase priority by %d"), steps[i]);
mi.icolibItem = GetIconHandle(IDI_ARROW_UP);
@@ -1004,7 +1004,7 @@ int CJabberProto::OnProcessSrmmEvent(WPARAM, LPARAM lParam)
return 0;
TCHAR jid[JABBER_MAX_JID_LEN];
- if (GetClientJID(event->hContact, jid, SIZEOF(jid))) {
+ if (GetClientJID(event->hContact, jid, _countof(jid))) {
pResourceStatus r(ResourceInfoFromJID(jid));
if (r && r->m_bMessageSessionActive) {
r->m_bMessageSessionActive = FALSE;
diff --git a/protocols/JabberG/src/jabber_misc.cpp b/protocols/JabberG/src/jabber_misc.cpp
index 6c9372874b..e0961c2a9f 100644
--- a/protocols/JabberG/src/jabber_misc.cpp
+++ b/protocols/JabberG/src/jabber_misc.cpp
@@ -61,8 +61,8 @@ int JabberCompareJids(const TCHAR *jid1, const TCHAR *jid2)
// match only node@domain part
TCHAR szTempJid1[JABBER_MAX_JID_LEN], szTempJid2[JABBER_MAX_JID_LEN];
return mir_tstrcmpi(
- JabberStripJid(jid1, szTempJid1, SIZEOF(szTempJid1)),
- JabberStripJid(jid2, szTempJid2, SIZEOF(szTempJid2)));
+ JabberStripJid(jid1, szTempJid1, _countof(szTempJid1)),
+ JabberStripJid(jid2, szTempJid2, _countof(szTempJid2)));
}
///////////////////////////////////////////////////////////////////////////////
@@ -361,14 +361,14 @@ void CJabberProto::FormatMirVer(pResourceStatus &resource, CMString &res)
int i;
// search through known software list
- for (i = 0; i < SIZEOF(sttCapsNodeToName_Map); i++)
+ for (i = 0; i < _countof(sttCapsNodeToName_Map); i++)
if (_tcsstr(resource->m_tszCapsNode, sttCapsNodeToName_Map[i].node)) {
res.Format(_T("%s %s"), sttCapsNodeToName_Map[i].name, resource->m_tszCapsVer);
break;
}
// unknown software
- if (i == SIZEOF(sttCapsNodeToName_Map))
+ if (i == _countof(sttCapsNodeToName_Map))
res.Format(_T("%s %s"), resource->m_tszCapsNode, resource->m_tszCapsVer);
}
@@ -407,9 +407,9 @@ void CJabberProto::UpdateMirVer(MCONTACT hContact, pResourceStatus &resource)
TCHAR szFullJid[JABBER_MAX_JID_LEN];
if (resource->m_tszResourceName && !_tcschr(jid, '/'))
- mir_sntprintf(szFullJid, SIZEOF(szFullJid), _T("%s/%s"), jid, resource->m_tszResourceName);
+ mir_sntprintf(szFullJid, _countof(szFullJid), _T("%s/%s"), jid, resource->m_tszResourceName);
else
- mir_tstrncpy(szFullJid, jid, SIZEOF(szFullJid));
+ mir_tstrncpy(szFullJid, jid, _countof(szFullJid));
setTString(hContact, DBSETTING_DISPLAY_UID, szFullJid);
}
diff --git a/protocols/JabberG/src/jabber_opt.cpp b/protocols/JabberG/src/jabber_opt.cpp
index df53cb80f4..f521cdcbfe 100644
--- a/protocols/JabberG/src/jabber_opt.cpp
+++ b/protocols/JabberG/src/jabber_opt.cpp
@@ -437,7 +437,7 @@ protected:
// fill predefined resources
TCHAR *szResources[] = { _T("Home"), _T("Work"), _T("Office"), _T("Miranda") };
- for (int i=0; i < SIZEOF(szResources); i++)
+ for (int i=0; i < _countof(szResources); i++)
m_cbResource.AddString(szResources[i]);
// append computer name to the resource list
@@ -546,7 +546,7 @@ private:
if (!m_proto->EnterString(buf, TranslateT("Confirm password"), ESF_PASSWORD))
return;
- m_txtPassword.GetText(pass, SIZEOF(pass));
+ m_txtPassword.GetText(pass, _countof(pass));
if (mir_tstrcmp(buf, pass)) {
MessageBox(m_hwnd, TranslateT("Passwords do not match."), _T("Miranda NG"), MB_ICONSTOP|MB_OK);
return;
@@ -558,12 +558,12 @@ private:
SendMessage(m_hwnd, WM_NOTIFY, 0, (LPARAM)&pshn);
JABBER_CONN_DATA regInfo;
- m_txtUsername.GetText(regInfo.username, SIZEOF(regInfo.username));
- m_txtPassword.GetText(regInfo.password, SIZEOF(regInfo.password));
- m_cbServer.GetTextA(regInfo.server, SIZEOF(regInfo.server));
+ m_txtUsername.GetText(regInfo.username, _countof(regInfo.username));
+ m_txtPassword.GetText(regInfo.password, _countof(regInfo.password));
+ m_cbServer.GetTextA(regInfo.server, _countof(regInfo.server));
if (m_chkManualHost.GetState() == BST_CHECKED) {
regInfo.port = (WORD)m_txtManualPort.GetInt();
- m_txtManualHost.GetTextA(regInfo.manualHost, SIZEOF(regInfo.manualHost));
+ m_txtManualHost.GetTextA(regInfo.manualHost, _countof(regInfo.manualHost));
}
else {
regInfo.port = (WORD)m_txtPort.GetInt();
@@ -677,12 +677,12 @@ private:
void CheckRegistration()
{
JABBER_CONN_DATA regInfo;
- m_txtUsername.GetText(regInfo.username, SIZEOF(regInfo.username));
- m_txtPassword.GetText(regInfo.password, SIZEOF(regInfo.password));
- m_cbServer.GetTextA(regInfo.server, SIZEOF(regInfo.server));
+ m_txtUsername.GetText(regInfo.username, _countof(regInfo.username));
+ m_txtPassword.GetText(regInfo.password, _countof(regInfo.password));
+ m_cbServer.GetTextA(regInfo.server, _countof(regInfo.server));
if (m_chkManualHost.GetState() == BST_CHECKED) {
regInfo.port = (WORD)m_txtManualPort.GetInt();
- m_txtManualHost.GetTextA(regInfo.manualHost, SIZEOF(regInfo.manualHost));
+ m_txtManualHost.GetTextA(regInfo.manualHost, _countof(regInfo.manualHost));
}
else {
regInfo.port = (WORD)m_txtPort.GetInt();
@@ -1058,10 +1058,10 @@ void CJabberProto::_RosterHandleGetRequest(HXML node, CJabberIqInfo*)
TCHAR name[260]=_T("");
TCHAR group[260]=_T("");
TCHAR subscr[260]=_T("");
- ListView_GetItemText(hList, index, 0, jid, SIZEOF(jid));
- ListView_GetItemText(hList, index, 1, name, SIZEOF(name));
- ListView_GetItemText(hList, index, 2, group, SIZEOF(group));
- ListView_GetItemText(hList, index, 3, subscr, SIZEOF(subscr));
+ ListView_GetItemText(hList, index, 0, jid, _countof(jid));
+ ListView_GetItemText(hList, index, 1, name, _countof(name));
+ ListView_GetItemText(hList, index, 2, group, _countof(group));
+ ListView_GetItemText(hList, index, 3, subscr, _countof(subscr));
HXML itemRoster = xmlGetChildByTag(queryRoster, "item", "jid", jid);
BOOL bRemove = !ListView_GetCheckState(hList,index);
if (itemRoster && bRemove) {
@@ -1179,7 +1179,7 @@ void CJabberProto::_RosterExportToFile(HWND hwndDlg)
TCHAR filename[MAX_PATH] = { 0 };
TCHAR filter[MAX_PATH];
- mir_sntprintf(filter, SIZEOF(filter), _T("%s (*.xml)%c*.xml%c%c"), TranslateT("XML for MS Excel (UTF-8 encoded)"), 0, 0, 0);
+ mir_sntprintf(filter, _countof(filter), _T("%s (*.xml)%c*.xml%c%c"), TranslateT("XML for MS Excel (UTF-8 encoded)"), 0, 0, 0);
OPENFILENAME ofn = { 0 };
ofn.lStructSize = OPENFILENAME_SIZE_VERSION_400;
ofn.hwndOwner = hwndDlg;
@@ -1187,7 +1187,7 @@ void CJabberProto::_RosterExportToFile(HWND hwndDlg)
ofn.lpstrFilter = filter;
ofn.lpstrFile = filename;
ofn.Flags = OFN_HIDEREADONLY;
- ofn.nMaxFile = SIZEOF(filename);
+ ofn.nMaxFile = _countof(filename);
ofn.nMaxFileTitle = MAX_PATH;
ofn.lpstrDefExt = _T("xml");
if (!GetSaveFileName(&ofn)) return;
@@ -1214,10 +1214,10 @@ void CJabberProto::_RosterExportToFile(HWND hwndDlg)
TCHAR name[260]=_T("");
TCHAR group[260]=_T("");
TCHAR subscr[260]=_T("");
- ListView_GetItemText(hList, index, 0, jid, SIZEOF(jid));
- ListView_GetItemText(hList, index, 1, name, SIZEOF(name));
- ListView_GetItemText(hList, index, 2, group, SIZEOF(group));
- ListView_GetItemText(hList, index, 3, subscr, SIZEOF(subscr));
+ ListView_GetItemText(hList, index, 0, jid, _countof(jid));
+ ListView_GetItemText(hList, index, 1, name, _countof(name));
+ ListView_GetItemText(hList, index, 2, group, _countof(group));
+ ListView_GetItemText(hList, index, 3, subscr, _countof(subscr));
HXML node = table << XCHILD(_T("Row"));
node << XCHILD(_T("Cell")) << XCHILD(_T("Data"), _T("+")) << XATTR(_T("ss:Type"), _T("String"));
@@ -1248,7 +1248,7 @@ void CJabberProto::_RosterImportFromFile(HWND hwndDlg)
ofn.lpstrFilter = filter;
ofn.lpstrFile = filename;
ofn.Flags = OFN_FILEMUSTEXIST | OFN_HIDEREADONLY;
- ofn.nMaxFile = SIZEOF(filename);
+ ofn.nMaxFile = _countof(filename);
ofn.nMaxFileTitle = MAX_PATH;
ofn.lpstrDefExt = "xml";
if (!GetOpenFileNameA(&ofn))
@@ -1351,7 +1351,7 @@ static LRESULT CALLBACK _RosterNewListProc(HWND hList, UINT msg, WPARAM wParam,
RECT rc;
TCHAR buff[260];
ListView_GetSubItemRect(hList, lvhti.iItem, lvhti.iSubItem, LVIR_BOUNDS,&rc);
- ListView_GetItemText(hList, lvhti.iItem, lvhti.iSubItem, buff, SIZEOF(buff));
+ ListView_GetItemText(hList, lvhti.iItem, lvhti.iSubItem, buff, _countof(buff));
HWND hEditor=CreateWindow(TEXT("EDIT"),buff,WS_CHILD|ES_AUTOHSCROLL,rc.left+3, rc.top+2, rc.right-rc.left-3, rc.bottom - rc.top-3,hList, NULL, hInst, NULL);
SendMessage(hEditor,WM_SETFONT,(WPARAM)SendMessage(hList,WM_GETFONT,0,0),0);
ShowWindow(hEditor,SW_SHOW);
@@ -1593,7 +1593,7 @@ protected:
// fill predefined resources
TCHAR *szResources[] = { _T("Home"), _T("Work"), _T("Office"), _T("Miranda") };
- for (int i=0; i < SIZEOF(szResources); i++)
+ for (int i=0; i < _countof(szResources); i++)
m_cbResource.AddString(szResources[i]);
// append computer name to the resource list
@@ -1619,10 +1619,10 @@ protected:
m_cbType.AddString(TranslateT("S.ms"), ACC_SMS);
char server[256], manualServer[256]={0};
- m_cbServer.GetTextA(server, SIZEOF(server));
+ m_cbServer.GetTextA(server, _countof(server));
ptrA dbManualServer( db_get_sa(NULL, m_proto->m_szModuleName, "ManualHost"));
if (dbManualServer != NULL)
- mir_strncpy(manualServer, dbManualServer, SIZEOF(manualServer));
+ mir_strncpy(manualServer, dbManualServer, _countof(manualServer));
m_canregister = true;
if (!mir_strcmp(manualServer, "talk.google.com")) {
@@ -1696,7 +1696,7 @@ protected:
TCHAR szCompName[MAX_COMPUTERNAME_LENGTH + 1], szResource[MAX_COMPUTERNAME_LENGTH + 1];
DWORD dwCompNameLength = MAX_COMPUTERNAME_LENGTH;
if (GetComputerName(szCompName, &dwCompNameLength)) {
- m_cbResource.GetText(szResource, SIZEOF(szResource));
+ m_cbResource.GetText(szResource, _countof(szResource));
if (!mir_tstrcmp(szCompName, szResource))
bUseHostnameAsResource = TRUE;
}
@@ -1750,8 +1750,8 @@ protected:
char server[256];
char manualServer[256];
- m_cbServer.GetTextA(server, SIZEOF(server));
- m_txtManualHost.GetTextA(manualServer, SIZEOF(manualServer));
+ m_cbServer.GetTextA(server, _countof(server));
+ m_txtManualHost.GetTextA(manualServer, _countof(manualServer));
if ((m_chkManualHost.GetState() == BST_CHECKED) && mir_strcmp(server, manualServer)) {
m_proto->m_options.ManualConnect = TRUE;
@@ -1808,7 +1808,7 @@ private:
return;
TCHAR pass[512];
- m_txtPassword.GetText(pass, SIZEOF(pass));
+ m_txtPassword.GetText(pass, _countof(pass));
if (mir_tstrcmp(buf, pass)) {
MessageBox(m_hwnd, TranslateT("Passwords do not match."), _T("Miranda NG"), MB_ICONSTOP|MB_OK);
return;
@@ -1820,12 +1820,12 @@ private:
SendMessage(m_hwnd, WM_NOTIFY, 0, (LPARAM)&pshn);
JABBER_CONN_DATA regInfo;
- m_txtUsername.GetText(regInfo.username, SIZEOF(regInfo.username));
- m_txtPassword.GetText(regInfo.password, SIZEOF(regInfo.password));
- m_cbServer.GetTextA(regInfo.server, SIZEOF(regInfo.server));
+ m_txtUsername.GetText(regInfo.username, _countof(regInfo.username));
+ m_txtPassword.GetText(regInfo.password, _countof(regInfo.password));
+ m_cbServer.GetTextA(regInfo.server, _countof(regInfo.server));
regInfo.port = (WORD)m_txtPort.GetInt();
if (m_chkManualHost.GetState() == BST_CHECKED)
- m_txtManualHost.GetTextA(regInfo.manualHost, SIZEOF(regInfo.manualHost));
+ m_txtManualHost.GetTextA(regInfo.manualHost, _countof(regInfo.manualHost));
else
regInfo.manualHost[0] = '\0';
@@ -1867,7 +1867,7 @@ private:
if (chk->GetState() == BST_CHECKED) {
char buf[256];
- m_cbServer.GetTextA(buf, SIZEOF(buf));
+ m_cbServer.GetTextA(buf, _countof(buf));
m_txtManualHost.SetTextA(buf);
m_txtPort.SetInt(5222);
@@ -1902,12 +1902,12 @@ void CJabberDlgAccMgrUI::CheckRegistration()
}
JABBER_CONN_DATA regInfo;
- m_txtUsername.GetText(regInfo.username, SIZEOF(regInfo.username));
- m_txtPassword.GetText(regInfo.password, SIZEOF(regInfo.password));
- m_cbServer.GetTextA(regInfo.server, SIZEOF(regInfo.server));
+ m_txtUsername.GetText(regInfo.username, _countof(regInfo.username));
+ m_txtPassword.GetText(regInfo.password, _countof(regInfo.password));
+ m_cbServer.GetTextA(regInfo.server, _countof(regInfo.server));
regInfo.port = m_txtPort.GetInt();
if (m_chkManualHost.GetState() == BST_CHECKED)
- m_txtManualHost.GetTextA(regInfo.manualHost, SIZEOF(regInfo.manualHost));
+ m_txtManualHost.GetTextA(regInfo.manualHost, _countof(regInfo.manualHost));
else
regInfo.manualHost[0] = '\0';
diff --git a/protocols/JabberG/src/jabber_password.cpp b/protocols/JabberG/src/jabber_password.cpp
index e36ed79c55..8b047cc134 100644
--- a/protocols/JabberG/src/jabber_password.cpp
+++ b/protocols/JabberG/src/jabber_password.cpp
@@ -59,13 +59,13 @@ static INT_PTR CALLBACK JabberChangePasswordDlgProc(HWND hwndDlg, UINT msg, WPAR
case IDOK:
if (ppro->m_bJabberOnline && ppro->m_ThreadInfo != NULL) {
TCHAR newPasswd[512], text[512];
- GetDlgItemText(hwndDlg, IDC_NEWPASSWD, newPasswd, SIZEOF(newPasswd));
- GetDlgItemText(hwndDlg, IDC_NEWPASSWD2, text, SIZEOF(text));
+ GetDlgItemText(hwndDlg, IDC_NEWPASSWD, newPasswd, _countof(newPasswd));
+ GetDlgItemText(hwndDlg, IDC_NEWPASSWD2, text, _countof(text));
if (mir_tstrcmp(newPasswd, text)) {
MessageBox(hwndDlg, TranslateT("New password does not match."), TranslateT("Change Password"), MB_OK|MB_ICONSTOP|MB_SETFOREGROUND);
break;
}
- GetDlgItemText(hwndDlg, IDC_OLDPASSWD, text, SIZEOF(text));
+ GetDlgItemText(hwndDlg, IDC_OLDPASSWD, text, _countof(text));
if (mir_tstrcmp(text, ppro->m_ThreadInfo->conn.password)) {
MessageBox(hwndDlg, TranslateT("Current password is incorrect."), TranslateT("Change Password"), MB_OK|MB_ICONSTOP|MB_SETFOREGROUND);
break;
diff --git a/protocols/JabberG/src/jabber_privacy.cpp b/protocols/JabberG/src/jabber_privacy.cpp
index 558d70b028..2a8a556305 100644
--- a/protocols/JabberG/src/jabber_privacy.cpp
+++ b/protocols/JabberG/src/jabber_privacy.cpp
@@ -314,7 +314,7 @@ public:
void btnOk_OnClick(CCtrlButton*)
{
- GetDlgItemText(m_hwnd, IDC_EDIT_NAME, szLine, SIZEOF(szLine));
+ GetDlgItemText(m_hwnd, IDC_EDIT_NAME, szLine, _countof(szLine));
EndDialog(m_hwnd, 1);
}
void btnCancel_OnClick(CCtrlButton*)
@@ -369,7 +369,7 @@ public:
TCHAR *szTypes[] = { _T("JID"), _T("Group"), _T("Subscription"), _T("Any") };
int i, nTypes[] = { Jid, Group, Subscription, Else };
- for (i=0; i < SIZEOF(szTypes); i++) {
+ for (i=0; i < _countof(szTypes); i++) {
LRESULT nItem = SendDlgItemMessage(m_hwnd, IDC_COMBO_TYPE, CB_ADDSTRING, 0, (LPARAM)TranslateTS(szTypes[i]));
SendDlgItemMessage(m_hwnd, IDC_COMBO_TYPE, CB_SETITEMDATA, nItem, nTypes[i]);
if (m_pRule->GetType() == nTypes[i])
@@ -378,7 +378,7 @@ public:
SendDlgItemMessage(m_hwnd, IDC_COMBO_VALUE, CB_RESETCONTENT, 0, 0);
TCHAR *szSubscriptions[] = { _T("none"), _T("from"), _T("to"), _T("both") };
- for (i=0; i < SIZEOF(szSubscriptions); i++) {
+ for (i=0; i < _countof(szSubscriptions); i++) {
LRESULT nItem = SendDlgItemMessage(m_hwnd, IDC_COMBO_VALUE, CB_ADDSTRING, 0, (LPARAM)TranslateTS(szSubscriptions[i]));
SendDlgItemMessage(m_hwnd, IDC_COMBO_VALUE, CB_SETITEMDATA, nItem, (LPARAM)szSubscriptions[i]);
}
@@ -497,7 +497,7 @@ public:
case Group:
{
TCHAR szText[ 512 ];
- GetDlgItemText(m_hwnd, IDC_COMBO_VALUES, szText, SIZEOF(szText));
+ GetDlgItemText(m_hwnd, IDC_COMBO_VALUES, szText, _countof(szText));
m_pRule->SetValue(szText);
}
break;
@@ -946,7 +946,7 @@ BOOL CJabberDlgPrivacyLists::OnWmDrawItem(UINT, WPARAM, LPARAM lParam)
DrawLists(lpdis);
else if (lpdis->CtlID == IDC_CANVAS) {
int i, totalWidth = -5; // spacing for last item
- for (i=0; i < SIZEOF(drawItems); i++) {
+ for (i=0; i < _countof(drawItems); i++) {
SIZE sz = {0};
drawItems[i].text = TranslateTS(drawItems[i].textEng);
GetTextExtentPoint32(lpdis->hDC, drawItems[i].text, (int)mir_tstrlen(drawItems[i].text), &sz);
@@ -957,7 +957,7 @@ BOOL CJabberDlgPrivacyLists::OnWmDrawItem(UINT, WPARAM, LPARAM lParam)
RECT rc = lpdis->rcItem;
rc.left = (rc.left + rc.right - totalWidth)/2;
- for (i=0; i < SIZEOF(drawItems); i++) {
+ for (i=0; i < _countof(drawItems); i++) {
DrawIconEx(lpdis->hDC, rc.left, (rc.top+rc.bottom-16)/2, m_proto->LoadIconEx(drawItems[i].icon),
16, 16, 0, NULL, DI_NORMAL);
rc.left += 18;
@@ -991,16 +991,16 @@ void CJabberDlgPrivacyLists::ShowAdvancedList(CPrivacyList *pList)
TCHAR szTypeValue[ 512 ];
switch (pRule->GetType()) {
case Jid:
- mir_sntprintf(szTypeValue, SIZEOF(szTypeValue), _T("If Jabber ID is '%s' then"), pRule->GetValue());
+ mir_sntprintf(szTypeValue, _countof(szTypeValue), _T("If Jabber ID is '%s' then"), pRule->GetValue());
break;
case Group:
- mir_sntprintf(szTypeValue, SIZEOF(szTypeValue), _T("If group is '%s' then"), pRule->GetValue());
+ mir_sntprintf(szTypeValue, _countof(szTypeValue), _T("If group is '%s' then"), pRule->GetValue());
break;
case Subscription:
- mir_sntprintf(szTypeValue, SIZEOF(szTypeValue), _T("If subscription is '%s' then"), pRule->GetValue());
+ mir_sntprintf(szTypeValue, _countof(szTypeValue), _T("If subscription is '%s' then"), pRule->GetValue());
break;
case Else:
- mir_sntprintf(szTypeValue, SIZEOF(szTypeValue), _T("Else"));
+ mir_sntprintf(szTypeValue, _countof(szTypeValue), _T("Else"));
break;
}
@@ -1033,7 +1033,7 @@ void CJabberDlgPrivacyLists::ShowAdvancedList(CPrivacyList *pList)
}
TCHAR szListItem[ 512 ];
- mir_sntprintf(szListItem, SIZEOF(szListItem), _T("%s %s %s"), szTypeValue, pRule->GetAction() ? _T("allow") : _T("deny"), szPackets);
+ mir_sntprintf(szListItem, _countof(szListItem), _T("%s %s %s"), szTypeValue, pRule->GetAction() ? _T("allow") : _T("deny"), szPackets);
LRESULT nItemId = SendDlgItemMessage(m_hwnd, IDC_PL_RULES_LIST, LB_ADDSTRING, 0, (LPARAM)szListItem);
SendDlgItemMessage(m_hwnd, IDC_PL_RULES_LIST, LB_SETITEMDATA, nItemId, (LPARAM)pRule);
@@ -2101,7 +2101,7 @@ void CJabberProto::BuildPrivacyMenu()
CreateProtoService("/PrivacyLists", &CJabberProto::OnMenuHandlePrivacyLists);
char srvFce[MAX_PATH + 64];
- mir_snprintf(srvFce, SIZEOF(srvFce), "%s/PrivacyLists", m_szModuleName);
+ mir_snprintf(srvFce, _countof(srvFce), "%s/PrivacyLists", m_szModuleName);
mi.pszService = srvFce;
mi.position = 3000040000;
mi.flags = CMIF_CHILDPOPUP | CMIF_TCHAR;
@@ -2130,7 +2130,7 @@ void CJabberProto::BuildPrivacyListsMenu(bool bDeleteOld)
mi.pszService = srvFce;
int i = 0;
- mir_snprintf(srvFce, SIZEOF(srvFce), "%s/menuPrivacy%d", m_szModuleName, i);
+ mir_snprintf(srvFce, _countof(srvFce), "%s/menuPrivacy%d", m_szModuleName, i);
if (i > m_privacyMenuServiceAllocated) {
CreateProtoServiceParam(svcName, &CJabberProto::menuSetPrivacyList, i);
m_privacyMenuServiceAllocated = i;
@@ -2142,7 +2142,7 @@ void CJabberProto::BuildPrivacyListsMenu(bool bDeleteOld)
for (CPrivacyList *pList = m_privacyListManager.GetFirstList(); pList; pList = pList->GetNext()) {
i++;
- mir_snprintf(srvFce, SIZEOF(srvFce), "%s/menuPrivacy%d", m_szModuleName, i);
+ mir_snprintf(srvFce, _countof(srvFce), "%s/menuPrivacy%d", m_szModuleName, i);
if (i > m_privacyMenuServiceAllocated) {
CreateProtoServiceParam(svcName, &CJabberProto::menuSetPrivacyList, i);
diff --git a/protocols/JabberG/src/jabber_proto.cpp b/protocols/JabberG/src/jabber_proto.cpp
index 076e76aeca..3ea5af5ddf 100644
--- a/protocols/JabberG/src/jabber_proto.cpp
+++ b/protocols/JabberG/src/jabber_proto.cpp
@@ -46,8 +46,8 @@ static int compareListItems(const JABBER_LIST_ITEM *p1, const JABBER_LIST_ITEM *
return mir_tstrcmpi(p1->jid, p2->jid);
TCHAR szp1[JABBER_MAX_JID_LEN], szp2[JABBER_MAX_JID_LEN];
- JabberStripJid(p1->jid, szp1, SIZEOF(szp1));
- JabberStripJid(p2->jid, szp2, SIZEOF(szp2));
+ JabberStripJid(p1->jid, szp1, _countof(szp1));
+ JabberStripJid(p2->jid, szp2, _countof(szp2));
return mir_tstrcmpi(szp1, szp2);
}
@@ -577,7 +577,7 @@ DWORD_PTR __cdecl CJabberProto::GetCaps(int type, MCONTACT hContact)
return (DWORD_PTR)"jid";
case PFLAG_MAXCONTACTSPERPACKET:
TCHAR szClientJid[JABBER_MAX_JID_LEN];
- if (GetClientJID(hContact, szClientJid, SIZEOF(szClientJid))) {
+ if (GetClientJID(hContact, szClientJid, _countof(szClientJid))) {
JabberCapsBits jcb = GetResourceCapabilites(szClientJid, TRUE);
return ((~jcb & JABBER_CAPS_ROSTER_EXCHANGE) ? 0 : 50);
}
@@ -594,10 +594,10 @@ int __cdecl CJabberProto::GetInfo(MCONTACT hContact, int /*infoType*/)
return 1;
TCHAR jid[JABBER_MAX_JID_LEN], szBareJid[JABBER_MAX_JID_LEN];
- if (!GetClientJID(hContact, jid, SIZEOF(jid)))
+ if (!GetClientJID(hContact, jid, _countof(jid)))
return 1;
- JabberStripJid(jid, szBareJid, SIZEOF(szBareJid));
+ JabberStripJid(jid, szBareJid, _countof(szBareJid));
bool bUseResource = ListGetItemPtr(LIST_CHATROOM, szBareJid) != NULL;
if (m_ThreadInfo) {
@@ -633,7 +633,7 @@ int __cdecl CJabberProto::GetInfo(MCONTACT hContact, int /*infoType*/)
for (int i=0; i < item->arResources.getCount(); i++) {
pResourceStatus r(item->arResources[i]);
TCHAR tmp[JABBER_MAX_JID_LEN];
- mir_sntprintf(tmp, SIZEOF(tmp), _T("%s/%s"), szBareJid, r->m_tszResourceName);
+ mir_sntprintf(tmp, _countof(tmp), _T("%s/%s"), szBareJid, r->m_tszResourceName);
if (r->m_jcbCachedCaps & JABBER_CAPS_DISCO_INFO) {
XmlNodeIq iq5(AddIQ(&CJabberProto::OnIqResultCapsDiscoInfoSI, JABBER_IQ_TYPE_GET, tmp, JABBER_IQ_PARSE_FROM | JABBER_IQ_PARSE_CHILD_TAG_NODE | JABBER_IQ_PARSE_HCONTACT));
@@ -716,7 +716,7 @@ HANDLE __cdecl CJabberProto::SearchBasic(const TCHAR *szJid)
mir_free(szServer);
szServer = mir_tstrdup(_T("sms"));
}
- mir_sntprintf(jsb->jid, SIZEOF(jsb->jid), _T("%s@%s"), szJid, szServer);
+ mir_sntprintf(jsb->jid, _countof(jsb->jid), _T("%s@%s"), szJid, szServer);
}
else _tcsncpy_s(jsb->jid, szJid, _TRUNCATE);
mir_free(szServer);
@@ -813,7 +813,7 @@ int __cdecl CJabberProto::SendContacts(MCONTACT hContact, int, int nContacts, MC
return 0;
TCHAR szClientJid[JABBER_MAX_JID_LEN];
- if (!GetClientJID(hContact, szClientJid, SIZEOF(szClientJid)))
+ if (!GetClientJID(hContact, szClientJid, _countof(szClientJid)))
return 0;
JabberCapsBits jcb = GetResourceCapabilites(szClientJid, TRUE);
@@ -952,7 +952,7 @@ static char PGP_EPILOG[] = "\r\n-----END PGP MESSAGE-----\r\n";
int __cdecl CJabberProto::SendMsg(MCONTACT hContact, int, const char* pszSrc)
{
TCHAR szClientJid[JABBER_MAX_JID_LEN];
- if (!m_bJabberOnline || !GetClientJID(hContact, szClientJid, SIZEOF(szClientJid))) {
+ if (!m_bJabberOnline || !GetClientJID(hContact, szClientJid, _countof(szClientJid))) {
TFakeAckParams *param = new TFakeAckParams(hContact, Translate("Protocol is offline or no JID"));
ForkThread(&CJabberProto::SendMessageAckThread, param);
return 1;
@@ -1239,7 +1239,7 @@ int __cdecl CJabberProto::UserIsTyping(MCONTACT hContact, int type)
if (!m_bJabberOnline) return 0;
TCHAR szClientJid[JABBER_MAX_JID_LEN];
- if (!GetClientJID(hContact, szClientJid, SIZEOF(szClientJid)))
+ if (!GetClientJID(hContact, szClientJid, _countof(szClientJid)))
return 0;
JABBER_LIST_ITEM *item = ListGetItemPtr(LIST_ROSTER, szClientJid);
diff --git a/protocols/JabberG/src/jabber_rc.cpp b/protocols/JabberG/src/jabber_rc.cpp
index a2ac93a80d..6e11c3c324 100644
--- a/protocols/JabberG/src/jabber_rc.cpp
+++ b/protocols/JabberG/src/jabber_rc.cpp
@@ -310,7 +310,7 @@ int CJabberProto::AdhocSetStatusHandler(HXML, CJabberIqInfo *pInfo, CJabberAdhoc
// priority
TCHAR szPriority[ 256 ];
- mir_sntprintf(szPriority, SIZEOF(szPriority), _T("%d"), (short)getWord("Priority", 5));
+ mir_sntprintf(szPriority, _countof(szPriority), _T("%d"), (short)getWord("Priority", 5));
xNode << XCHILD(_T("field")) << XATTR(_T("label"), TranslateT("Priority")) << XATTR(_T("type"), _T("text-single"))
<< XATTR(_T("var"), _T("status-priority")) << XCHILD(_T("value"), szPriority);
@@ -414,12 +414,12 @@ int CJabberProto::AdhocOptionsHandler(HXML, CJabberIqInfo *pInfo, CJabberAdhocSe
// Automatically Accept File Transfers
TCHAR szTmpBuff[ 1024 ];
- mir_sntprintf(szTmpBuff, SIZEOF(szTmpBuff), _T("%d"), db_get_b(NULL, "SRFile", "AutoAccept", 0));
+ mir_sntprintf(szTmpBuff, _countof(szTmpBuff), _T("%d"), db_get_b(NULL, "SRFile", "AutoAccept", 0));
xNode << XCHILD(_T("field")) << XATTR(_T("label"), TranslateT("Automatically Accept File Transfers"))
<< XATTR(_T("type"), _T("boolean")) << XATTR(_T("var"), _T("auto-files")) << XCHILD(_T("value"), szTmpBuff);
// Use sounds
- mir_sntprintf(szTmpBuff, SIZEOF(szTmpBuff), _T("%d"), db_get_b(NULL, "Skin", "UseSound", 0));
+ mir_sntprintf(szTmpBuff, _countof(szTmpBuff), _T("%d"), db_get_b(NULL, "Skin", "UseSound", 0));
xNode << XCHILD(_T("field")) << XATTR(_T("label"), TranslateT("Play sounds"))
<< XATTR(_T("type"), _T("boolean")) << XATTR(_T("var"), _T("sounds")) << XCHILD(_T("value"), szTmpBuff);
@@ -495,7 +495,7 @@ int CJabberProto::AdhocForwardHandler(HXML, CJabberIqInfo *pInfo, CJabberAdhocSe
if (pSession->GetStage() == 0) {
int nUnreadEvents = RcGetUnreadEventsCount();
if (!nUnreadEvents) {
- mir_sntprintf(szMsg, SIZEOF(szMsg), TranslateT("There is no messages to forward"));
+ mir_sntprintf(szMsg, _countof(szMsg), TranslateT("There is no messages to forward"));
m_ThreadInfo->send(
XmlNodeIq(_T("result"), pInfo)
@@ -517,7 +517,7 @@ int CJabberProto::AdhocForwardHandler(HXML, CJabberIqInfo *pInfo, CJabberAdhocSe
xNode << XCHILD(_T("title"), TranslateT("Forward options"));
- mir_sntprintf(szMsg, SIZEOF(szMsg), TranslateT("%d message(s) to be forwarded"), nUnreadEvents);
+ mir_sntprintf(szMsg, _countof(szMsg), TranslateT("%d message(s) to be forwarded"), nUnreadEvents);
xNode << XCHILD(_T("instructions"), szMsg);
xNode << XCHILD(_T("field")) << XATTR(_T("type"), _T("hidden")) << XATTR(_T("var"), _T("FORM_TYPE"))
@@ -583,7 +583,7 @@ int CJabberProto::AdhocForwardHandler(HXML, CJabberIqInfo *pInfo, CJabberAdhocSe
size_t cbBlob = mir_strlen((LPSTR)dbei.pBlob)+1;
if (cbBlob < dbei.cbBlob) { // rest of message contains a sender's resource
ptrT szOResource( mir_utf8decodeT((LPSTR)dbei.pBlob + cbBlob+1));
- mir_sntprintf(szOFrom, SIZEOF(szOFrom), _T("%s/%s"), tszJid, szOResource);
+ mir_sntprintf(szOFrom, _countof(szOFrom), _T("%s/%s"), tszJid, szOResource);
} else
_tcsncpy_s(szOFrom, tszJid, _TRUNCATE);
@@ -593,7 +593,7 @@ int CJabberProto::AdhocForwardHandler(HXML, CJabberIqInfo *pInfo, CJabberAdhocSe
time_t ltime = (time_t)dbei.timestamp;
struct tm *gmt = gmtime(&ltime);
TCHAR stime[512];
- mir_sntprintf(stime, SIZEOF(stime), _T("%.4i-%.2i-%.2iT%.2i:%.2i:%.2iZ"), gmt->tm_year + 1900, gmt->tm_mon + 1, gmt->tm_mday,
+ mir_sntprintf(stime, _countof(stime), _T("%.4i-%.2i-%.2iT%.2i:%.2i:%.2iZ"), gmt->tm_year + 1900, gmt->tm_mon + 1, gmt->tm_mday,
gmt->tm_hour, gmt->tm_min, gmt->tm_sec);
msg << XCHILDNS(_T("delay"), _T("urn:xmpp:delay")) << XATTR(_T("stamp"), stime);
@@ -607,7 +607,7 @@ int CJabberProto::AdhocForwardHandler(HXML, CJabberIqInfo *pInfo, CJabberAdhocSe
}
}
- mir_sntprintf(szMsg, SIZEOF(szMsg), TranslateT("%d message(s) forwarded"), nEventsSent);
+ mir_sntprintf(szMsg, _countof(szMsg), TranslateT("%d message(s) forwarded"), nEventsSent);
m_ThreadInfo->send(
XmlNodeIq(_T("result"), pInfo)
@@ -627,9 +627,9 @@ int CJabberProto::AdhocLockWSHandler(HXML, CJabberIqInfo *pInfo, CJabberAdhocSes
TCHAR szMsg[ 1024 ];
if (bOk)
- mir_sntprintf(szMsg, SIZEOF(szMsg), TranslateT("Workstation successfully locked"));
+ mir_sntprintf(szMsg, _countof(szMsg), TranslateT("Workstation successfully locked"));
else
- mir_sntprintf(szMsg, SIZEOF(szMsg), TranslateT("Error %d occurred during workstation lock"), GetLastError());
+ mir_sntprintf(szMsg, _countof(szMsg), TranslateT("Error %d occurred during workstation lock"), GetLastError());
m_ThreadInfo->send(
XmlNodeIq(_T("result"), pInfo)
@@ -709,7 +709,7 @@ int CJabberProto::AdhocLeaveGroupchatsHandler(HXML, CJabberIqInfo *pInfo, CJabbe
if (!nChatsCount) {
TCHAR szMsg[ 1024 ];
- mir_sntprintf(szMsg, SIZEOF(szMsg), TranslateT("There is no group chats to leave"));
+ mir_sntprintf(szMsg, _countof(szMsg), TranslateT("There is no group chats to leave"));
m_ThreadInfo->send(
XmlNodeIq(_T("result"), pInfo)
diff --git a/protocols/JabberG/src/jabber_search.cpp b/protocols/JabberG/src/jabber_search.cpp
index af1ebda659..87fcc15b21 100644
--- a/protocols/JabberG/src/jabber_search.cpp
+++ b/protocols/JabberG/src/jabber_search.cpp
@@ -461,7 +461,7 @@ int CJabberProto::SearchRenewFields(HWND hwndDlg, JabberSearchData *dat)
{
TCHAR szServerName[100];
EnableWindow(GetDlgItem(hwndDlg, IDC_GO), FALSE);
- GetDlgItemText(hwndDlg, IDC_SERVER, szServerName, SIZEOF(szServerName));
+ GetDlgItemText(hwndDlg, IDC_SERVER, szServerName, _countof(szServerName));
dat->CurrentHeight = 0;
dat->curPos = 0;
SetScrollPos(GetDlgItem(hwndDlg, IDC_VSCROLL), SB_CTL, 0, FALSE);
@@ -493,21 +493,21 @@ void CJabberProto::SearchDeleteFromRecent(const TCHAR *szAddr, BOOL deleteLastFr
//search in recent
for (int i = 0; i < 10; i++) {
char key[30];
- mir_snprintf(key, SIZEOF(key), "RecentlySearched_%d", i);
+ mir_snprintf(key, _countof(key), "RecentlySearched_%d", i);
ptrT szValue(getTStringA(key));
if (szValue == NULL || mir_tstrcmpi(szAddr, szValue))
continue;
for (int j = i; j < 10; j++) {
- mir_snprintf(key, SIZEOF(key), "RecentlySearched_%d", j + 1);
+ mir_snprintf(key, _countof(key), "RecentlySearched_%d", j + 1);
szValue = getTStringA(key);
if (szValue != NULL) {
- mir_snprintf(key, SIZEOF(key), "RecentlySearched_%d", j);
+ mir_snprintf(key, _countof(key), "RecentlySearched_%d", j);
setTString(NULL, key, szValue);
}
else {
if (deleteLastFromDB) {
- mir_snprintf(key, SIZEOF(key), "RecentlySearched_%d", j);
+ mir_snprintf(key, _countof(key), "RecentlySearched_%d", j);
delSetting(NULL, key);
}
break;
@@ -523,15 +523,15 @@ void CJabberProto::SearchAddToRecent(const TCHAR *szAddr, HWND hwndDialog)
SearchDeleteFromRecent(szAddr);
for (int j = 9; j > 0; j--) {
- mir_snprintf(key, SIZEOF(key), "RecentlySearched_%d", j - 1);
+ mir_snprintf(key, _countof(key), "RecentlySearched_%d", j - 1);
ptrT szValue(getTStringA(key));
if (szValue != NULL) {
- mir_snprintf(key, SIZEOF(key), "RecentlySearched_%d", j);
+ mir_snprintf(key, _countof(key), "RecentlySearched_%d", j);
setTString(NULL, key, szValue);
}
}
- mir_snprintf(key, SIZEOF(key), "RecentlySearched_%d", 0);
+ mir_snprintf(key, _countof(key), "RecentlySearched_%d", 0);
setTString(key, szAddr);
if (hwndDialog)
JabberSearchAddUrlToRecentCombo(hwndDialog, szAddr);
@@ -563,7 +563,7 @@ static INT_PTR CALLBACK JabberSearchAdvancedDlgProc(HWND hwndDlg, UINT msg, WPAR
for (i = 0; i < 10; i++) {
char key[30];
- mir_snprintf(key, SIZEOF(key), "RecentlySearched_%d", i);
+ mir_snprintf(key, _countof(key), "RecentlySearched_%d", i);
ptrT szValue(dat->ppro->getTStringA(key));
if (szValue != NULL)
JabberSearchAddUrlToRecentCombo(hwndDlg, szValue);
@@ -743,7 +743,7 @@ HWND __cdecl CJabberProto::SearchAdvanced(HWND hwndDlg)
// get server name
TCHAR szServerName[100];
- GetDlgItemText(hwndDlg, IDC_SERVER, szServerName, SIZEOF(szServerName));
+ GetDlgItemText(hwndDlg, IDC_SERVER, szServerName, _countof(szServerName));
// formating query
CJabberIqInfo *pInfo = AddIQ(&CJabberProto::OnIqResultAdvancedSearch, JABBER_IQ_TYPE_SET, szServerName);
@@ -764,7 +764,7 @@ HWND __cdecl CJabberProto::SearchAdvanced(HWND hwndDlg)
else { //and Simple fields: XEP-0055 Example 3
for (int i = 0; i < dat->nJSInfCount; i++) {
TCHAR szFieldValue[100];
- GetWindowText(dat->pJSInf[i].hwndValueItem, szFieldValue, SIZEOF(szFieldValue));
+ GetWindowText(dat->pJSInf[i].hwndValueItem, szFieldValue, _countof(szFieldValue));
if (szFieldValue[0] != 0) {
xmlAddChild(query, dat->pJSInf[i].szFieldName, szFieldValue);
fRequestNotEmpty = TRUE;
diff --git a/protocols/JabberG/src/jabber_secur.cpp b/protocols/JabberG/src/jabber_secur.cpp
index 5bebb8ac3a..24c93439db 100644
--- a/protocols/JabberG/src/jabber_secur.cpp
+++ b/protocols/JabberG/src/jabber_secur.cpp
@@ -50,7 +50,7 @@ LBL_Invalid:
TCHAR szSpn[1024] = _T("");
if (mir_strcmp(mechanism, "NTLM"))
- if (!getSpn(szSpn, SIZEOF(szSpn)) && !mir_strcmp(mechanism, "GSSAPI"))
+ if (!getSpn(szSpn, _countof(szSpn)) && !mir_strcmp(mechanism, "GSSAPI"))
goto LBL_Invalid;
if ((hProvider = Netlib_InitSecurityProvider2(szProvider, szSpn)) == NULL)
@@ -66,10 +66,10 @@ TNtlmAuth::~TNtlmAuth()
bool TNtlmAuth::getSpn(TCHAR* szSpn, size_t dwSpnLen)
{
TCHAR szFullUserName[128] = _T("");
- ULONG szFullUserNameLen = SIZEOF(szFullUserName);
+ ULONG szFullUserNameLen = _countof(szFullUserName);
if (!GetUserNameEx(NameDnsDomain, szFullUserName, &szFullUserNameLen)) {
szFullUserName[0] = 0;
- szFullUserNameLen = SIZEOF(szFullUserName);
+ szFullUserNameLen = _countof(szFullUserName);
GetUserNameEx(NameSamCompatible, szFullUserName, &szFullUserNameLen);
}
@@ -155,7 +155,7 @@ char* TMD5Auth::getChallenge(const TCHAR *challenge)
mir_md5_state_t ctx;
CallService(MS_UTILS_GETRANDOM, sizeof(digest), (LPARAM)digest);
- mir_snprintf(cnonce, SIZEOF(cnonce), "%08x%08x%08x%08x", htonl(digest[0]), htonl(digest[1]), htonl(digest[2]), htonl(digest[3]));
+ mir_snprintf(cnonce, _countof(cnonce), "%08x%08x%08x%08x", htonl(digest[0]), htonl(digest[1]), htonl(digest[2]), htonl(digest[3]));
T2Utf uname(info->conn.username), passw(info->conn.password);
ptrA serv(mir_utf8encode(info->conn.server));
@@ -182,15 +182,15 @@ char* TMD5Auth::getChallenge(const TCHAR *challenge)
mir_md5_finish(&ctx, (BYTE*)hash2);
mir_md5_init(&ctx);
- mir_snprintf(tmpBuf, SIZEOF(tmpBuf), "%08x%08x%08x%08x", htonl(hash1[0]), htonl(hash1[1]), htonl(hash1[2]), htonl(hash1[3]));
+ mir_snprintf(tmpBuf, _countof(tmpBuf), "%08x%08x%08x%08x", htonl(hash1[0]), htonl(hash1[1]), htonl(hash1[2]), htonl(hash1[3]));
mir_md5_append(&ctx, (BYTE*)tmpBuf, (int)mir_strlen(tmpBuf));
mir_md5_append(&ctx, (BYTE*)":", 1);
mir_md5_append(&ctx, (BYTE*)nonce, (int)mir_strlen(nonce));
- mir_snprintf(tmpBuf, SIZEOF(tmpBuf), ":%08d:", iCallCount);
+ mir_snprintf(tmpBuf, _countof(tmpBuf), ":%08d:", iCallCount);
mir_md5_append(&ctx, (BYTE*)tmpBuf, (int)mir_strlen(tmpBuf));
mir_md5_append(&ctx, (BYTE*)cnonce, (int)mir_strlen(cnonce));
mir_md5_append(&ctx, (BYTE*)":auth:", 6);
- mir_snprintf(tmpBuf, SIZEOF(tmpBuf), "%08x%08x%08x%08x", htonl(hash2[0]), htonl(hash2[1]), htonl(hash2[2]), htonl(hash2[3]));
+ mir_snprintf(tmpBuf, _countof(tmpBuf), "%08x%08x%08x%08x", htonl(hash2[0]), htonl(hash2[1]), htonl(hash2[2]), htonl(hash2[3]));
mir_md5_append(&ctx, (BYTE*)tmpBuf, (int)mir_strlen(tmpBuf));
mir_md5_finish(&ctx, (BYTE*)digest);
@@ -278,7 +278,7 @@ char* TScramAuth::getChallenge(const TCHAR *challenge)
mir_sha1_finish(&ctx, storedKey);
char authmsg[4096];
- int authmsgLen = mir_snprintf(authmsg, SIZEOF(authmsg), "%s,%s,c=biws,r=%s", msg1, chl, snonce);
+ int authmsgLen = mir_snprintf(authmsg, _countof(authmsg), "%s,%s,c=biws,r=%s", msg1, chl, snonce);
BYTE clientSig[MIR_SHA1_HASH_SIZE];
mir_hmac_sha1(clientSig, storedKey, sizeof(storedKey), (BYTE*)authmsg, authmsgLen);
diff --git a/protocols/JabberG/src/jabber_std.cpp b/protocols/JabberG/src/jabber_std.cpp
index 84745e30d5..485d85ff01 100644
--- a/protocols/JabberG/src/jabber_std.cpp
+++ b/protocols/JabberG/src/jabber_std.cpp
@@ -72,17 +72,17 @@ void CJabberProto::ConvertPasswords()
for (int i = 0;; i++) {
char varName[100];
- mir_snprintf(varName, SIZEOF(varName), "rcMuc_%d_server", i);
+ mir_snprintf(varName, _countof(varName), "rcMuc_%d_server", i);
ptrA str(getStringA(NULL, varName));
if (str == NULL)
break;
- mir_snprintf(varName, SIZEOF(varName), "rcMuc_%d", i);
+ mir_snprintf(varName, _countof(varName), "rcMuc_%d", i);
ptrT passw(JSetStringCrypt(m_szModuleName, NULL, varName));
if (passw != NULL) {
delSetting(varName);
- mir_snprintf(varName, SIZEOF(varName), "password_rcMuc_%d", i);
+ mir_snprintf(varName, _countof(varName), "password_rcMuc_%d", i);
setTString(varName, passw);
}
}
diff --git a/protocols/JabberG/src/jabber_svc.cpp b/protocols/JabberG/src/jabber_svc.cpp
index 916a3ce87c..ff9279d881 100644
--- a/protocols/JabberG/src/jabber_svc.cpp
+++ b/protocols/JabberG/src/jabber_svc.cpp
@@ -130,7 +130,7 @@ INT_PTR __cdecl CJabberProto::JabberGetAvatarInfo(WPARAM wParam, LPARAM lParam)
}
TCHAR tszFileName[MAX_PATH];
- GetAvatarFileName(pai->hContact, tszFileName, SIZEOF(tszFileName));
+ GetAvatarFileName(pai->hContact, tszFileName, _countof(tszFileName));
_tcsncpy_s(pai->filename, tszFileName, _TRUNCATE);
pai->format = (pai->hContact == NULL) ? PA_FORMAT_PNG : getByte(pai->hContact, "AvatarType", 0);
@@ -153,7 +153,7 @@ INT_PTR __cdecl CJabberProto::JabberGetAvatarInfo(WPARAM wParam, LPARAM lParam)
TCHAR szJid[JABBER_MAX_JID_LEN]; szJid[0] = 0;
if (item->arResources.getCount() != NULL && !isXVcard)
if (TCHAR *bestResName = ListGetBestClientResourceNamePtr(tszJid))
- mir_sntprintf(szJid, SIZEOF(szJid), _T("%s/%s"), tszJid, bestResName);
+ mir_sntprintf(szJid, _countof(szJid), _T("%s/%s"), tszJid, bestResName);
if (szJid[0] == 0)
_tcsncpy_s(szJid, tszJid, _TRUNCATE);
@@ -533,7 +533,7 @@ INT_PTR __cdecl CJabberProto::JabberSendNudge(WPARAM hContact, LPARAM)
TCHAR tszJid[JABBER_MAX_JID_LEN];
TCHAR *szResource = ListGetBestClientResourceNamePtr(jid);
if (szResource)
- mir_sntprintf(tszJid, SIZEOF(tszJid), _T("%s/%s"), jid, szResource);
+ mir_sntprintf(tszJid, _countof(tszJid), _T("%s/%s"), jid, szResource);
else
_tcsncpy_s(tszJid, jid, _TRUNCATE);
diff --git a/protocols/JabberG/src/jabber_thread.cpp b/protocols/JabberG/src/jabber_thread.cpp
index cd3e8d0d18..f22f0299ed 100644
--- a/protocols/JabberG/src/jabber_thread.cpp
+++ b/protocols/JabberG/src/jabber_thread.cpp
@@ -94,7 +94,7 @@ static INT_PTR CALLBACK JabberPasswordDlgProc(HWND hwndDlg, UINT msg, WPARAM wPa
param->saveOnlinePassword = IsDlgButtonChecked(hwndDlg, IDC_SAVEPASSWORD);
param->pro->setByte("SaveSessionPassword", param->saveOnlinePassword);
- GetDlgItemText(hwndDlg, IDC_PASSWORD, param->onlinePassword, SIZEOF(param->onlinePassword));
+ GetDlgItemText(hwndDlg, IDC_PASSWORD, param->onlinePassword, _countof(param->onlinePassword));
{
BOOL savePassword = IsDlgButtonChecked(hwndDlg, IDC_SAVE_PERM);
param->pro->setByte("SavePassword", savePassword);
@@ -148,7 +148,7 @@ void ThreadData::xmpp_client_query(void)
return;
char temp[256];
- mir_snprintf(temp, SIZEOF(temp), "_xmpp-client._tcp.%s", conn.server);
+ mir_snprintf(temp, _countof(temp), "_xmpp-client._tcp.%s", conn.server);
DNS_RECORDA *results = NULL;
DNS_STATUS status = DnsQuery_A(temp, DNS_TYPE_SRV, DNS_QUERY_STANDARD, NULL, (PDNS_RECORD *)&results, NULL);
@@ -250,7 +250,7 @@ void CJabberProto::ServerThread(JABBER_CONN_DATA *param)
_tcsncpy_s(info.conn.username, tszValue, _TRUNCATE);
if (*rtrimt(info.conn.username) == '\0') {
- DWORD dwSize = SIZEOF(info.conn.username);
+ DWORD dwSize = _countof(info.conn.username);
if (GetUserName(info.conn.username, &dwSize))
setTString("LoginName", info.conn.username);
else
@@ -278,7 +278,7 @@ LBL_FatalError:
}
if (m_options.HostNameAsResource) {
- DWORD dwCompNameLen = SIZEOF(info.resource) - 1;
+ DWORD dwCompNameLen = _countof(info.resource) - 1;
if (!GetComputerName(info.resource, &dwCompNameLen))
mir_tstrcpy(info.resource, _T("Miranda"));
}
@@ -290,7 +290,7 @@ LBL_FatalError:
}
TCHAR jidStr[512];
- mir_sntprintf(jidStr, SIZEOF(jidStr), _T("%s@%S/%s"), info.conn.username, info.conn.server, info.resource);
+ mir_sntprintf(jidStr, _countof(jidStr), _T("%s@%S/%s"), info.conn.username, info.conn.server, info.resource);
_tcsncpy_s(info.fullJID, jidStr, _TRUNCATE);
if (m_options.UseDomainLogin) // in the case of NTLM auth we have no need in password
@@ -299,7 +299,7 @@ LBL_FatalError:
if (m_savedPassword != NULL)
_tcsncpy_s(info.conn.password, m_savedPassword, _TRUNCATE);
else {
- mir_sntprintf(jidStr, SIZEOF(jidStr), _T("%s@%S"), info.conn.username, info.conn.server);
+ mir_sntprintf(jidStr, _countof(jidStr), _T("%s@%S"), info.conn.username, info.conn.server);
JabberPasswordDlgParam param;
param.pro = this;
@@ -971,7 +971,7 @@ void CJabberProto::OnProcessPubsubEvent(HXML node)
szLengthInTime[0] = 0;
if (szLength) {
int nLength = _ttoi(szLength);
- mir_sntprintf(szLengthInTime, SIZEOF(szLengthInTime), _T("%02d:%02d:%02d"),
+ mir_sntprintf(szLengthInTime, _countof(szLengthInTime), _T("%02d:%02d:%02d"),
nLength / 3600, (nLength / 60) % 60, nLength % 60);
}
@@ -1289,7 +1289,7 @@ void CJabberProto::OnProcessMessage(HXML node, ThreadData *info)
else if (!mir_tstrcmp(ptszXmlns, JABBER_FEAT_ROSTER_EXCHANGE) &&
item != NULL && (item->subscription == SUB_BOTH || item->subscription == SUB_TO)) {
TCHAR chkJID[JABBER_MAX_JID_LEN] = _T("@");
- JabberStripJid(from, chkJID + 1, SIZEOF(chkJID) - 1);
+ JabberStripJid(from, chkJID + 1, _countof(chkJID) - 1);
for (int i = 1;; i++) {
HXML iNode = xmlGetNthChild(xNode, _T("item"), i);
if (iNode == NULL)
@@ -1496,9 +1496,9 @@ void CJabberProto::OnProcessPresence(HXML node, ThreadData *info)
MCONTACT hContact;
BOOL bSelfPresence = FALSE;
TCHAR szBareFrom[JABBER_MAX_JID_LEN];
- JabberStripJid(from, szBareFrom, SIZEOF(szBareFrom));
+ JabberStripJid(from, szBareFrom, _countof(szBareFrom));
TCHAR szBareOurJid[JABBER_MAX_JID_LEN];
- JabberStripJid(info->fullJID, szBareOurJid, SIZEOF(szBareOurJid));
+ JabberStripJid(info->fullJID, szBareOurJid, _countof(szBareOurJid));
if (!mir_tstrcmpi(szBareFrom, szBareOurJid))
bSelfPresence = TRUE;
diff --git a/protocols/JabberG/src/jabber_userinfo.cpp b/protocols/JabberG/src/jabber_userinfo.cpp
index 93ef27846b..cff0711614 100644
--- a/protocols/JabberG/src/jabber_userinfo.cpp
+++ b/protocols/JabberG/src/jabber_userinfo.cpp
@@ -176,7 +176,7 @@ static HTREEITEM sttFillInfoLine(HWND hwndTree, HTREEITEM htiRoot, HICON hIcon,
if (title)
mir_sntprintf(buf, _T("%s: %s"), title, value);
else
- mir_tstrncpy(buf, value, SIZEOF(buf));
+ mir_tstrncpy(buf, value, _countof(buf));
TVINSERTSTRUCT tvis = {0};
tvis.hParent = htiRoot;
@@ -251,20 +251,20 @@ static void sttFillResourceInfo(CJabberProto *ppro, HWND hwndTree, HTREEITEM hti
// Resource priority
TCHAR szPriority[128];
- mir_sntprintf(szPriority, SIZEOF(szPriority), _T("%d"), (int)r->m_iPriority);
+ mir_sntprintf(szPriority, _countof(szPriority), _T("%d"), (int)r->m_iPriority);
sttFillInfoLine(hwndTree, htiResource, NULL, TranslateT("Resource priority"), szPriority, sttInfoLineId(resource, INFOLINE_PRIORITY));
// Idle
if (r->m_dwIdleStartTime > 0) {
- mir_tstrncpy(buf, _tctime(&r->m_dwIdleStartTime), SIZEOF(buf));
+ mir_tstrncpy(buf, _tctime(&r->m_dwIdleStartTime), _countof(buf));
size_t len = mir_tstrlen(buf);
if (len > 0)
buf[len-1] = 0;
}
else if (!r->m_dwIdleStartTime)
- mir_tstrncpy(buf, TranslateT("unknown"), SIZEOF(buf));
+ mir_tstrncpy(buf, TranslateT("unknown"), _countof(buf));
else
- mir_tstrncpy(buf, TranslateT("<not specified>"), SIZEOF(buf));
+ mir_tstrncpy(buf, TranslateT("<not specified>"), _countof(buf));
sttFillInfoLine(hwndTree, htiResource, NULL, TranslateT("Idle since"), buf, sttInfoLineId(resource, INFOLINE_IDLE));
@@ -279,7 +279,7 @@ static void sttFillResourceInfo(CJabberProto *ppro, HWND hwndTree, HTREEITEM hti
if (jcb & g_JabberFeatCapPairs[i].jcbCap) {
TCHAR szDescription[ 1024 ];
if (g_JabberFeatCapPairs[i].tszDescription)
- mir_sntprintf(szDescription, SIZEOF(szDescription), _T("%s (%s)"), TranslateTS(g_JabberFeatCapPairs[i].tszDescription), g_JabberFeatCapPairs[i].szFeature);
+ mir_sntprintf(szDescription, _countof(szDescription), _T("%s (%s)"), TranslateTS(g_JabberFeatCapPairs[i].tszDescription), g_JabberFeatCapPairs[i].szFeature);
else
_tcsncpy_s(szDescription, g_JabberFeatCapPairs[i].szFeature, _TRUNCATE);
sttFillInfoLine(hwndTree, htiCaps, NULL, NULL, szDescription, sttInfoLineId(resource, INFOLINE_CAPS, i));
@@ -289,7 +289,7 @@ static void sttFillResourceInfo(CJabberProto *ppro, HWND hwndTree, HTREEITEM hti
if (jcb & ppro->m_lstJabberFeatCapPairsDynamic[j]->jcbCap) {
TCHAR szDescription[ 1024 ];
if (ppro->m_lstJabberFeatCapPairsDynamic[j]->szDescription)
- mir_sntprintf(szDescription, SIZEOF(szDescription), _T("%s (%s)"), TranslateTS(ppro->m_lstJabberFeatCapPairsDynamic[j]->szDescription), ppro->m_lstJabberFeatCapPairsDynamic[j]->szFeature);
+ mir_sntprintf(szDescription, _countof(szDescription), _T("%s (%s)"), TranslateTS(ppro->m_lstJabberFeatCapPairsDynamic[j]->szDescription), ppro->m_lstJabberFeatCapPairsDynamic[j]->szFeature);
else
_tcsncpy_s(szDescription, ppro->m_lstJabberFeatCapPairsDynamic[j]->szFeature, _TRUNCATE);
sttFillInfoLine(hwndTree, htiCaps, NULL, NULL, szDescription, sttInfoLineId(resource, INFOLINE_CAPS, i));
@@ -365,15 +365,15 @@ static void sttFillUserInfo(CJabberProto *ppro, HWND hwndTree, JABBER_LIST_ITEM
// logoff
JABBER_RESOURCE_STATUS *r = item->getTemp();
if (r->m_dwIdleStartTime > 0) {
- mir_tstrncpy(buf, _tctime(&r->m_dwIdleStartTime), SIZEOF(buf));
+ mir_tstrncpy(buf, _tctime(&r->m_dwIdleStartTime), _countof(buf));
size_t len = mir_tstrlen(buf);
if (len > 0)
buf[len-1] = 0;
}
else if (!r->m_dwIdleStartTime)
- mir_tstrncpy(buf, TranslateT("unknown"), SIZEOF(buf));
+ mir_tstrncpy(buf, TranslateT("unknown"), _countof(buf));
else
- mir_tstrncpy(buf, TranslateT("<not specified>"), SIZEOF(buf));
+ mir_tstrncpy(buf, TranslateT("<not specified>"), _countof(buf));
sttFillInfoLine(hwndTree, htiRoot, NULL,
(item->jid && _tcschr(item->jid, _T('@'))) ? TranslateT("Last logoff time") : TranslateT("Uptime"), buf,
@@ -384,9 +384,9 @@ static void sttFillUserInfo(CJabberProto *ppro, HWND hwndTree, JABBER_LIST_ITEM
// activity
if (item->m_pLastSeenResource)
- mir_tstrncpy(buf, item->m_pLastSeenResource->m_tszResourceName, SIZEOF(buf));
+ mir_tstrncpy(buf, item->m_pLastSeenResource->m_tszResourceName, _countof(buf));
else
- mir_tstrncpy(buf, TranslateT("<no information available>"), SIZEOF(buf));
+ mir_tstrncpy(buf, TranslateT("<no information available>"), _countof(buf));
sttFillInfoLine(hwndTree, htiRoot, NULL, TranslateT("Last active resource"), buf,
sttInfoLineId(0, INFOLINE_LASTACTIVE));
@@ -537,7 +537,7 @@ static INT_PTR CALLBACK JabberUserInfoDlgProc(HWND hwndDlg, UINT msg, WPARAM wPa
TVITEMEX tvi = { 0 };
tvi.mask = TVIF_HANDLE | TVIF_TEXT | TVIF_STATE;
tvi.hItem = hItem;
- tvi.cchTextMax = SIZEOF(szBuffer);
+ tvi.cchTextMax = _countof(szBuffer);
tvi.pszText = szBuffer;
if (TreeView_GetItem(hwndTree, &tvi)) {
if (TCHAR *str = _tcsstr(szBuffer, _T(": ")))
diff --git a/protocols/JabberG/src/jabber_util.cpp b/protocols/JabberG/src/jabber_util.cpp
index 059015f155..a709bc492c 100644
--- a/protocols/JabberG/src/jabber_util.cpp
+++ b/protocols/JabberG/src/jabber_util.cpp
@@ -542,8 +542,8 @@ int __stdcall JabberGetPacketID(HXML n)
{
const TCHAR *str = xmlGetAttrValue(n, _T("id"));
if (str)
- if (!_tcsncmp(str, _T(JABBER_IQID), SIZEOF(JABBER_IQID) - 1))
- return _ttoi(str + SIZEOF(JABBER_IQID) - 1);
+ if (!_tcsncmp(str, _T(JABBER_IQID), _countof(JABBER_IQID) - 1))
+ return _ttoi(str + _countof(JABBER_IQID) - 1);
return -1;
}
@@ -941,7 +941,7 @@ void __cdecl CJabberProto::LoadHttpAvatars(void* param)
if (getByte(ai.hContact, "AvatarType", PA_FORMAT_UNKNOWN) != (unsigned char)pictureType) {
TCHAR tszFileName[MAX_PATH];
- GetAvatarFileName(ai.hContact, tszFileName, SIZEOF(tszFileName));
+ GetAvatarFileName(ai.hContact, tszFileName, _countof(tszFileName));
DeleteFile(tszFileName);
}
@@ -958,7 +958,7 @@ void __cdecl CJabberProto::LoadHttpAvatars(void* param)
ptrA cmpsha(getStringA(ai.hContact, "AvatarSaved"));
if (cmpsha == NULL || strnicmp(cmpsha, buffer, sizeof(buffer))) {
TCHAR tszFileName[MAX_PATH];
- GetAvatarFileName(ai.hContact, tszFileName, SIZEOF(tszFileName));
+ GetAvatarFileName(ai.hContact, tszFileName, _countof(tszFileName));
_tcsncpy_s(ai.filename, tszFileName, _TRUNCATE);
FILE* out = _tfopen(tszFileName, _T("wb"));
if (out != NULL) {
diff --git a/protocols/JabberG/src/jabber_vcard.cpp b/protocols/JabberG/src/jabber_vcard.cpp
index 510abac8ac..d98e163758 100644
--- a/protocols/JabberG/src/jabber_vcard.cpp
+++ b/protocols/JabberG/src/jabber_vcard.cpp
@@ -288,9 +288,9 @@ static INT_PTR CALLBACK PhotoDlgProc(HWND hwndDlg, UINT msg, WPARAM wParam, LPAR
dat->ppro->m_szPhotoFileName[0] = '\0';
}
EnableWindow(GetDlgItem(hwndDlg, IDC_DELETE), FALSE);
- dat->ppro->GetAvatarFileName(NULL, szAvatarFileName, SIZEOF(szAvatarFileName));
+ dat->ppro->GetAvatarFileName(NULL, szAvatarFileName, _countof(szAvatarFileName));
if (_taccess(szAvatarFileName, 0) == 0) {
- if (GetTempPath(SIZEOF(szTempPath), szTempPath) <= 0)
+ if (GetTempPath(_countof(szTempPath), szTempPath) <= 0)
mir_tstrcpy(szTempPath, _T(".\\"));
if (GetTempFileName(szTempPath, _T("jab"), 0, szTempFileName) > 0) {
dat->ppro->debugLog(_T("Temp file = %s"), szTempFileName);
@@ -334,7 +334,7 @@ static INT_PTR CALLBACK PhotoDlgProc(HWND hwndDlg, UINT msg, WPARAM wParam, LPAR
case IDC_LOAD:
TCHAR szFilter[512], szFileName[MAX_PATH];
- Bitmap_GetFilter(szFilter, SIZEOF(szFilter));
+ Bitmap_GetFilter(szFilter, _countof(szFilter));
OPENFILENAME ofn = { 0 };
ofn.lStructSize = sizeof(ofn);
@@ -354,7 +354,7 @@ static INT_PTR CALLBACK PhotoDlgProc(HWND hwndDlg, UINT msg, WPARAM wParam, LPAR
MessageBox(hwndDlg, TranslateT("Only JPG, GIF, and BMP image files smaller than 40 KB are supported."), TranslateT("Jabber vCard"), MB_OK | MB_SETFOREGROUND);
break;
}
- if (GetTempPath(SIZEOF(szTempPath), szTempPath) <= 0)
+ if (GetTempPath(_countof(szTempPath), szTempPath) <= 0)
mir_tstrcpy(szTempPath, _T(".\\"));
if (GetTempFileName(szTempPath, _T("jab"), 0, szTempFileName) > 0) {
@@ -579,7 +579,7 @@ static INT_PTR CALLBACK EditEmailDlgProc(HWND hwndDlg, UINT msg, WPARAM wParam,
}
TCHAR text[128];
- GetDlgItemText(hwndDlg, IDC_EMAIL, text, SIZEOF(text));
+ GetDlgItemText(hwndDlg, IDC_EMAIL, text, _countof(text));
mir_snprintf(idstr, "e-mail%d", dat->id);
dat->ppro->setTString(idstr, text);
{
@@ -650,7 +650,7 @@ static INT_PTR CALLBACK EditPhoneDlgProc(HWND hwndDlg, UINT msg, WPARAM wParam,
}
char text[128];
- GetDlgItemTextA(hwndDlg, IDC_PHONE, text, SIZEOF(text));
+ GetDlgItemTextA(hwndDlg, IDC_PHONE, text, _countof(text));
mir_snprintf(idstr, "Phone%d", dat->id);
dat->ppro->setString(idstr, text);
@@ -733,7 +733,7 @@ static INT_PTR CALLBACK ContactDlgProc(HWND hwndDlg, UINT msg, WPARAM, LPARAM lP
ptrT email( ppro->getTStringA(idstr));
if (email == NULL) break;
- mir_sntprintf(number, SIZEOF(number), _T("%d"), i+1);
+ mir_sntprintf(number, _countof(number), _T("%d"), i+1);
lvi.pszText = number;
lvi.lParam = (LPARAM)i;
ListView_InsertItem(GetDlgItem(hwndDlg, IDC_EMAILS), &lvi);
@@ -754,7 +754,7 @@ static INT_PTR CALLBACK ContactDlgProc(HWND hwndDlg, UINT msg, WPARAM, LPARAM lP
ptrT phone( ppro->getTStringA(idstr));
if (phone == NULL) break;
- mir_sntprintf(number, SIZEOF(number), _T("%d"), i+1);
+ mir_sntprintf(number, _countof(number), _T("%d"), i+1);
lvi.pszText = number;
lvi.lParam = (LPARAM)i;
ListView_InsertItem(GetDlgItem(hwndDlg, IDC_PHONES), &lvi);
@@ -921,40 +921,40 @@ void CJabberProto::SaveVcardToDB(HWND hwndPage, int iPage)
// Page 0: Personal
switch (iPage) {
case 0:
- GetDlgItemText(hwndPage, IDC_FULLNAME, text, SIZEOF(text));
+ GetDlgItemText(hwndPage, IDC_FULLNAME, text, _countof(text));
setTString("FullName", text);
- GetDlgItemText(hwndPage, IDC_NICKNAME, text, SIZEOF(text));
+ GetDlgItemText(hwndPage, IDC_NICKNAME, text, _countof(text));
setTString("Nick", text);
- GetDlgItemText(hwndPage, IDC_FIRSTNAME, text, SIZEOF(text));
+ GetDlgItemText(hwndPage, IDC_FIRSTNAME, text, _countof(text));
setTString("FirstName", text);
- GetDlgItemText(hwndPage, IDC_MIDDLE, text, SIZEOF(text));
+ GetDlgItemText(hwndPage, IDC_MIDDLE, text, _countof(text));
setTString("MiddleName", text);
- GetDlgItemText(hwndPage, IDC_LASTNAME, text, SIZEOF(text));
+ GetDlgItemText(hwndPage, IDC_LASTNAME, text, _countof(text));
setTString("LastName", text);
- GetDlgItemText(hwndPage, IDC_BIRTH, text, SIZEOF(text));
+ GetDlgItemText(hwndPage, IDC_BIRTH, text, _countof(text));
setTString("BirthDate", text);
switch (SendDlgItemMessage(hwndPage, IDC_GENDER, CB_GETCURSEL, 0, 0)) {
case 0: setString("GenderString", "Male"); break;
case 1: setString("GenderString", "Female"); break;
default: setString("GenderString", ""); break;
}
- GetDlgItemText(hwndPage, IDC_OCCUPATION, text, SIZEOF(text));
+ GetDlgItemText(hwndPage, IDC_OCCUPATION, text, _countof(text));
setTString("Role", text);
- GetDlgItemText(hwndPage, IDC_HOMEPAGE, text, SIZEOF(text));
+ GetDlgItemText(hwndPage, IDC_HOMEPAGE, text, _countof(text));
setTString("Homepage", text);
break;
// Page 1: Home
case 1:
- GetDlgItemText(hwndPage, IDC_ADDRESS1, text, SIZEOF(text));
+ GetDlgItemText(hwndPage, IDC_ADDRESS1, text, _countof(text));
setTString("Street", text);
- GetDlgItemText(hwndPage, IDC_ADDRESS2, text, SIZEOF(text));
+ GetDlgItemText(hwndPage, IDC_ADDRESS2, text, _countof(text));
setTString("Street2", text);
- GetDlgItemText(hwndPage, IDC_CITY, text, SIZEOF(text));
+ GetDlgItemText(hwndPage, IDC_CITY, text, _countof(text));
setTString("City", text);
- GetDlgItemText(hwndPage, IDC_STATE, text, SIZEOF(text));
+ GetDlgItemText(hwndPage, IDC_STATE, text, _countof(text));
setTString("State", text);
- GetDlgItemText(hwndPage, IDC_ZIP, text, SIZEOF(text));
+ GetDlgItemText(hwndPage, IDC_ZIP, text, _countof(text));
setTString("ZIP", text);
{
int i = SendDlgItemMessage(hwndPage, IDC_COUNTRY, CB_GETCURSEL, 0, 0);
@@ -966,21 +966,21 @@ void CJabberProto::SaveVcardToDB(HWND hwndPage, int iPage)
// Page 2: Work
case 2:
- GetDlgItemText(hwndPage, IDC_COMPANY, text, SIZEOF(text));
+ GetDlgItemText(hwndPage, IDC_COMPANY, text, _countof(text));
setTString("Company", text);
- GetDlgItemText(hwndPage, IDC_DEPARTMENT, text, SIZEOF(text));
+ GetDlgItemText(hwndPage, IDC_DEPARTMENT, text, _countof(text));
setTString("CompanyDepartment", text);
- GetDlgItemText(hwndPage, IDC_TITLE, text, SIZEOF(text));
+ GetDlgItemText(hwndPage, IDC_TITLE, text, _countof(text));
setTString("CompanyPosition", text);
- GetDlgItemText(hwndPage, IDC_ADDRESS1, text, SIZEOF(text));
+ GetDlgItemText(hwndPage, IDC_ADDRESS1, text, _countof(text));
setTString("CompanyStreet", text);
- GetDlgItemText(hwndPage, IDC_ADDRESS2, text, SIZEOF(text));
+ GetDlgItemText(hwndPage, IDC_ADDRESS2, text, _countof(text));
setTString("CompanyStreet2", text);
- GetDlgItemText(hwndPage, IDC_CITY, text, SIZEOF(text));
+ GetDlgItemText(hwndPage, IDC_CITY, text, _countof(text));
setTString("CompanyCity", text);
- GetDlgItemText(hwndPage, IDC_STATE, text, SIZEOF(text));
+ GetDlgItemText(hwndPage, IDC_STATE, text, _countof(text));
setTString("CompanyState", text);
- GetDlgItemText(hwndPage, IDC_ZIP, text, SIZEOF(text));
+ GetDlgItemText(hwndPage, IDC_ZIP, text, _countof(text));
setTString("CompanyZIP", text);
{
int i = SendDlgItemMessage(hwndPage, IDC_COUNTRY, CB_GETCURSEL, 0, 0);
@@ -995,7 +995,7 @@ void CJabberProto::SaveVcardToDB(HWND hwndPage, int iPage)
// Page 4: Note
case 4:
- GetDlgItemText(hwndPage, IDC_DESC, text, SIZEOF(text));
+ GetDlgItemText(hwndPage, IDC_DESC, text, _countof(text));
setTString("About", text);
break;
}
@@ -1105,7 +1105,7 @@ void CJabberProto::SetServerVcard(BOOL bPhotoChanged, TCHAR* szPhotoFileName)
}
TCHAR szAvatarName[MAX_PATH], *szFileName;
- GetAvatarFileName(NULL, szAvatarName, SIZEOF(szAvatarName));
+ GetAvatarFileName(NULL, szAvatarName, _countof(szAvatarName));
if (bPhotoChanged)
szFileName = szPhotoFileName;
else
@@ -1159,7 +1159,7 @@ void CJabberProto::SetServerVcard(BOOL bPhotoChanged, TCHAR* szPhotoFileName)
if (bPhotoChanged) {
DeleteFile(szAvatarName);
- GetAvatarFileName(NULL, szAvatarName, SIZEOF(szAvatarName));
+ GetAvatarFileName(NULL, szAvatarName, _countof(szAvatarName));
CopyFile(szFileName, szAvatarName, FALSE);
}
diff --git a/protocols/JabberG/src/jabber_ws.cpp b/protocols/JabberG/src/jabber_ws.cpp
index 2abed513d4..62e9da7501 100644
--- a/protocols/JabberG/src/jabber_ws.cpp
+++ b/protocols/JabberG/src/jabber_ws.cpp
@@ -29,7 +29,7 @@ BOOL CJabberProto::WsInit(void)
m_lastTicks = ::GetTickCount();
TCHAR name[128];
- mir_sntprintf(name, SIZEOF(name), TranslateT("%s connection"), m_tszUserName);
+ mir_sntprintf(name, _countof(name), TranslateT("%s connection"), m_tszUserName);
NETLIBUSER nlu = { sizeof(nlu) };
nlu.flags = NUF_OUTGOING | NUF_INCOMING | NUF_HTTPCONNS | NUF_TCHAR; // | NUF_HTTPGATEWAY;
diff --git a/protocols/JabberG/src/jabber_xstatus.cpp b/protocols/JabberG/src/jabber_xstatus.cpp
index 61585a59f2..947d047537 100644
--- a/protocols/JabberG/src/jabber_xstatus.cpp
+++ b/protocols/JabberG/src/jabber_xstatus.cpp
@@ -345,7 +345,7 @@ BOOL CJabberDlgPepSimple::OnWmDrawItem(UINT, WPARAM, LPARAM lParam)
break;
}
}
- else mir_tstrncpy(text, mode->m_title, SIZEOF(text));
+ else mir_tstrncpy(text, mode->m_title, _countof(text));
DrawIconEx(lpdis->hDC, lpdis->rcItem.left + 2, (lpdis->rcItem.top + lpdis->rcItem.bottom - 16) / 2, mode->m_hIcon, 16, 16, 0, NULL, DI_NORMAL);
TextOut(lpdis->hDC, lpdis->rcItem.left + 23, (lpdis->rcItem.top + lpdis->rcItem.bottom - tm.tmHeight) / 2, text, (int)mir_tstrlen(text));
@@ -680,7 +680,7 @@ void CPepMood::SetMood(MCONTACT hContact, const TCHAR *szMood, const TCHAR *szTe
if (szMood) {
char* p = mir_t2a(szMood);
- for (int i = 1; i < SIZEOF(g_arrMoods); i++)
+ for (int i = 1; i < _countof(g_arrMoods); i++)
if (!mir_strcmp(g_arrMoods[i].szTag, p)) {
mood = i;
break;
@@ -701,7 +701,7 @@ void CPepMood::SetMood(MCONTACT hContact, const TCHAR *szMood, const TCHAR *szTe
if (m_proto->m_pInfoFrame) {
if (mood >= 0) {
- mir_sntprintf(title, SIZEOF(title), TranslateT("Mood: %s"), TranslateTS(g_arrMoods[mood].szName));
+ mir_sntprintf(title, _countof(title), TranslateT("Mood: %s"), TranslateTS(g_arrMoods[mood].szName));
m_proto->m_pInfoFrame->UpdateInfoItem("$/PEP/mood", g_MoodIcons.GetIcolibHandle(g_arrMoods[mood].szTag), TranslateTS(g_arrMoods[mood].szName));
}
else {
@@ -739,7 +739,7 @@ void CPepMood::ShowSetDialog(BYTE bQuiet)
{
if (!bQuiet) {
CJabberDlgPepSimple dlg(m_proto, TranslateT("Set Mood"));
- for (int i = 1; i < SIZEOF(g_arrMoods); i++)
+ for (int i = 1; i < _countof(g_arrMoods); i++)
dlg.AddStatusMode(i, g_arrMoods[i].szTag, g_MoodIcons.GetIcon(g_arrMoods[i].szTag), TranslateTS(g_arrMoods[i].szName));
dlg.SetActiveStatus(m_mode, m_text);
@@ -916,7 +916,7 @@ char* returnActivity(int id)
char* ActivityGetFirst(int id)
{
- if (id >= SIZEOF(g_arrActivities) - 1)
+ if (id >= _countof(g_arrActivities) - 1)
return NULL;
while (id >= 0) {
@@ -932,7 +932,7 @@ char *ActivityGetFirst(char *szId)
{
if (!szId) return NULL;
- int id = SIZEOF(g_arrActivities) - 1;
+ int id = _countof(g_arrActivities) - 1;
bool found_second = false;
while (id >= 0) {
@@ -953,7 +953,7 @@ char *ActivityGetSecond(int id)
TCHAR *ActivityGetFirstTitle(int id)
{
- if (id >= SIZEOF(g_arrActivities) - 1)
+ if (id >= _countof(g_arrActivities) - 1)
return NULL;
while (id >= 0) {
@@ -1078,7 +1078,7 @@ void CPepActivity::SetActivity(MCONTACT hContact, LPCTSTR szFirst, LPCTSTR szSec
}
TCHAR activityTitle[128];
- ActivityBuildTitle(activity, activityTitle, SIZEOF(activityTitle));
+ ActivityBuildTitle(activity, activityTitle, _countof(activityTitle));
if (!hContact) {
m_mode = activity;
@@ -1089,7 +1089,7 @@ void CPepActivity::SetActivity(MCONTACT hContact, LPCTSTR szFirst, LPCTSTR szSec
if (m_proto->m_pInfoFrame) {
if (activity >= 0) {
- mir_sntprintf(title, SIZEOF(title), TranslateT("Activity: %s"), activityTitle);
+ mir_sntprintf(title, _countof(title), TranslateT("Activity: %s"), activityTitle);
m_proto->m_pInfoFrame->UpdateInfoItem("$/PEP/activity", g_ActivityIcons.GetIcolibHandle(returnActivity(activity)), activityTitle);
}
else {
@@ -1113,7 +1113,7 @@ void CPepActivity::SetActivity(MCONTACT hContact, LPCTSTR szFirst, LPCTSTR szSec
void CPepActivity::ShowSetDialog(BYTE)
{
CJabberDlgPepSimple dlg(m_proto, TranslateT("Set Activity"));
- for (int i=0; i < SIZEOF(g_arrActivities); i++)
+ for (int i=0; i < _countof(g_arrActivities); i++)
if (g_arrActivities[i].szFirst || g_arrActivities[i].szSecond)
dlg.AddStatusMode(i, ActivityGetId(i), g_ActivityIcons.GetIcon(returnActivity(i)), TranslateTS(g_arrActivities[i].szTitle), (g_arrActivities[i].szSecond != NULL));
@@ -1162,7 +1162,7 @@ INT_PTR __cdecl CJabberProto::OnGetXStatusIcon(WPARAM wParam, LPARAM lParam)
if (!wParam)
wParam = ((CPepMood*)m_pepServices.Find(JABBER_FEAT_USER_MOOD))->m_mode;
- if (wParam < 1 || wParam >= SIZEOF(g_arrMoods))
+ if (wParam < 1 || wParam >= _countof(g_arrMoods))
return 0;
int flags = 0;
@@ -1227,7 +1227,7 @@ void CJabberProto::SetContactTune(MCONTACT hContact, LPCTSTR szArtist, LPCTSTR s
setTString(hContact, "ListeningTo", szListeningTo);
char tuneIcon[128];
- mir_snprintf(tuneIcon, SIZEOF(tuneIcon), "%s_%s", m_szModuleName, "main");
+ mir_snprintf(tuneIcon, _countof(tuneIcon), "%s_%s", m_szModuleName, "main");
WriteAdvStatus(hContact, ADVSTATUS_TUNE, _T("listening_to"), tuneIcon, TranslateT("Listening To"), szListeningTo);
mir_free(szListeningTo);
@@ -1292,7 +1292,7 @@ INT_PTR __cdecl CJabberProto::OnSetListeningTo(WPARAM, LPARAM lParam)
szTmp++;
}
}
- mir_sntprintf(szLengthInSec, SIZEOF(szLengthInSec), _T("%d"), result);
+ mir_sntprintf(szLengthInSec, _countof(szLengthInSec), _T("%d"), result);
}
SendPepTune(szArtist, szLength ? szLengthInSec : NULL, szSource, szTitle, szTrack, NULL);
@@ -1354,7 +1354,7 @@ INT_PTR __cdecl CJabberProto::OnGetXStatusEx(WPARAM hContact, LPARAM lParam)
if (pData->flags & CSSF_MASK_NAME) {
if (pData->flags & CSSF_DEFAULT_NAME) {
DWORD dwXStatus = (pData->wParam == NULL) ? pepMood->m_mode : *pData->wParam;
- if (dwXStatus >= SIZEOF(g_arrMoods))
+ if (dwXStatus >= _countof(g_arrMoods))
return 1;
if (pData->flags & CSSF_UNICODE)
@@ -1404,7 +1404,7 @@ INT_PTR __cdecl CJabberProto::OnGetXStatusEx(WPARAM hContact, LPARAM lParam)
if (pData->flags & CSSF_STATUSES_COUNT)
if (pData->wParam)
- *pData->wParam = SIZEOF(g_arrMoods);
+ *pData->wParam = _countof(g_arrMoods);
if (pData->flags & CSSF_STR_SIZES) {
if (pData->wParam) *pData->wParam = STATUS_TITLE_MAX;
@@ -1425,7 +1425,7 @@ INT_PTR __cdecl CJabberProto::OnSetXStatusEx(WPARAM, LPARAM lParam)
CPepMood *pepMood = (CPepMood*)m_pepServices.Find(JABBER_FEAT_USER_MOOD);
int status = (pData->flags & CSSF_MASK_STATUS) ? *pData->status : pepMood->m_mode;
- if (status >= 0 && status < SIZEOF(g_arrMoods)) {
+ if (status >= 0 && status < _countof(g_arrMoods)) {
pepMood->m_mode = status;
pepMood->m_text = (pData->flags & CSSF_MASK_MESSAGE) ? JabberStrFixLines(pData->ptszMessage) : NULL;
pepMood->LaunchSetGui(1);
@@ -1509,18 +1509,18 @@ TCHAR* CJabberProto::ReadAdvStatusT(MCONTACT hContact, const char *pszSlot, cons
void g_XstatusIconsInit()
{
TCHAR szFile[MAX_PATH];
- GetModuleFileName(hInst, szFile, SIZEOF(szFile));
+ GetModuleFileName(hInst, szFile, _countof(szFile));
if (TCHAR *p = _tcsrchr(szFile, '\\'))
mir_tstrcpy(p + 1, _T("..\\Icons\\xstatus_jabber.dll"));
TCHAR szSection[100];
mir_tstrcpy(szSection, _T("Protocols/Jabber/")LPGENT("Moods"));
- for (int i = 1; i < SIZEOF(g_arrMoods); i++)
+ for (int i = 1; i < _countof(g_arrMoods); i++)
g_MoodIcons.RegisterIcon(g_arrMoods[i].szTag, szFile, -(200 + i), szSection, TranslateTS(g_arrMoods[i].szName));
mir_tstrcpy(szSection, _T("Protocols/Jabber/")LPGENT("Activities"));
- for (int k = 0; k < SIZEOF(g_arrActivities); k++) {
+ for (int k = 0; k < _countof(g_arrActivities); k++) {
if (g_arrActivities[k].szFirst)
g_ActivityIcons.RegisterIcon(g_arrActivities[k].szFirst, szFile, g_arrActivities[k].iconid, szSection, TranslateTS(g_arrActivities[k].szTitle));
if (g_arrActivities[k].szSecond)
diff --git a/protocols/MRA/src/MraAdvancedSearch.cpp b/protocols/MRA/src/MraAdvancedSearch.cpp
index 94d201356e..42cc03beb1 100644
--- a/protocols/MRA/src/MraAdvancedSearch.cpp
+++ b/protocols/MRA/src/MraAdvancedSearch.cpp
@@ -80,7 +80,7 @@ void InitComboBoxNumders(HWND hWndCombo, DWORD dwStart, DWORD dwEnd)
for (DWORD i = dwStart; i <= dwEnd; i++) {
TCHAR szBuff[MAX_PATH];
- mir_sntprintf(szBuff, SIZEOF(szBuff), _T("%lu"), i);
+ mir_sntprintf(szBuff, _countof(szBuff), _T("%lu"), i);
DWORD dwItem = SendMessage(hWndCombo, CB_ADDSTRING, 0, (LPARAM)szBuff);
SendMessage(hWndCombo, CB_SETITEMDATA, dwItem, i);
}
@@ -106,7 +106,7 @@ INT_PTR CALLBACK AdvancedSearchDlgProc(HWND hWndDlg, UINT message, WPARAM wParam
HWND hWndCombo = GetDlgItem(hWndDlg, IDC_EMAIL_DOMAIN);
ResetComboBox(hWndCombo);
for (size_t i = 0; lpcszMailRuDomains[i]; i++) {
- MultiByteToWideChar(MRA_CODE_PAGE, 0, lpcszMailRuDomains[i], -1, wszBuff, SIZEOF(wszBuff));
+ MultiByteToWideChar(MRA_CODE_PAGE, 0, lpcszMailRuDomains[i], -1, wszBuff, _countof(wszBuff));
SendMessage(hWndCombo, CB_ADDSTRING, 0, (LPARAM)wszBuff);
}
@@ -260,20 +260,20 @@ HWND CMraProto::SearchAdvanced(HWND hWndDlg)
char szUser[MAX_PATH], szDomain[MAX_PATH];
TCHAR wszNickName[MAX_PATH], wszFirstName[MAX_PATH], wszLastName[MAX_PATH];
- size_t dwUserSize = GetDlgItemTextA(hWndDlg, IDC_EMAIL_USER, szUser, SIZEOF(szUser));
- size_t dwDomainSize = GetDlgItemTextA(hWndDlg, IDC_EMAIL_DOMAIN, szDomain, SIZEOF(szDomain));
+ size_t dwUserSize = GetDlgItemTextA(hWndDlg, IDC_EMAIL_USER, szUser, _countof(szUser));
+ size_t dwDomainSize = GetDlgItemTextA(hWndDlg, IDC_EMAIL_DOMAIN, szDomain, _countof(szDomain));
if (dwUserSize && dwDomainSize) {
SetBit(dwRequestFlags, MRIM_CS_WP_REQUEST_PARAM_USER);
SetBit(dwRequestFlags, MRIM_CS_WP_REQUEST_PARAM_DOMAIN);
}
- size_t dwNickNameSize = GetDlgItemText(hWndDlg, IDC_NICK, wszNickName, SIZEOF(wszNickName));
+ size_t dwNickNameSize = GetDlgItemText(hWndDlg, IDC_NICK, wszNickName, _countof(wszNickName));
if (dwNickNameSize) SetBit(dwRequestFlags, MRIM_CS_WP_REQUEST_PARAM_NICKNAME);
- size_t dwFirstNameSize = GetDlgItemText(hWndDlg, IDC_FIRSTNAME, wszFirstName, SIZEOF(wszFirstName));
+ size_t dwFirstNameSize = GetDlgItemText(hWndDlg, IDC_FIRSTNAME, wszFirstName, _countof(wszFirstName));
if (dwFirstNameSize) SetBit(dwRequestFlags, MRIM_CS_WP_REQUEST_PARAM_FIRSTNAME);
- size_t dwLastNameSize = GetDlgItemText(hWndDlg, IDC_LASTNAME, wszLastName, SIZEOF(wszLastName));
+ size_t dwLastNameSize = GetDlgItemText(hWndDlg, IDC_LASTNAME, wszLastName, _countof(wszLastName));
if (dwLastNameSize) SetBit(dwRequestFlags, MRIM_CS_WP_REQUEST_PARAM_LASTNAME);
DWORD dwSex = GET_CURRENT_COMBO_DATA(hWndDlg, IDC_GENDER);
diff --git a/protocols/MRA/src/MraAvatars.cpp b/protocols/MRA/src/MraAvatars.cpp
index fc53c18d8e..41139cbe0f 100644
--- a/protocols/MRA/src/MraAvatars.cpp
+++ b/protocols/MRA/src/MraAvatars.cpp
@@ -48,7 +48,7 @@ DWORD MraAvatarsHttpTransaction(HANDLE hConnection, DWORD dwRequestType, LPCSTR
DWORD CMraProto::MraAvatarsQueueInitialize(HANDLE *phAvatarsQueueHandle)
{
- mir_snprintf(szAvtSectName, SIZEOF(szAvtSectName), "%s Avatars", m_szModuleName);
+ mir_snprintf(szAvtSectName, _countof(szAvtSectName), "%s Avatars", m_szModuleName);
if (phAvatarsQueueHandle == NULL)
return ERROR_INVALID_HANDLE;
@@ -230,7 +230,7 @@ void CMraProto::MraAvatarsThreadProc(LPVOID lpParameter)
break;
default:
- mir_sntprintf(szErrorText, SIZEOF(szErrorText), TranslateT("Avatars: server return HTTP code: %lu"), dwResultCode);
+ mir_sntprintf(szErrorText, _countof(szErrorText), TranslateT("Avatars: server return HTTP code: %lu"), dwResultCode);
ShowFormattedErrorMessage(szErrorText, NO_ERROR);
break;
}
@@ -262,7 +262,7 @@ void CMraProto::MraAvatarsThreadProc(LPVOID lpParameter)
bContinue = FALSE;
break;
case 1:
- dwReceived = Netlib_Recv(hConnection, (LPSTR)&btBuff, SIZEOF(btBuff), 0);
+ dwReceived = Netlib_Recv(hConnection, (LPSTR)&btBuff, _countof(btBuff), 0);
if (dwReceived == 0 || dwReceived == SOCKET_ERROR) {
dwErrorCode = GetLastError();
ShowFormattedErrorMessage(L"Avatars: error on receive file data", dwErrorCode);
@@ -288,7 +288,7 @@ void CMraProto::MraAvatarsThreadProc(LPVOID lpParameter)
}
else {
dwErrorCode = GetLastError();
- mir_sntprintf(szErrorText, SIZEOF(szErrorText), TranslateT("Avatars: can't open file %s, error"), wszFileName);
+ mir_sntprintf(szErrorText, _countof(szErrorText), TranslateT("Avatars: can't open file %s, error"), wszFileName);
ShowFormattedErrorMessage(szErrorText, dwErrorCode);
}
}
@@ -375,7 +375,7 @@ DWORD MraAvatarsHttpTransaction(HANDLE hConnection, DWORD dwRequestType, LPCSTR
}
char szBuff[4096];
- mir_snprintf(szBuff, SIZEOF(szBuff), "http://%s/%s/%s/%s", lpszHost, lpszDomain, lpszUser, lpszReqObj);
+ mir_snprintf(szBuff, _countof(szBuff), "http://%s/%s/%s/%s", lpszHost, lpszDomain, lpszUser, lpszReqObj);
CMStringA szSelfVersionString = MraGetSelfVersionString();
NETLIBHTTPHEADER nlbhHeaders[8] = { 0 };
@@ -473,7 +473,7 @@ DWORD CMraProto::MraAvatarsGetFileName(HANDLE hAvatarsQueueHandle, MCONTACT hCon
return ERROR_NOT_SUPPORTED;
TCHAR tszBase[MAX_PATH];
- mir_sntprintf(tszBase, SIZEOF(tszBase), _T("%s\\%s\\"), VARST(_T("%miranda_avatarcache%")), m_tszUserName);
+ mir_sntprintf(tszBase, _countof(tszBase), _T("%s\\%s\\"), VARST(_T("%miranda_avatarcache%")), m_tszUserName);
res = tszBase;
// some path in buff and free space for file name is avaible
@@ -601,13 +601,13 @@ INT_PTR CALLBACK MraAvatarsQueueDlgProcOpts(HWND hWndDlg, UINT msg, WPARAM wPara
CheckDlgButton(hWndDlg, IDC_RETURN_ABC_PATH, db_get_b(NULL, MRA_AVT_SECT_NAME, "ReturnAbsolutePath", MRA_AVT_DEFAULT_RET_ABC_PATH) ? BST_CHECKED : BST_UNCHECKED);
CheckDlgButton(hWndDlg, IDC_DELETE_AVT_ON_CONTACT_DELETE, db_get_b(NULL, MRA_AVT_SECT_NAME, "DeleteAvtOnContactDelete", MRA_DELETE_AVT_ON_CONTACT_DELETE) ? BST_CHECKED : BST_UNCHECKED);
- EnableControlsArray(hWndDlg, (WORD*)&wMraAvatarsControlsList, SIZEOF(wMraAvatarsControlsList), IsDlgButtonChecked(hWndDlg, IDC_ENABLE));
+ EnableControlsArray(hWndDlg, (WORD*)&wMraAvatarsControlsList, _countof(wMraAvatarsControlsList), IsDlgButtonChecked(hWndDlg, IDC_ENABLE));
}
return TRUE;
case WM_COMMAND:
if (LOWORD(wParam) == IDC_ENABLE)
- EnableControlsArray(hWndDlg, (WORD*)&wMraAvatarsControlsList, SIZEOF(wMraAvatarsControlsList), IsDlgButtonChecked(hWndDlg, IDC_ENABLE));
+ EnableControlsArray(hWndDlg, (WORD*)&wMraAvatarsControlsList, _countof(wMraAvatarsControlsList), IsDlgButtonChecked(hWndDlg, IDC_ENABLE));
if (LOWORD(wParam) == IDC_BUTTON_DEFAULT) {
SetDlgItemTextA(hWndDlg, IDC_SERVER, MRA_AVT_DEFAULT_SERVER);
@@ -629,7 +629,7 @@ INT_PTR CALLBACK MraAvatarsQueueDlgProcOpts(HWND hWndDlg, UINT msg, WPARAM wPara
db_set_dw(NULL, MRA_AVT_SECT_NAME, "ServerPort", GetDlgItemInt(hWndDlg, IDC_SERVERPORT, NULL, FALSE));
TCHAR szServer[MAX_PATH];
- GetDlgItemText(hWndDlg, IDC_SERVER, szServer, SIZEOF(szServer));
+ GetDlgItemText(hWndDlg, IDC_SERVER, szServer, _countof(szServer));
db_set_ts(NULL, MRA_AVT_SECT_NAME, "Server", szServer);
return TRUE;
}
diff --git a/protocols/MRA/src/MraChat.cpp b/protocols/MRA/src/MraChat.cpp
index bf259339e1..758669b69b 100644
--- a/protocols/MRA/src/MraChat.cpp
+++ b/protocols/MRA/src/MraChat.cpp
@@ -44,7 +44,7 @@ INT_PTR CMraProto::MraChatSessionNew(MCONTACT hContact)
if (!CallServiceSync(MS_GC_NEWSESSION, NULL, (LPARAM)&gcw)) {
GCDEST gcd = { m_szModuleName, wszEMail.c_str(), GC_EVENT_ADDGROUP };
GCEVENT gce = { sizeof(gce), &gcd };
- for (int i = 0; i < SIZEOF(lpwszStatuses); i++) {
+ for (int i = 0; i < _countof(lpwszStatuses); i++) {
gce.ptszStatus = TranslateTS(lpwszStatuses[i]);
CallServiceSync(MS_GC_EVENT, NULL, (LPARAM)&gce);
}
diff --git a/protocols/MRA/src/MraFilesQueue.cpp b/protocols/MRA/src/MraFilesQueue.cpp
index c2270d4d16..448d344c8f 100644
--- a/protocols/MRA/src/MraFilesQueue.cpp
+++ b/protocols/MRA/src/MraFilesQueue.cpp
@@ -67,7 +67,7 @@ static WORD wMraFilesControlsList[] = {
void MraFilesQueueDlgEnableDirectConsControls(HWND hWndDlg, BOOL bEnabled)
{
- EnableControlsArray(hWndDlg, (WORD*)&wMraFilesControlsList, SIZEOF(wMraFilesControlsList), bEnabled);
+ EnableControlsArray(hWndDlg, (WORD*)&wMraFilesControlsList, _countof(wMraFilesControlsList), bEnabled);
EnableWindow(GetDlgItem(hWndDlg, IDC_FILE_SEND_EXTRA_ADDRESS), (bEnabled && IsDlgButtonChecked(hWndDlg, IDC_FILE_SEND_ADD_EXTRA_ADDRESS)));
}
@@ -122,7 +122,7 @@ INT_PTR CALLBACK MraFilesQueueDlgProcOpts(HWND hWndDlg, UINT msg, WPARAM wParam,
ppro->setByte("FileSendAddExtraAddresses", IsDlgButtonChecked(hWndDlg, IDC_FILE_SEND_ADD_EXTRA_ADDRESS));
WCHAR szBuff[MAX_PATH];
- GetDlgItemText(hWndDlg, IDC_FILE_SEND_EXTRA_ADDRESS, szBuff, SIZEOF(szBuff));
+ GetDlgItemText(hWndDlg, IDC_FILE_SEND_EXTRA_ADDRESS, szBuff, _countof(szBuff));
ppro->mraSetStringW(NULL, "FileSendExtraAddresses", szBuff);
ppro->setDword("FileSendBlockSize", (DWORD)GetDlgItemInt(hWndDlg, IDC_FILE_SEND_BLOCK_SIZE, NULL, FALSE));
ppro->setByte("FileSendEnableMRIMProxyCons", IsDlgButtonChecked(hWndDlg, IDC_FILE_SEND_ENABLE_MRIMPROXY_CONS));
@@ -240,7 +240,7 @@ size_t CMraProto::MraFilesQueueGetLocalAddressesList(LPSTR lpszBuff, size_t dwBu
}
CHAR szHostName[MAX_PATH] = { 0 };
- if (gethostname(szHostName, SIZEOF(szHostName)) == 0)
+ if (gethostname(szHostName, _countof(szHostName)) == 0)
if ((sh = gethostbyname((LPSTR)&szHostName))) {
while (sh->h_addr_list[dwAdapter]) {
lpszCurPos += mir_snprintf(lpszCurPos, (dwBuffSize - ((size_t)lpszCurPos - (size_t)lpszBuff)), "%s:%lu;", inet_ntoa(*((struct in_addr*)sh->h_addr_list[dwAdapter])), dwPort);
@@ -390,14 +390,14 @@ bool CMraProto::MraFilesQueueHandCheck(HANDLE hConnection, MRA_FILES_QUEUE_ITEM
if (dat->bSending == FALSE) {
// receiving
- dwBuffSize = mir_snprintf((LPSTR)btBuff, SIZEOF(btBuff), "%s %s", MRA_FT_HELLO, szEmailMy.c_str()) + 1;
+ dwBuffSize = mir_snprintf((LPSTR)btBuff, _countof(btBuff), "%s %s", MRA_FT_HELLO, szEmailMy.c_str()) + 1;
if (dwBuffSize == (size_t)Netlib_Send(hConnection, (LPSTR)btBuff, (int)dwBuffSize, 0)) {
// my email sended
ProtoBroadcastAck(dat->hContact, ACKTYPE_FILE, ACKRESULT_INITIALISING, (HANDLE)dat->dwIDRequest, 0);
dwBuffSize = Netlib_Recv(hConnection, (LPSTR)btBuff, sizeof(btBuff), 0);
if ((szEmail.GetLength() + sizeof(MRA_FT_HELLO)+1) == dwBuffSize) {
// email received
- mir_snprintf(((LPSTR)btBuff + dwBuffSize), (SIZEOF(btBuff) - dwBuffSize), "%s %s", MRA_FT_HELLO, szEmail);
+ mir_snprintf(((LPSTR)btBuff + dwBuffSize), (_countof(btBuff) - dwBuffSize), "%s %s", MRA_FT_HELLO, szEmail);
if (!_memicmp(btBuff, btBuff + dwBuffSize, dwBuffSize))
return true;
}
@@ -408,10 +408,10 @@ bool CMraProto::MraFilesQueueHandCheck(HANDLE hConnection, MRA_FILES_QUEUE_ITEM
if ((szEmail.GetLength() + sizeof(MRA_FT_HELLO)+1) == dwBuffSize) {
// email received
ProtoBroadcastAck(dat->hContact, ACKTYPE_FILE, ACKRESULT_INITIALISING, (HANDLE)dat->dwIDRequest, 0);
- mir_snprintf(((LPSTR)btBuff + dwBuffSize), (SIZEOF(btBuff) - dwBuffSize), "%s %s", MRA_FT_HELLO, szEmail);
+ mir_snprintf(((LPSTR)btBuff + dwBuffSize), (_countof(btBuff) - dwBuffSize), "%s %s", MRA_FT_HELLO, szEmail);
if (!_memicmp(btBuff, btBuff + dwBuffSize, dwBuffSize)) {
// email verified
- dwBuffSize = (mir_snprintf((LPSTR)btBuff, SIZEOF(btBuff), "%s %s", MRA_FT_HELLO, szEmailMy.c_str()) + 1);
+ dwBuffSize = (mir_snprintf((LPSTR)btBuff, _countof(btBuff), "%s %s", MRA_FT_HELLO, szEmailMy.c_str()) + 1);
if (dwBuffSize == (size_t)Netlib_Send(hConnection, (LPSTR)btBuff, (int)dwBuffSize, 0))
return true;
}
@@ -670,13 +670,13 @@ DWORD CMraProto::MraFilesQueueAddReceive(HANDLE hFilesQueueHandle, DWORD dwFlags
LPWSTR lpwszDelimiter = dat->pwszFilesList;
LPWSTR lpwszCurrentItem = dat->pwszDescription;
- StrFormatByteSizeW(dat->dwFilesTotalSize, szBuff, SIZEOF(szBuff));
+ StrFormatByteSizeW(dat->dwFilesTotalSize, szBuff, _countof(szBuff));
lpwszCurrentItem += mir_sntprintf(lpwszCurrentItem, ((dwMemSize - ((size_t)lpwszCurrentItem - (size_t)dat->pwszDescription)) / sizeof(WCHAR)), L"%I64u Files (%s)\r\n", dat->dwFilesCount, szBuff);
// description + filesnames
for (size_t i = 0; i < dat->dwFilesCount; i++) {
lpwszDelimiter += mir_sntprintf(lpwszDelimiter, ((dwMemSize - ((size_t)lpwszDelimiter - (size_t)dat->pwszFilesList)) / sizeof(WCHAR)), L"%s", dat->pmfqfFiles[i].lpwszName);
- StrFormatByteSizeW(dat->pmfqfFiles[i].dwSize, szBuff, SIZEOF(szBuff));
+ StrFormatByteSizeW(dat->pmfqfFiles[i].dwSize, szBuff, _countof(szBuff));
lpwszCurrentItem += mir_sntprintf(lpwszCurrentItem, ((dwMemSize - ((size_t)lpwszCurrentItem - (size_t)dat->pwszDescription)) / sizeof(WCHAR)), L"%s - %s\r\n", dat->pmfqfFiles[i].lpwszName, szBuff);
}
@@ -769,7 +769,7 @@ void CMraProto::MraFilesQueueRecvThreadProc(LPVOID lpParameter)
pfts.currentFileProgress = 0;
//pfts.currentFileTime; //as seconds since 1970
- if ((dat->dwPathSize + dat->pmfqfFiles[i].dwNameLen) < SIZEOF(wszFileName)) {
+ if ((dat->dwPathSize + dat->pmfqfFiles[i].dwNameLen) < _countof(wszFileName)) {
memcpy(wszFileName, dat->lpwszPath, (dat->dwPathSize*sizeof(WCHAR)));
memcpy((wszFileName + dat->dwPathSize), dat->pmfqfFiles[i].lpwszName, ((dat->pmfqfFiles[i].dwNameLen + 1)*sizeof(WCHAR)));
wszFileName[dat->dwPathSize + dat->pmfqfFiles[i].dwNameLen] = 0;
@@ -786,10 +786,10 @@ void CMraProto::MraFilesQueueRecvThreadProc(LPVOID lpParameter)
ProtoBroadcastAck(dat->hContact, ACKTYPE_FILE, ACKRESULT_NEXTFILE, (HANDLE)dat->dwIDRequest, 0);
- //dwBuffSizeUsed = (mir_snprintf((LPSTR)btBuff, SIZEOF(btBuff), "%s %S", MRA_FT_GET_FILE, dat->pmfqfFiles[i].lpwszName)+1);
+ //dwBuffSizeUsed = (mir_snprintf((LPSTR)btBuff, _countof(btBuff), "%s %S", MRA_FT_GET_FILE, dat->pmfqfFiles[i].lpwszName)+1);
memcpy(btBuff, MRA_FT_GET_FILE, sizeof(MRA_FT_GET_FILE));
btBuff[(sizeof(MRA_FT_GET_FILE)-1)] = ' ';
- dwBuffSizeUsed = sizeof(MRA_FT_GET_FILE) + WideCharToMultiByte(MRA_CODE_PAGE, 0, dat->pmfqfFiles[i].lpwszName, (int)dat->pmfqfFiles[i].dwNameLen, (LPSTR)(btBuff + sizeof(MRA_FT_GET_FILE)), (int)(SIZEOF(btBuff) - sizeof(MRA_FT_GET_FILE)), NULL, NULL);
+ dwBuffSizeUsed = sizeof(MRA_FT_GET_FILE) + WideCharToMultiByte(MRA_CODE_PAGE, 0, dat->pmfqfFiles[i].lpwszName, (int)dat->pmfqfFiles[i].dwNameLen, (LPSTR)(btBuff + sizeof(MRA_FT_GET_FILE)), (int)(_countof(btBuff) - sizeof(MRA_FT_GET_FILE)), NULL, NULL);
btBuff[dwBuffSizeUsed] = 0;
dwBuffSizeUsed++;
@@ -822,7 +822,7 @@ void CMraProto::MraFilesQueueRecvThreadProc(LPVOID lpParameter)
bContinue = FALSE;
break;
case 1:
- dwReceived = Netlib_Recv(dat->hConnection, (LPSTR)&btBuff, SIZEOF(btBuff), 0);
+ dwReceived = Netlib_Recv(dat->hConnection, (LPSTR)&btBuff, _countof(btBuff), 0);
if (dwReceived == 0 || dwReceived == SOCKET_ERROR) {
dwRetErrorCode = GetLastError();
ShowFormattedErrorMessage(L"Receive files: error on receive file data", dwRetErrorCode);
@@ -857,7 +857,7 @@ void CMraProto::MraFilesQueueRecvThreadProc(LPVOID lpParameter)
}
else {// err allocating file disk space
dwRetErrorCode = GetLastError();
- mir_sntprintf(szErrorText, SIZEOF(szErrorText), TranslateT("Receive files: can't allocate disk space for file, size %lu bytes, error"), dat->pmfqfFiles[i].dwSize);
+ mir_sntprintf(szErrorText, _countof(szErrorText), TranslateT("Receive files: can't allocate disk space for file, size %lu bytes, error"), dat->pmfqfFiles[i].dwSize);
ShowFormattedErrorMessage(szErrorText, dwRetErrorCode);
}
CloseHandle(hFile);
@@ -870,7 +870,7 @@ void CMraProto::MraFilesQueueRecvThreadProc(LPVOID lpParameter)
}
else {// err on open file
dwRetErrorCode = GetLastError();
- mir_sntprintf(szErrorText, SIZEOF(szErrorText), TranslateT("Receive files: can't open file %s, error"), wszFileName);
+ mir_sntprintf(szErrorText, _countof(szErrorText), TranslateT("Receive files: can't open file %s, error"), wszFileName);
ShowFormattedErrorMessage(szErrorText, dwRetErrorCode);
bFailed = TRUE;
break;
@@ -878,7 +878,7 @@ void CMraProto::MraFilesQueueRecvThreadProc(LPVOID lpParameter)
}
else {// err on send request for file
dwRetErrorCode = GetLastError();
- mir_sntprintf(szErrorText, SIZEOF(szErrorText), TranslateT("Receive files: request for file %s not sent, error"), dat->pmfqfFiles[i].lpwszName);
+ mir_sntprintf(szErrorText, _countof(szErrorText), TranslateT("Receive files: request for file %s not sent, error"), dat->pmfqfFiles[i].lpwszName);
ShowFormattedErrorMessage(szErrorText, NO_ERROR);
bFailed = TRUE;
break;
@@ -986,7 +986,7 @@ void CMraProto::MraFilesQueueSendThreadProc(LPVOID lpParameter)
pfts.wszWorkingDir = dat->lpwszPath;
dwSendBlockSize = getDword("FileSendBlockSize", MRA_DEFAULT_FILE_SEND_BLOCK_SIZE);
- if (dwSendBlockSize > SIZEOF(btBuff)) dwSendBlockSize = SIZEOF(btBuff);
+ if (dwSendBlockSize > _countof(btBuff)) dwSendBlockSize = _countof(btBuff);
if (dwSendBlockSize < 512) dwSendBlockSize = MRA_DEFAULT_FILE_SEND_BLOCK_SIZE;
if (MraFilesQueueConnectIn(dat))
@@ -1014,7 +1014,7 @@ void CMraProto::MraFilesQueueSendThreadProc(LPVOID lpParameter)
dwBuffSizeUsed = 0;
while (TRUE) {
- dwReceived = Netlib_Recv(dat->hConnection, ((LPSTR)btBuff + dwBuffSizeUsed), (int)(SIZEOF(btBuff) - dwBuffSizeUsed), 0);
+ dwReceived = Netlib_Recv(dat->hConnection, ((LPSTR)btBuff + dwBuffSizeUsed), (int)(_countof(btBuff) - dwBuffSizeUsed), 0);
if (dwReceived == 0 || dwReceived == SOCKET_ERROR) { // err on receive file name to send
dwRetErrorCode = GetLastError();
ShowFormattedErrorMessage(L"Send files: file send request not received, error", dwRetErrorCode);
@@ -1038,7 +1038,7 @@ void CMraProto::MraFilesQueueSendThreadProc(LPVOID lpParameter)
bFailed = TRUE;
for (j = 0; j < dat->dwFilesCount; j++) {
lpwszFileName = GetFileNameFromFullPathW(dat->pmfqfFiles[j].lpwszName, dat->pmfqfFiles[j].dwNameLen);
- szFileName[WideCharToMultiByte(MRA_CODE_PAGE, 0, lpwszFileName, (int)(dat->pmfqfFiles[j].dwNameLen - (lpwszFileName - dat->pmfqfFiles[j].lpwszName)), szFileName, SIZEOF(szFileName), NULL, NULL)] = 0;
+ szFileName[WideCharToMultiByte(MRA_CODE_PAGE, 0, lpwszFileName, (int)(dat->pmfqfFiles[j].dwNameLen - (lpwszFileName - dat->pmfqfFiles[j].lpwszName)), szFileName, _countof(szFileName), NULL, NULL)] = 0;
if (!_memicmp(btBuff + sizeof(MRA_FT_GET_FILE), szFileName, dwBuffSizeUsed - (sizeof(MRA_FT_GET_FILE)+1))) {
bFailed = FALSE;
@@ -1057,7 +1057,7 @@ void CMraProto::MraFilesQueueSendThreadProc(LPVOID lpParameter)
pfts.currentFileProgress = 0;
//pfts.currentFileTime; //as seconds since 1970
- WideCharToMultiByte(MRA_CODE_PAGE, 0, dat->pmfqfFiles[j].lpwszName, (int)dat->pmfqfFiles[j].dwNameLen, szFileName, SIZEOF(szFileName), NULL, NULL);
+ WideCharToMultiByte(MRA_CODE_PAGE, 0, dat->pmfqfFiles[j].lpwszName, (int)dat->pmfqfFiles[j].dwNameLen, szFileName, _countof(szFileName), NULL, NULL);
ProtoBroadcastAck(dat->hContact, ACKTYPE_FILE, ACKRESULT_DATA, (HANDLE)dat->dwIDRequest, (LPARAM)&pfts);
while (TRUE) { // read and sending
@@ -1101,14 +1101,14 @@ void CMraProto::MraFilesQueueSendThreadProc(LPVOID lpParameter)
}
else { // err on open file
dwRetErrorCode = GetLastError();
- mir_sntprintf(szErrorText, SIZEOF(szErrorText), TranslateT("Send files: can't open file %s, error"), dat->pmfqfFiles[j].lpwszName);
+ mir_sntprintf(szErrorText, _countof(szErrorText), TranslateT("Send files: can't open file %s, error"), dat->pmfqfFiles[j].lpwszName);
ShowFormattedErrorMessage(szErrorText, dwRetErrorCode);
bFailed = TRUE;
break;
}
}
else {
- mir_sntprintf(szErrorText, SIZEOF(szErrorText), TranslateT("Send files: requested file: %S - not found in send files list."), (((LPSTR)btBuff) + sizeof(MRA_FT_GET_FILE)));
+ mir_sntprintf(szErrorText, _countof(szErrorText), TranslateT("Send files: requested file: %S - not found in send files list."), (((LPSTR)btBuff) + sizeof(MRA_FT_GET_FILE)));
ShowFormattedErrorMessage(szErrorText, NO_ERROR);
bFailed = TRUE;
break;
diff --git a/protocols/MRA/src/MraIcons.cpp b/protocols/MRA/src/MraIcons.cpp
index ee4ca32b7c..c50782741e 100644
--- a/protocols/MRA/src/MraIcons.cpp
+++ b/protocols/MRA/src/MraIcons.cpp
@@ -75,7 +75,7 @@ void InitXStatusIcons()
{
// load libs
TCHAR szBuff[MAX_FILEPATH];
- if (GetModuleFileName(NULL, szBuff, SIZEOF(szBuff))) {
+ if (GetModuleFileName(NULL, szBuff, _countof(szBuff))) {
LPWSTR lpwszFileName;
g_dwMirWorkDirPathLen = GetFullPathName(szBuff, MAX_FILEPATH, g_szMirWorkDirPath, &lpwszFileName);
if (g_dwMirWorkDirPathLen) {
@@ -84,7 +84,7 @@ void InitXStatusIcons()
// load xstatus icons lib
DWORD dwBuffLen;
- DWORD dwErrorCode = FindFile(g_szMirWorkDirPath, (DWORD)g_dwMirWorkDirPathLen, _T("xstatus_MRA.dll"), -1, szBuff, SIZEOF(szBuff), &dwBuffLen);
+ DWORD dwErrorCode = FindFile(g_szMirWorkDirPath, (DWORD)g_dwMirWorkDirPathLen, _T("xstatus_MRA.dll"), -1, szBuff, _countof(szBuff), &dwBuffLen);
if (dwErrorCode == NO_ERROR) {
g_hDLLXStatusIcons = LoadLibraryEx(szBuff, NULL, 0);
if (g_hDLLXStatusIcons) {
@@ -98,7 +98,7 @@ void InitXStatusIcons()
}
}
- GetModuleFileName((g_hDLLXStatusIcons != NULL) ? g_hDLLXStatusIcons : g_hInstance, szBuff, SIZEOF(szBuff));
+ GetModuleFileName((g_hDLLXStatusIcons != NULL) ? g_hDLLXStatusIcons : g_hInstance, szBuff, _countof(szBuff));
SKINICONDESC sid = { 0 };
sid.section.t = LPGENT("Protocols")_T("/")LPGENT("MRA")_T("/")LPGENT("Custom Status");
@@ -109,7 +109,7 @@ void InitXStatusIcons()
hXStatusAdvancedStatusIcons[0] = NULL;
for (DWORD i = 1; i < MRA_XSTATUS_COUNT+1; i++) {
char szBuff[MAX_PATH];
- mir_snprintf(szBuff, SIZEOF(szBuff), "mra_xstatus%ld", i);
+ mir_snprintf(szBuff, _countof(szBuff), "mra_xstatus%ld", i);
sid.pszName = szBuff;
int iCurIndex = i+IDI_XSTATUS1-1;
@@ -125,7 +125,7 @@ void DestroyXStatusIcons()
char szBuff[MAX_PATH];
for (DWORD i = 1; i < MRA_XSTATUS_COUNT+1; i++) {
- mir_snprintf(szBuff, SIZEOF(szBuff), "mra_xstatus%ld", i);
+ mir_snprintf(szBuff, _countof(szBuff), "mra_xstatus%ld", i);
IcoLib_RemoveIcon(szBuff);
}
diff --git a/protocols/MRA/src/MraPlaces.h b/protocols/MRA/src/MraPlaces.h
index ef85c025e7..4adccbb8a9 100644
--- a/protocols/MRA/src/MraPlaces.h
+++ b/protocols/MRA/src/MraPlaces.h
@@ -41,7 +41,7 @@ typedef struct
{
if (mrapPlaces[i].dwCityID == 0 && mrapPlaces[i].dwPlaceID == 0)
{
- mir_sntprintf(szBuff, SIZEOF(szBuff), L" {%ld, TEXT(\"%s\")}, ", mrapPlaces[i].dwCountryID, mrapPlaces[i].lpszData);
+ mir_sntprintf(szBuff, _countof(szBuff), L" {%ld, TEXT(\"%s\")}, ", mrapPlaces[i].dwCountryID, mrapPlaces[i].lpszData);
DebugPrintCRLFW(szBuff);
}
}
@@ -53,7 +53,7 @@ typedef struct
{
if (mrapPlaces[i].dwCityID && mrapPlaces[i].dwPlaceID == 0)
{
- mir_sntprintf(szBuff, SIZEOF(szBuff), L" {%ld, %ld, TEXT(\"%s\")}, ", mrapPlaces[i].dwCountryID, mrapPlaces[i].dwCityID, mrapPlaces[i].lpszData);
+ mir_sntprintf(szBuff, _countof(szBuff), L" {%ld, %ld, TEXT(\"%s\")}, ", mrapPlaces[i].dwCountryID, mrapPlaces[i].dwCityID, mrapPlaces[i].lpszData);
DebugPrintCRLFW(szBuff);
}
}
diff --git a/protocols/MRA/src/MraPopUp.cpp b/protocols/MRA/src/MraPopUp.cpp
index 0f95e24cd2..3fb69e53aa 100644
--- a/protocols/MRA/src/MraPopUp.cpp
+++ b/protocols/MRA/src/MraPopUp.cpp
@@ -47,20 +47,20 @@ INT_PTR CALLBACK MraPopupDlgProcOpts(HWND hWndDlg, UINT msg, WPARAM wParam, LPAR
bEnabled = GetBit(ppro->getDword("PopupsEventFilter", MRA_DEFAULT_POPUPS_EVENT_FILTER), dwType);
CheckDlgButton(hWndDlg, IDC_CHK_ENABLE, bEnabled ? BST_CHECKED : BST_UNCHECKED);
- mir_snprintf(szBuff, SIZEOF(szBuff), "PopupType%SUseWinColors", lpcwszPopupsTypes[dwType]);
+ mir_snprintf(szBuff, _countof(szBuff), "PopupType%SUseWinColors", lpcwszPopupsTypes[dwType]);
bUseWinColors = ppro->getByte(szBuff, MRA_DEFAULT_POPUP_USE_WIN_COLORS);
CheckDlgButton(hWndDlg, IDC_CHK_USE_WIN_COLORS, bUseWinColors ? BST_CHECKED : BST_UNCHECKED);
EnableWindow(GetDlgItem(hWndDlg, IDC_CHK_USE_WIN_COLORS), bEnabled);
- mir_snprintf(szBuff, SIZEOF(szBuff), "PopupType%SColorBack", lpcwszPopupsTypes[dwType]);
+ mir_snprintf(szBuff, _countof(szBuff), "PopupType%SColorBack", lpcwszPopupsTypes[dwType]);
SendDlgItemMessage(hWndDlg, IDC_POPUP_BACKCOLOR, CPM_SETCOLOUR, 0, ppro->getDword(szBuff, MRA_DEFAULT_POPUP_COLOR_BACK));
EnableWindow(GetDlgItem(hWndDlg, IDC_POPUP_BACKCOLOR), (bEnabled && bUseWinColors == FALSE));
- mir_snprintf(szBuff, SIZEOF(szBuff), "PopupType%SColorText", lpcwszPopupsTypes[dwType]);
+ mir_snprintf(szBuff, _countof(szBuff), "PopupType%SColorText", lpcwszPopupsTypes[dwType]);
SendDlgItemMessage(hWndDlg, IDC_POPUP_TEXTCOLOR, CPM_SETCOLOUR, 0, ppro->getDword(szBuff, MRA_DEFAULT_POPUP_COLOR_TEXT));
EnableWindow(GetDlgItem(hWndDlg, IDC_POPUP_TEXTCOLOR), (bEnabled && bUseWinColors == FALSE));
- mir_snprintf(szBuff, SIZEOF(szBuff), "PopupType%STimeout", lpcwszPopupsTypes[dwType]);
+ mir_snprintf(szBuff, _countof(szBuff), "PopupType%STimeout", lpcwszPopupsTypes[dwType]);
SetDlgItemInt(hWndDlg, IDC_POPUP_TIMEOUT, ppro->getDword(szBuff, MRA_DEFAULT_POPUP_TIMEOUT), FALSE);
EnableWindow(GetDlgItem(hWndDlg, IDC_POPUP_TIMEOUT), bEnabled);
}
@@ -105,16 +105,16 @@ INT_PTR CALLBACK MraPopupDlgProcOpts(HWND hWndDlg, UINT msg, WPARAM wParam, LPAR
ppro->setDword("PopupsEventFilter", dwPopupsEventFilter);
- mir_snprintf(szBuff, SIZEOF(szBuff), "PopupType%SUseWinColors", lpcwszPopupsTypes[dwType]);
+ mir_snprintf(szBuff, _countof(szBuff), "PopupType%SUseWinColors", lpcwszPopupsTypes[dwType]);
ppro->setByte(szBuff, IsDlgButtonChecked(hWndDlg, IDC_CHK_USE_WIN_COLORS));
- mir_snprintf(szBuff, SIZEOF(szBuff), "PopupType%SColorBack", lpcwszPopupsTypes[dwType]);
+ mir_snprintf(szBuff, _countof(szBuff), "PopupType%SColorBack", lpcwszPopupsTypes[dwType]);
ppro->setDword(szBuff, SendDlgItemMessage(hWndDlg, IDC_POPUP_BACKCOLOR, CPM_GETCOLOUR, 0, 0));
- mir_snprintf(szBuff, SIZEOF(szBuff), "PopupType%SColorText", lpcwszPopupsTypes[dwType]);
+ mir_snprintf(szBuff, _countof(szBuff), "PopupType%SColorText", lpcwszPopupsTypes[dwType]);
ppro->setDword(szBuff, SendDlgItemMessage(hWndDlg, IDC_POPUP_TEXTCOLOR, CPM_GETCOLOUR, 0, 0));
- mir_snprintf(szBuff, SIZEOF(szBuff), "PopupType%STimeout", lpcwszPopupsTypes[dwType]);
+ mir_snprintf(szBuff, _countof(szBuff), "PopupType%STimeout", lpcwszPopupsTypes[dwType]);
ppro->setDword(szBuff, GetDlgItemInt(hWndDlg, IDC_POPUP_TIMEOUT, NULL, FALSE));
}
return TRUE;
@@ -204,9 +204,9 @@ void CMraProto::MraPopupShowFromContactW(MCONTACT hContact, DWORD dwType, DWORD
mraGetStringW(hContact, "Nick", szNick);
mraGetStringW(hContact, "e-mail", szEmail);
if (hContact)
- mir_snwprintf(szTitle, SIZEOF(szTitle), L"%s <%s>", szNick, szEmail);
+ mir_snwprintf(szTitle, _countof(szTitle), L"%s <%s>", szNick, szEmail);
else
- mir_snwprintf(szTitle, SIZEOF(szTitle), L"%s: %s <%s>", m_tszUserName, szNick, szEmail);
+ mir_snwprintf(szTitle, _countof(szTitle), L"%s: %s <%s>", m_tszUserName, szNick, szEmail);
MraPopupShowW(hContact, dwType, dwFlags, szTitle, lpszMessage);
}
@@ -262,21 +262,21 @@ void CMraProto::MraPopupShowW(MCONTACT hContact, DWORD dwType, DWORD dwFlags, LP
ppd.PluginData = dat;
char szBuff[MAX_PATH];
- mir_snprintf(szBuff, SIZEOF(szBuff), "PopupType%SUseWinColors", lpcwszPopupsTypes[dwType]);
+ mir_snprintf(szBuff, _countof(szBuff), "PopupType%SUseWinColors", lpcwszPopupsTypes[dwType]);
BOOL bUseWinColors = getByte(szBuff, MRA_DEFAULT_POPUP_USE_WIN_COLORS);
if (bUseWinColors) {
ppd.colorBack = GetSysColor(COLOR_BTNFACE);
ppd.colorText = GetSysColor(COLOR_WINDOWTEXT);
}
else {
- mir_snprintf(szBuff, SIZEOF(szBuff), "PopupType%SColorBack", lpcwszPopupsTypes[dwType]);
+ mir_snprintf(szBuff, _countof(szBuff), "PopupType%SColorBack", lpcwszPopupsTypes[dwType]);
ppd.colorBack = getDword(szBuff, MRA_DEFAULT_POPUP_COLOR_BACK);
- mir_snprintf(szBuff, SIZEOF(szBuff), "PopupType%SColorText", lpcwszPopupsTypes[dwType]);
+ mir_snprintf(szBuff, _countof(szBuff), "PopupType%SColorText", lpcwszPopupsTypes[dwType]);
ppd.colorText = getDword(szBuff, MRA_DEFAULT_POPUP_COLOR_TEXT);
}
- mir_snprintf(szBuff, SIZEOF(szBuff), "PopupType%STimeout", lpcwszPopupsTypes[dwType]);
+ mir_snprintf(szBuff, _countof(szBuff), "PopupType%STimeout", lpcwszPopupsTypes[dwType]);
ppd.iSeconds = getDword(szBuff, MRA_DEFAULT_POPUP_TIMEOUT);
if (dat->iPopupType == MRA_POPUP_TYPE_EMAIL_STATUS && dat->ppro->hWndEMailPopupStatus)
diff --git a/protocols/MRA/src/MraProto.cpp b/protocols/MRA/src/MraProto.cpp
index bddac7dc98..94a41372e4 100644
--- a/protocols/MRA/src/MraProto.cpp
+++ b/protocols/MRA/src/MraProto.cpp
@@ -36,7 +36,7 @@ CMraProto::CMraProto(const char* _module, const TCHAR* _displayName) :
m_heNudgeReceived = CreateProtoEvent(PE_NUDGE);
TCHAR name[MAX_PATH];
- mir_sntprintf(name, SIZEOF(name), TranslateT("%s connection"), m_tszUserName);
+ mir_sntprintf(name, _countof(name), TranslateT("%s connection"), m_tszUserName);
NETLIBUSER nlu = { sizeof(nlu) };
nlu.flags = NUF_INCOMING | NUF_OUTGOING | NUF_HTTPCONNS | NUF_TCHAR;
@@ -46,7 +46,7 @@ CMraProto::CMraProto(const char* _module, const TCHAR* _displayName) :
InitMenus();
- mir_snprintf(szNewMailSound, SIZEOF(szNewMailSound), "%s_new_email", m_szModuleName);
+ mir_snprintf(szNewMailSound, _countof(szNewMailSound), "%s_new_email", m_szModuleName);
SkinAddNewSoundEx(szNewMailSound, m_szModuleName, MRA_SOUND_NEW_EMAIL);
HookProtoEvent(ME_CLIST_PREBUILDSTATUSMENU, &CMraProto::MraRebuildStatusMenu);
@@ -525,11 +525,11 @@ HANDLE CMraProto::GetAwayMsg(MCONTACT hContact)
SYSTEMTIME tt = { 0 };
dwTime = getDword(hContact, DBSETTING_BLOGSTATUSTIME, 0);
if (dwTime && MakeLocalSystemTimeFromTime32(dwTime, &tt))
- mir_sntprintf(szTime, SIZEOF(szTime), _T("%04ld.%02ld.%02ld %02ld:%02ld: "), tt.wYear, tt.wMonth, tt.wDay, tt.wHour, tt.wMinute);
+ mir_sntprintf(szTime, _countof(szTime), _T("%04ld.%02ld.%02ld %02ld:%02ld: "), tt.wYear, tt.wMonth, tt.wDay, tt.wHour, tt.wMinute);
else
szTime[0] = 0;
- mir_sntprintf(szStatusDesc, SIZEOF(szStatusDesc), _T("%s%s"), szTime, szBlogStatus.c_str());
+ mir_sntprintf(szStatusDesc, _countof(szStatusDesc), _T("%s%s"), szTime, szBlogStatus.c_str());
iRet = GetTickCount();
ProtoBroadcastAck(hContact, ACKTYPE_AWAYMSG, ACKRESULT_SUCCESS, (HANDLE)iRet, (LPARAM)szStatusDesc);
}
diff --git a/protocols/MRA/src/MraSelectEMail.cpp b/protocols/MRA/src/MraSelectEMail.cpp
index ad8b4f11a8..f956bddbec 100644
--- a/protocols/MRA/src/MraSelectEMail.cpp
+++ b/protocols/MRA/src/MraSelectEMail.cpp
@@ -14,7 +14,7 @@ void AddContactEMailToListParam(MCONTACT hContact, BOOL bMRAOnly, LPSTR lpszModu
if (DB_GetStringA(hContact, lpszModule, lpszValueName, szEmail)) {
if (bMRAOnly == FALSE || IsEMailMR(szEmail)) {
WCHAR wszBuff[MAX_EMAIL_LEN];
- MultiByteToWideChar(MRA_CODE_PAGE, 0, szEmail, -1, wszBuff, SIZEOF(wszBuff));
+ MultiByteToWideChar(MRA_CODE_PAGE, 0, szEmail, -1, wszBuff, _countof(wszBuff));
if (SendMessage(hWndList, LB_FINDSTRING, -1, (LPARAM)wszBuff) == LB_ERR)
SendMessage(hWndList, LB_ADDSTRING, 0, (LPARAM)wszBuff);
}
@@ -22,11 +22,11 @@ void AddContactEMailToListParam(MCONTACT hContact, BOOL bMRAOnly, LPSTR lpszModu
for (int i = 0; true; i++) {
char szBuff[MAX_PATH];
- mir_snprintf(szBuff, SIZEOF(szBuff), "%s%lu", lpszValueName, i);
+ mir_snprintf(szBuff, _countof(szBuff), "%s%lu", lpszValueName, i);
if (DB_GetStringA(hContact, lpszModule, szBuff, szEmail)) {
if (bMRAOnly == FALSE || IsEMailMR(szEmail)) {
WCHAR wszBuff[MAX_EMAIL_LEN];
- MultiByteToWideChar(MRA_CODE_PAGE, 0, szEmail, -1, wszBuff, SIZEOF(wszBuff));
+ MultiByteToWideChar(MRA_CODE_PAGE, 0, szEmail, -1, wszBuff, _countof(wszBuff));
if (SendMessage(hWndList, LB_FINDSTRING, -1, (LPARAM)wszBuff) == LB_ERR)
SendMessage(hWndList, LB_ADDSTRING, 0, (LPARAM)wszBuff);
}
diff --git a/protocols/MRA/src/Mra_functions.cpp b/protocols/MRA/src/Mra_functions.cpp
index 8197824146..2425c27ccc 100644
--- a/protocols/MRA/src/Mra_functions.cpp
+++ b/protocols/MRA/src/Mra_functions.cpp
@@ -423,7 +423,7 @@ DWORD CMraProto::GetContactBasicInfoW(MCONTACT hContact, DWORD *pdwID, DWORD *pd
for (int i = 0; i < 3; i++) {
char szValue[50];
- mir_snprintf(szValue, SIZEOF(szValue), "MyPhone%d", i);
+ mir_snprintf(szValue, _countof(szValue), "MyPhone%d", i);
if (DB_GetStringA(hContact, "UserInfo", szValue, szPhone)) {
if (szPhones->GetLength())
szPhones->AppendChar(',');
@@ -474,7 +474,7 @@ DWORD CMraProto::SetContactBasicInfoW(MCONTACT hContact, DWORD dwSetInfoFlags, D
break;
char szValue[MAX_PATH];
- mir_snprintf(szValue, SIZEOF(szValue), "MyPhone%d", i++);
+ mir_snprintf(szValue, _countof(szValue), "MyPhone%d", i++);
DB_SetStringExA(hContact, "UserInfo", szValue, "+" + szPhone);
}
}
@@ -644,14 +644,14 @@ void CMraProto::MraUpdateEmailStatus(const CMStringA &pszFrom, const CMStringA &
MCONTACT hContact = NULL;
TCHAR szMailBoxStatus[MAX_SECONDLINE];
- mir_sntprintf(szMailBoxStatus, SIZEOF(szMailBoxStatus), TranslateT("Unread mail is available: %lu/%lu messages"), m_dwEmailMessagesUnread, dwEmailMessagesTotal);
+ mir_sntprintf(szMailBoxStatus, _countof(szMailBoxStatus), TranslateT("Unread mail is available: %lu/%lu messages"), m_dwEmailMessagesUnread, dwEmailMessagesTotal);
if (!pszFrom.IsEmpty() || !pszSubject.IsEmpty()) {
CMStringA szFrom, szSubject;
if (GetEMailFromString(szFrom, szEmail))
hContact = MraHContactFromEmail(szEmail, FALSE, TRUE, NULL);
- mir_sntprintf(szStatusText, SIZEOF(szStatusText), TranslateT("From: %S\r\nSubject: %S\r\n%s"), pszFrom.c_str(), szSubject.c_str(), szMailBoxStatus);
+ mir_sntprintf(szStatusText, _countof(szStatusText), TranslateT("From: %S\r\nSubject: %S\r\n%s"), pszFrom.c_str(), szSubject.c_str(), szMailBoxStatus);
}
else _tcsncpy_s(szStatusText, szMailBoxStatus, _TRUNCATE);
@@ -692,7 +692,7 @@ void CMraProto::MraUpdateEmailStatus(const CMStringA &pszFrom, const CMStringA &
hWndEMailPopupStatus = NULL;
}
else {
- mir_sntprintf(szStatusText, SIZEOF(szStatusText), TranslateT("No unread mail is available\r\nTotal messages: %lu"), dwEmailMessagesTotal);
+ mir_sntprintf(szStatusText, _countof(szStatusText), TranslateT("No unread mail is available\r\nTotal messages: %lu"), dwEmailMessagesTotal);
MraPopupShowFromAgentW(MRA_POPUP_TYPE_EMAIL_STATUS, (MRA_POPUP_ALLOW_ENTER), szStatusText);
}
}
@@ -802,7 +802,7 @@ DWORD GetContactEMailCountParam(MCONTACT hContact, BOOL bMRAOnly, LPSTR lpszModu
for (int i = 0; TRUE; i++) {
char szBuff[100];
- mir_snprintf(szBuff, SIZEOF(szBuff), "%s%lu", lpszValueName, i);
+ mir_snprintf(szBuff, _countof(szBuff), "%s%lu", lpszValueName, i);
if (DB_GetStringA(hContact, lpszModule, szBuff, szEmail)) {
if (bMRAOnly == FALSE || IsEMailMR(szEmail))
dwRet++;
@@ -840,7 +840,7 @@ bool GetContactFirstEMailParam(MCONTACT hContact, BOOL bMRAOnly, LPSTR lpszModul
for (int i = 0; true; i++) {
char szBuff[100];
- mir_snprintf(szBuff, SIZEOF(szBuff), "%s%lu", lpszValueName, i);
+ mir_snprintf(szBuff, _countof(szBuff), "%s%lu", lpszValueName, i);
if (DB_GetStringA(hContact, lpszModule, szBuff, szEmail)) {
if (bMRAOnly == FALSE || IsEMailMR(szEmail)) {
res = szEmail;
@@ -875,9 +875,9 @@ void CMraProto::ShowFormattedErrorMessage(LPWSTR lpwszErrText, DWORD dwErrorCode
if (dwErrorCode == NO_ERROR)
_tcsncpy_s(szErrorText, TranslateTS(lpwszErrText), _TRUNCATE);
else {
- dwErrDescriptionSize = (FormatMessage(FORMAT_MESSAGE_FROM_SYSTEM, NULL, dwErrorCode, 0, szErrDescription, (SIZEOF(szErrDescription) - sizeof(WCHAR)), NULL) - 2);
+ dwErrDescriptionSize = (FormatMessage(FORMAT_MESSAGE_FROM_SYSTEM, NULL, dwErrorCode, 0, szErrDescription, (_countof(szErrDescription) - sizeof(WCHAR)), NULL) - 2);
szErrDescription[dwErrDescriptionSize] = 0;
- mir_sntprintf(szErrorText, SIZEOF(szErrorText), _T("%s %lu: %s"), TranslateTS(lpwszErrText), dwErrorCode, szErrDescription);
+ mir_sntprintf(szErrorText, _countof(szErrorText), _T("%s %lu: %s"), TranslateTS(lpwszErrText), dwErrorCode, szErrDescription);
}
MraPopupShowFromAgentW(MRA_POPUP_TYPE_ERROR, 0, szErrorText);
}
@@ -996,13 +996,13 @@ INT_PTR CALLBACK SetXStatusDlgProc(HWND hWndDlg, UINT message, WPARAM wParam, LP
SendMessage(hWndDlg, WM_SETICON, ICON_BIG, (LPARAM)dat->hDlgIcon);
SetWindowText(hWndDlg, TranslateTS(lpcszXStatusNameDef[dat->dwXStatus]));
- mir_snprintf(szValueName, SIZEOF(szValueName), "XStatus%ldName", dat->dwXStatus);
+ mir_snprintf(szValueName, _countof(szValueName), "XStatus%ldName", dat->dwXStatus);
if (dat->ppro->mraGetStringW(NULL, szValueName, szBuff))
SetDlgItemText(hWndDlg, IDC_XTITLE, szBuff.c_str()); // custom xstatus name
else // default xstatus name
SetDlgItemText(hWndDlg, IDC_XTITLE, TranslateTS(lpcszXStatusNameDef[dat->dwXStatus]));
- mir_snprintf(szValueName, SIZEOF(szValueName), "XStatus%ldMsg", dat->dwXStatus);
+ mir_snprintf(szValueName, _countof(szValueName), "XStatus%ldMsg", dat->dwXStatus);
if (dat->ppro->mraGetStringW(NULL, szValueName, szBuff))
SetDlgItemText(hWndDlg, IDC_XMSG, szBuff.c_str()); // custom xstatus description
else // default xstatus description
@@ -1017,7 +1017,7 @@ INT_PTR CALLBACK SetXStatusDlgProc(HWND hWndDlg, UINT message, WPARAM wParam, LP
case WM_TIMER:
if (dat->dwCountdown != -1) {
TCHAR szBuff[MAX_PATH];
- mir_sntprintf(szBuff, SIZEOF(szBuff), TranslateT("Closing in %ld"), dat->dwCountdown--);
+ mir_sntprintf(szBuff, _countof(szBuff), TranslateT("Closing in %ld"), dat->dwCountdown--);
SetDlgItemText(hWndDlg, IDOK, szBuff);
break;
}
@@ -1047,7 +1047,7 @@ INT_PTR CALLBACK SetXStatusDlgProc(HWND hWndDlg, UINT message, WPARAM wParam, LP
DWORD dwBuffSize = GetDlgItemText(hWndDlg, IDC_XMSG, szBuff, (STATUS_DESC_MAX + 1));
char szValueName[MAX_PATH];
- mir_snprintf(szValueName, SIZEOF(szValueName), "XStatus%ldMsg", dat->dwXStatus);
+ mir_snprintf(szValueName, _countof(szValueName), "XStatus%ldMsg", dat->dwXStatus);
dat->ppro->mraSetStringExW(NULL, szValueName, szBuff);
dat->ppro->mraSetStringExW(NULL, DBSETTING_XSTATUSMSG, szBuff);
@@ -1056,7 +1056,7 @@ INT_PTR CALLBACK SetXStatusDlgProc(HWND hWndDlg, UINT message, WPARAM wParam, LP
mir_tstrncpy(szBuff, TranslateTS(lpcszXStatusNameDef[dat->dwXStatus]), STATUS_TITLE_MAX + 1);
dwBuffSize = (DWORD)mir_wstrlen(szBuff);
}
- mir_snprintf(szValueName, SIZEOF(szValueName), "XStatus%dName", dat->dwXStatus);
+ mir_snprintf(szValueName, _countof(szValueName), "XStatus%dName", dat->dwXStatus);
dat->ppro->mraSetStringExW(NULL, szValueName, szBuff);
dat->ppro->mraSetStringExW(NULL, DBSETTING_XSTATUSNAME, szBuff);
@@ -1147,7 +1147,7 @@ INT_PTR CALLBACK SendReplyBlogStatusDlgProc(HWND hWndDlg, UINT message, WPARAM w
DWORDLONG dwBlogStatusID;
TCHAR szBuff[MICBLOG_STATUS_MAX];
- GetDlgItemText(hWndDlg, IDC_MSG_TO_SEND, szBuff, SIZEOF(szBuff));
+ GetDlgItemText(hWndDlg, IDC_MSG_TO_SEND, szBuff, _countof(szBuff));
if (dat->hContact) {
dwFlags = (MRIM_BLOG_STATUS_REPLY | MRIM_BLOG_STATUS_NOTIFY);
@@ -1176,7 +1176,7 @@ INT_PTR CALLBACK SendReplyBlogStatusDlgProc(HWND hWndDlg, UINT message, WPARAM w
size_t dwMessageSize = GetWindowTextLength(GetDlgItem(hWndDlg, IDC_MSG_TO_SEND));
EnableWindow(GetDlgItem(hWndDlg, IDOK), (int)dwMessageSize);
- mir_sntprintf(tszBuff, SIZEOF(tszBuff), _T("%d/%d"), dwMessageSize, MICBLOG_STATUS_MAX);
+ mir_sntprintf(tszBuff, _countof(tszBuff), _T("%d/%d"), dwMessageSize, MICBLOG_STATUS_MAX);
SetDlgItemText(hWndDlg, IDC_STATIC_CHARS_COUNTER, tszBuff);
}
break;
@@ -1442,7 +1442,7 @@ static const size_t dwXMLSymbolsCount[] = { sizeof(TCHAR), sizeof(TCHAR), sizeof
CMStringW DecodeXML(const CMStringW &lptszMessage)
{
CMStringW ret('\0', (lptszMessage.GetLength() * 4));
- ReplaceInBuff((void*)lptszMessage.GetString(), lptszMessage.GetLength()*sizeof(TCHAR), SIZEOF(lpszXMLTags), (LPVOID*)lpszXMLTags, (size_t*)dwXMLTagsCount, (LPVOID*)lpszXMLSymbols, (size_t*)dwXMLSymbolsCount, ret);
+ ReplaceInBuff((void*)lptszMessage.GetString(), lptszMessage.GetLength()*sizeof(TCHAR), _countof(lpszXMLTags), (LPVOID*)lpszXMLTags, (size_t*)dwXMLTagsCount, (LPVOID*)lpszXMLSymbols, (size_t*)dwXMLSymbolsCount, ret);
return ret;
}
@@ -1450,6 +1450,6 @@ CMStringW DecodeXML(const CMStringW &lptszMessage)
CMStringW EncodeXML(const CMStringW &lptszMessage)
{
CMStringW ret('\0', (lptszMessage.GetLength() * 4));
- ReplaceInBuff((void*)lptszMessage.GetString(), lptszMessage.GetLength()*sizeof(TCHAR), SIZEOF(lpszXMLTags), (LPVOID*)lpszXMLSymbols, (size_t*)dwXMLSymbolsCount, (LPVOID*)lpszXMLTags, (size_t*)dwXMLTagsCount, ret);
+ ReplaceInBuff((void*)lptszMessage.GetString(), lptszMessage.GetLength()*sizeof(TCHAR), _countof(lpszXMLTags), (LPVOID*)lpszXMLSymbols, (size_t*)dwXMLSymbolsCount, (LPVOID*)lpszXMLTags, (size_t*)dwXMLTagsCount, ret);
return ret;
}
diff --git a/protocols/MRA/src/Mra_menus.cpp b/protocols/MRA/src/Mra_menus.cpp
index 6f349e9d0d..ec0ee058dd 100644
--- a/protocols/MRA/src/Mra_menus.cpp
+++ b/protocols/MRA/src/Mra_menus.cpp
@@ -282,7 +282,7 @@ int CMraProto::MraRebuildStatusMenu(WPARAM, LPARAM)
pszServiceFunctionName = szServiceFunction + mir_strlen(m_szModuleName);
TCHAR szItem[MAX_PATH + 64];
- mir_sntprintf(szItem, SIZEOF(szItem), _T("%s Custom Status"), m_tszUserName);
+ mir_sntprintf(szItem, _countof(szItem), _T("%s Custom Status"), m_tszUserName);
CLISTMENUITEM mi = { sizeof(mi) };
mi.position = 2000060000;
@@ -301,7 +301,7 @@ int CMraProto::MraRebuildStatusMenu(WPARAM, LPARAM)
mir_snprintf(pszServiceFunctionName, 100, "/menuXStatus%ld", i);
mi.position ++;
if (i) {
- mir_snprintf(szValueName, SIZEOF(szValueName), "XStatus%ldName", i);
+ mir_snprintf(szValueName, _countof(szValueName), "XStatus%ldName", i);
if (mraGetStringW(NULL, szValueName, szStatusTitle))
mi.ptszName = (TCHAR*)szStatusTitle.c_str();
else
@@ -400,7 +400,7 @@ void CMraProto::InitMenus()
// xstatus menu
for (DWORD i = 0; i < MRA_XSTATUS_COUNT; i++) {
char szServiceName[100];
- mir_snprintf(szServiceName, SIZEOF(szServiceName), "/menuXStatus%d", i);
+ mir_snprintf(szServiceName, _countof(szServiceName), "/menuXStatus%d", i);
CreateProtoServiceParam(szServiceName, &CMraProto::MraXStatusMenu, i);
}
}
diff --git a/protocols/MRA/src/Mra_options.cpp b/protocols/MRA/src/Mra_options.cpp
index 4bf263fb2c..b833a7cd22 100644
--- a/protocols/MRA/src/Mra_options.cpp
+++ b/protocols/MRA/src/Mra_options.cpp
@@ -37,10 +37,10 @@ INT_PTR CALLBACK DlgProcOptsAccount(HWND hWndDlg, UINT msg, WPARAM wParam, LPARA
switch (((LPNMHDR)lParam)->code) {
case PSN_APPLY:
TCHAR szBuff[MAX_EMAIL_LEN];
- GetDlgItemText(hWndDlg, IDC_LOGIN, szBuff, SIZEOF(szBuff));
+ GetDlgItemText(hWndDlg, IDC_LOGIN, szBuff, _countof(szBuff));
ppro->setTString(NULL, "e-mail", szBuff);
- if (GetDlgItemText(hWndDlg, IDC_PASSWORD, szBuff, SIZEOF(szBuff))) {
+ if (GetDlgItemText(hWndDlg, IDC_PASSWORD, szBuff, _countof(szBuff))) {
ppro->setTString("Password", szBuff);
SecureZeroMemory(szBuff, sizeof(szBuff));
}
@@ -87,10 +87,10 @@ INT_PTR CALLBACK DlgProcAccount(HWND hWndDlg, UINT msg, WPARAM wParam, LPARAM lP
switch (((LPNMHDR)lParam)->code) {
case PSN_APPLY:
TCHAR szBuff[MAX_EMAIL_LEN];
- GetDlgItemText(hWndDlg, IDC_LOGIN, szBuff, SIZEOF(szBuff));
+ GetDlgItemText(hWndDlg, IDC_LOGIN, szBuff, _countof(szBuff));
ppro->mraSetStringW(NULL, "e-mail", szBuff);
- if (GetDlgItemText(hWndDlg, IDC_PASSWORD, szBuff, SIZEOF(szBuff))) {
+ if (GetDlgItemText(hWndDlg, IDC_PASSWORD, szBuff, _countof(szBuff))) {
ppro->setTString("Password", szBuff);
SecureZeroMemory(szBuff, sizeof(szBuff));
}
@@ -186,7 +186,7 @@ INT_PTR CALLBACK DlgProcOptsConnections(HWND hWndDlg, UINT msg, WPARAM wParam, L
switch (((LPNMHDR)lParam)->code) {
case PSN_APPLY:
TCHAR szBuff[MAX_PATH];
- GetDlgItemText(hWndDlg, IDC_SERVER, szBuff, SIZEOF(szBuff));
+ GetDlgItemText(hWndDlg, IDC_SERVER, szBuff, _countof(szBuff));
ppro->mraSetStringW(NULL, "Server", szBuff);
ppro->setWord("ServerPort", (WORD)GetDlgItemInt(hWndDlg, IDC_SERVERPORT, NULL, FALSE));
ppro->setByte("AutoAddContactsToServer", IsDlgButtonChecked(hWndDlg, IDC_AUTO_ADD_CONTACTS_TO_SERVER));
diff --git a/protocols/MRA/src/Mra_proto.cpp b/protocols/MRA/src/Mra_proto.cpp
index f1060c459e..3279852f6a 100644
--- a/protocols/MRA/src/Mra_proto.cpp
+++ b/protocols/MRA/src/Mra_proto.cpp
@@ -156,7 +156,7 @@ DWORD CMraProto::MraGetNLBData(CMStringA &szHost, WORD *pwPort)
bContinue = FALSE;
break;
case 1:
- dwBytesReceived = Netlib_Recv(nls.hReadConns[0], (LPSTR)(btBuff + dwRcvBuffSizeUsed), (int)(SIZEOF(btBuff) - dwRcvBuffSizeUsed), 0);
+ dwBytesReceived = Netlib_Recv(nls.hReadConns[0], (LPSTR)(btBuff + dwRcvBuffSizeUsed), (int)(_countof(btBuff) - dwRcvBuffSizeUsed), 0);
if (dwBytesReceived && dwBytesReceived != SOCKET_ERROR)
dwRcvBuffSizeUsed += dwBytesReceived;
else
@@ -349,11 +349,11 @@ bool CMraProto::CmdHelloAck(BinBuffer &buf)
DWORD dwXStatusMir = m_iXStatus, dwXStatus;
DWORD dwStatus = GetMraStatusFromMiradaStatus(m_iDesiredStatus, dwXStatusMir, &dwXStatus);
if (IsXStatusValid(dwXStatusMir)) {// xstatuses
- mir_snprintf(szValueName, SIZEOF(szValueName), "XStatus%ldName", dwXStatusMir);
+ mir_snprintf(szValueName, _countof(szValueName), "XStatus%ldName", dwXStatusMir);
if (!mraGetStringW(NULL, szValueName, wszStatusTitle))
wszStatusTitle = TranslateTS(lpcszXStatusNameDef[dwXStatusMir]);
- mir_snprintf(szValueName, SIZEOF(szValueName), "XStatus%ldMsg", dwXStatusMir);
+ mir_snprintf(szValueName, _countof(szValueName), "XStatus%ldMsg", dwXStatusMir);
mraGetStringW(NULL, szValueName, wszStatusDesc);
}
else wszStatusTitle = pcli->pfnGetStatusModeDescription(m_iDesiredStatus, 0);
@@ -646,7 +646,7 @@ bool CMraProto::CmdFileTransferAck(BinBuffer &buf)
break;
default:// ## unknown error
TCHAR szBuff[1024];
- mir_sntprintf(szBuff, SIZEOF(szBuff), TranslateT("MRIM_CS_FILE_TRANSFER_ACK: unknown error, code: %lu"), dwAckType);
+ mir_sntprintf(szBuff, _countof(szBuff), TranslateT("MRIM_CS_FILE_TRANSFER_ACK: unknown error, code: %lu"), dwAckType);
ShowFormattedErrorMessage(szBuff, NO_ERROR);
break;
}
@@ -743,7 +743,7 @@ bool CMraProto::CmdContactAck(int cmd, int seq, BinBuffer &buf)
break;
default:// ## unknown error
TCHAR szBuff[1024];
- mir_sntprintf(szBuff, SIZEOF(szBuff), TranslateT("MRIM_CS_*_CONTACT_ACK: unknown server error, code: %lu"), dwTemp);
+ mir_sntprintf(szBuff, _countof(szBuff), TranslateT("MRIM_CS_*_CONTACT_ACK: unknown server error, code: %lu"), dwTemp);
MraPopupShowFromAgentW(MRA_POPUP_TYPE_DEBUG, 0, szBuff);
break;
}
@@ -1037,7 +1037,7 @@ bool CMraProto::CmdGame(BinBuffer &buf)
break;
default:
TCHAR szBuff[1024];
- mir_sntprintf(szBuff, SIZEOF(szBuff), TranslateT("MRIM_CS_GAME: unknown internal game message code: %lu"), dwGameMsg);
+ mir_sntprintf(szBuff, _countof(szBuff), TranslateT("MRIM_CS_GAME: unknown internal game message code: %lu"), dwGameMsg);
MraPopupShowFromAgentW(MRA_POPUP_TYPE_DEBUG, 0, szBuff);
break;
}
@@ -1205,7 +1205,7 @@ bool CMraProto::CmdClist2(BinBuffer &buf)
}
else if (fieldType == 'u') {
char szBuff[50];
- mir_snprintf(szBuff, SIZEOF(szBuff), "%lu, ", dwTemp);//;
+ mir_snprintf(szBuff, _countof(szBuff), "%lu, ", dwTemp);//;
debugLogA("%s ", szBuff);
}
else _CrtDbgBreak();
@@ -1345,7 +1345,7 @@ bool CMraProto::CmdClist2(BinBuffer &buf)
ShowFormattedErrorMessage(L"MRIM_CS_CONTACT_LIST2: internal server error", NO_ERROR);
else {
TCHAR szBuff[1024];
- mir_sntprintf(szBuff, SIZEOF(szBuff), TranslateT("MRIM_CS_CONTACT_LIST2: unknown server error, code: %lu"), dwTemp);
+ mir_sntprintf(szBuff, _countof(szBuff), TranslateT("MRIM_CS_CONTACT_LIST2: unknown server error, code: %lu"), dwTemp);
MraPopupShowFromAgentW(MRA_POPUP_TYPE_DEBUG, 0, szBuff);
}
}
diff --git a/protocols/MRA/src/Mra_svcs.cpp b/protocols/MRA/src/Mra_svcs.cpp
index 4d27ea4e4e..44b6dde3ac 100644
--- a/protocols/MRA/src/Mra_svcs.cpp
+++ b/protocols/MRA/src/Mra_svcs.cpp
@@ -353,13 +353,13 @@ DWORD CMraProto::MraSetXStatusInternal(DWORD dwXStatus)
// obsolete (TODO: remove in next version)
char szValueName[MAX_PATH];
- mir_snprintf(szValueName, SIZEOF(szValueName), "XStatus%ldName", dwXStatus);
+ mir_snprintf(szValueName, _countof(szValueName), "XStatus%ldName", dwXStatus);
if (!mraGetStringW(NULL, szValueName, szBuff))
szBuff = lpcszXStatusNameDef[dwXStatus];
mraSetStringExW(NULL, DBSETTING_XSTATUSNAME, szBuff);
// obsolete (TODO: remove in next version)
- mir_snprintf(szValueName, SIZEOF(szValueName), "XStatus%ldMsg", dwXStatus);
+ mir_snprintf(szValueName, _countof(szValueName), "XStatus%ldMsg", dwXStatus);
if (mraGetStringW(NULL, szValueName, szBuff))
mraSetStringExW(NULL, DBSETTING_XSTATUSMSG, szBuff);
else
@@ -401,7 +401,7 @@ INT_PTR CMraProto::MraSetXStatusEx(WPARAM, LPARAM lParam)
// set custom status name
if (pData->flags & CSSF_MASK_NAME) {
- mir_snprintf(szValueName, SIZEOF(szValueName), "XStatus%ldName", dwXStatus);
+ mir_snprintf(szValueName, _countof(szValueName), "XStatus%ldName", dwXStatus);
if (pData->flags & CSSF_UNICODE) {
mraSetStringExW(NULL, szValueName, pData->pwszName);
mraSetStringExW(NULL, DBSETTING_XSTATUSNAME, pData->pwszName);
@@ -414,7 +414,7 @@ INT_PTR CMraProto::MraSetXStatusEx(WPARAM, LPARAM lParam)
// set custom status message
if (pData->flags & CSSF_MASK_MESSAGE) {
- mir_snprintf(szValueName, SIZEOF(szValueName), "XStatus%ldMsg", dwXStatus);
+ mir_snprintf(szValueName, _countof(szValueName), "XStatus%ldMsg", dwXStatus);
if (pData->flags & CSSF_UNICODE) {
mraSetStringExW(NULL, szValueName, pData->pwszMessage);
mraSetStringExW(NULL, DBSETTING_XSTATUSMSG, pData->pwszMessage);
@@ -528,7 +528,7 @@ DWORD CMraProto::MraSendNewStatus(DWORD dwStatusMir, DWORD dwXStatusMir, const C
if (IsXStatusValid(dwXStatusMir)) {
char szValueName[MAX_PATH];
if (pwszStatusTitle.IsEmpty()) {
- mir_snprintf(szValueName, SIZEOF(szValueName), "XStatus%ldName", dwXStatusMir);
+ mir_snprintf(szValueName, _countof(szValueName), "XStatus%ldName", dwXStatusMir);
// custom xstatus name
if (!mraGetStringW(NULL, szValueName, wszStatusTitle))
wszStatusTitle = TranslateTS(lpcszXStatusNameDef[dwXStatusMir]);
@@ -536,7 +536,7 @@ DWORD CMraProto::MraSendNewStatus(DWORD dwStatusMir, DWORD dwXStatusMir, const C
else wszStatusTitle = pwszStatusTitle;
if (pwszStatusDesc.IsEmpty()) {
- mir_snprintf(szValueName, SIZEOF(szValueName), "XStatus%ldMsg", dwXStatusMir);
+ mir_snprintf(szValueName, _countof(szValueName), "XStatus%ldMsg", dwXStatusMir);
// custom xstatus description
mraGetStringW(NULL, szValueName, wszStatusDesc);
}
diff --git a/protocols/MSN/src/msn_auth.cpp b/protocols/MSN/src/msn_auth.cpp
index c6c9209b89..c866135156 100644
--- a/protocols/MSN/src/msn_auth.cpp
+++ b/protocols/MSN/src/msn_auth.cpp
@@ -153,8 +153,8 @@ int CMsnProto::MSN_GetPassportAuth(void)
time_t ts = time(NULL);
TCHAR szTs1[64], szTs2[64];
- TimeZone_PrintTimeStamp(UTC_TIME_HANDLE, ts, _T("I"), szTs1, SIZEOF(szTs1), 0);
- TimeZone_PrintTimeStamp(UTC_TIME_HANDLE, ts + 20 * 60, _T("I"), szTs2, SIZEOF(szTs2), 0);
+ TimeZone_PrintTimeStamp(UTC_TIME_HANDLE, ts, _T("I"), szTs1, _countof(szTs1), 0);
+ TimeZone_PrintTimeStamp(UTC_TIME_HANDLE, ts + 20 * 60, _T("I"), szTs2, _countof(szTs2), 0);
CMStringA szAuthInfo(FORMAT, authPacket, int(ts), MyOptions.szEmail, ptrA(HtmlEncode(szPassword)), szTs1, szTs2);
@@ -266,7 +266,7 @@ int CMsnProto::MSN_GetPassportAuth(void)
}
else if (retVal != 3 && retVal != 7) {
char err[512];
- mir_snprintf(err, SIZEOF(err), "Unknown Authentication error: %s", szFault);
+ mir_snprintf(err, _countof(err), "Unknown Authentication error: %s", szFault);
MSN_ShowError(err);
}
}
@@ -954,7 +954,7 @@ const char *CMsnProto::GetSkypeToken(bool bAsAuthHeader)
nlhr.requestType = REQUEST_POST;
nlhr.flags = NLHRF_HTTP11 | NLHRF_DUMPASTEXT | NLHRF_PERSISTENT | NLHRF_REDIRECT;
nlhr.nlc = hHttpsConnection;
- nlhr.headersCount = SIZEOF(headers);
+ nlhr.headersCount = _countof(headers);
nlhr.headers = headers;
nlhr.headers[0].szName = "User-Agent";
nlhr.headers[0].szValue = (char*)MSN_USER_AGENT;
diff --git a/protocols/MSN/src/msn_avatar.cpp b/protocols/MSN/src/msn_avatar.cpp
index 3e268e3b5b..5c8d3985d2 100644
--- a/protocols/MSN/src/msn_avatar.cpp
+++ b/protocols/MSN/src/msn_avatar.cpp
@@ -79,7 +79,7 @@ LBL_Error:
PROTO_AVATAR_INFORMATION ai = { 0 };
ai.format = fmt;
ai.hContact = p->hContact;
- MSN_GetAvatarFileName(ai.hContact, ai.filename, SIZEOF(ai.filename), szExt);
+ MSN_GetAvatarFileName(ai.hContact, ai.filename, _countof(ai.filename), szExt);
_tremove(ai.filename);
int fileId = _topen(ai.filename, _O_CREAT | _O_TRUNC | _O_WRONLY | O_BINARY, _S_IREAD | _S_IWRITE);
diff --git a/protocols/MSN/src/msn_chat.cpp b/protocols/MSN/src/msn_chat.cpp
index 6920312d4f..e1aa017893 100644
--- a/protocols/MSN/src/msn_chat.cpp
+++ b/protocols/MSN/src/msn_chat.cpp
@@ -47,14 +47,14 @@ int CMsnProto::MSN_ChatInit(GCThreadData *info, const char *pszID, const char *p
{
char *szNet, *szEmail;
- _tcsncpy(info->mChatID, _A2T(pszID), SIZEOF(info->mChatID));
+ _tcsncpy(info->mChatID, _A2T(pszID), _countof(info->mChatID));
parseWLID(NEWSTR_ALLOCA(pszID), &szNet, &szEmail, NULL);
info->netId = atoi(szNet);
strncpy(info->szEmail, szEmail, sizeof(info->szEmail));
TCHAR szName[512];
InterlockedIncrement(&m_chatID);
- if (*pszTopic) _tcsncpy(szName, _A2T(pszTopic), SIZEOF(szName));
+ if (*pszTopic) _tcsncpy(szName, _A2T(pszTopic), _countof(szName));
else mir_sntprintf(szName, _T("%s %s%d"),
m_tszUserName, TranslateT("Chat #"), m_chatID);
@@ -67,7 +67,7 @@ int CMsnProto::MSN_ChatInit(GCThreadData *info, const char *pszID, const char *p
GCDEST gcd = { m_szModuleName, info->mChatID, GC_EVENT_ADDGROUP };
GCEVENT gce = { sizeof(gce), &gcd };
- for (int j = 0; j < SIZEOF(m_ptszRoles); j++) {
+ for (int j = 0; j < _countof(m_ptszRoles); j++) {
gce.ptszStatus = m_ptszRoles[j];
CallServiceSync(MS_GC_EVENT, 0, (LPARAM)&gce);
}
@@ -431,7 +431,7 @@ INT_PTR CALLBACK DlgInviteToChat(HWND hwndDlg, UINT msg, WPARAM wParam, LPARAM l
case IDC_ADDSCR:
if (param->ppro->msnLoggedIn) {
TCHAR email[MSN_MAX_EMAIL_LEN];
- GetDlgItemText(hwndDlg, IDC_EDITSCR, email, SIZEOF(email));
+ GetDlgItemText(hwndDlg, IDC_EDITSCR, email, _countof(email));
CLCINFOITEM cii = { 0 };
cii.cbSize = sizeof(cii);
@@ -620,7 +620,7 @@ int CMsnProto::MSN_GCMenuHook(WPARAM, LPARAM lParam)
{ LPGENT("&Invite user..."), 10, MENU_ITEM, FALSE },
{ LPGENT("&Leave chat session"), 20, MENU_ITEM, FALSE }
};
- gcmi->nItems = SIZEOF(Items);
+ gcmi->nItems = _countof(Items);
gcmi->Item = (gc_item*)Items;
}
else if (gcmi->Type == MENU_ON_NICKLIST) {
@@ -633,7 +633,7 @@ int CMsnProto::MSN_GCMenuHook(WPARAM, LPARAM lParam)
{ _T(""), 100, MENU_SEPARATOR, FALSE },
{ LPGENT("&Leave chat session"), 110, MENU_ITEM, FALSE }
};
- gcmi->nItems = SIZEOF(Items);
+ gcmi->nItems = _countof(Items);
gcmi->Item = (gc_item*)Items;
}
else {
@@ -653,7 +653,7 @@ int CMsnProto::MSN_GCMenuHook(WPARAM, LPARAM lParam)
if (pszRole && !mir_tstrcmpi(pszRole, _T("admin")))
Items[3].pszDesc = LPGENT("&Deop user");
}
- gcmi->nItems = SIZEOF(Items);
+ gcmi->nItems = _countof(Items);
gcmi->Item = (gc_item*)Items;
}
mir_free(email);
diff --git a/protocols/MSN/src/msn_commands.cpp b/protocols/MSN/src/msn_commands.cpp
index c65359a54a..9502935601 100644
--- a/protocols/MSN/src/msn_commands.cpp
+++ b/protocols/MSN/src/msn_commands.cpp
@@ -60,7 +60,7 @@ void CMsnProto::MSN_SetMirVer(MCONTACT hContact, DWORD dwValue, bool always)
else if (dwValue == 0x30000024)
szVersion = "Miranda IM 0.4.x (MSN v.0.4.x)";
else if (always || getByte(hContact, "StdMirVer", 0)) {
- unsigned wlmId = min(dwValue >> 28 & 0xff, SIZEOF(MirVerStr) - 1);
+ unsigned wlmId = min(dwValue >> 28 & 0xff, _countof(MirVerStr) - 1);
szVersion = MirVerStr[wlmId];
}
else
@@ -85,7 +85,7 @@ void CMsnProto::MSN_ReceiveMessage(ThreadData* info, char* cmdString, char* para
struct { char *typeId, *strMsgBytes; } datas;
};
- if (sttDivideWords(params, SIZEOF(tWords), tWords) < 2) {
+ if (sttDivideWords(params, _countof(tWords), tWords) < 2) {
debugLogA("Invalid %.3s command, ignoring", cmdString);
return;
}
@@ -439,7 +439,7 @@ void CMsnProto::MSN_ProcessURIObject(MCONTACT hContact, ezxml_t xmli)
nlhr.flags = NLHRF_GENERATEHOST | NLHRF_PERSISTENT | NLHRF_SMARTAUTHHEADER;
nlhr.szUrl = uri;
nlhr.headers = (NETLIBHTTPHEADER*)&nlbhHeaders;
- nlhr.headersCount = SIZEOF(nlbhHeaders);
+ nlhr.headersCount = _countof(nlbhHeaders);
nlhr.nlc = hHttpsConnection;
mHttpsTS = clock();
@@ -481,7 +481,7 @@ void CMsnProto::MSN_ProcessURIObject(MCONTACT hContact, ezxml_t xmli)
sprintf(ft->szInvcookie, "%s/content/imgpsh", uri);
TCHAR tComment[40];
- mir_sntprintf(tComment, SIZEOF(tComment), TranslateT("%I64u bytes"), ft->std.currentFileSize);
+ mir_sntprintf(tComment, _countof(tComment), TranslateT("%I64u bytes"), ft->std.currentFileSize);
PROTORECVFILET pre = { 0 };
pre.dwFlags = PRFF_TCHAR;
@@ -522,7 +522,7 @@ void CMsnProto::MSN_ProcessYFind(char* buf, size_t len)
const char* szCont = ezxml_attr(cont, "n");
char szEmail[128];
- mir_snprintf(szEmail, SIZEOF(szEmail), "%s@%s", szCont, szDom);
+ mir_snprintf(szEmail, _countof(szEmail), "%s@%s", szCont, szDom);
const char *szNetId = ezxml_attr(cont, "t");
if (msnSearchId != NULL) {
@@ -721,7 +721,7 @@ void CMsnProto::MSN_ProcessStatusMessage(ezxml_t xmli, const char* wlid)
unsigned pCount;
char* p = (char*)szCrntMda;
- for (pCount = 0; pCount < SIZEOF(parts); ++pCount) {
+ for (pCount = 0; pCount < _countof(parts); ++pCount) {
parts[pCount] = p;
char* p1 = strstr(p, "\\0");
@@ -762,7 +762,7 @@ void CMsnProto::MSN_ProcessStatusMessage(ezxml_t xmli, const char* wlid)
for (unsigned i = 4; i < pCount; i++) {
char part[16];
- size_t lenPart = mir_snprintf(part, SIZEOF(part), "{%d}", i - 4);
+ size_t lenPart = mir_snprintf(part, _countof(part), "{%d}", i - 4);
if (parts[i][0] == '\0' && unknown != NULL)
parts[i] = unknown;
size_t lenPartsI = mir_strlen(parts[i]);
@@ -837,13 +837,13 @@ void CMsnProto::MSN_ProcessNotificationMessage(char* buf, size_t len)
const char* acturl = ezxml_attr(xmlact, "url");
if (acturl == NULL || strstr(acturl, "://") == NULL)
- sz += mir_snprintf((fullurl + sz), (SIZEOF(fullurl) - sz), "%s", ezxml_attr(xmlnot, "siteurl"));
+ sz += mir_snprintf((fullurl + sz), (_countof(fullurl) - sz), "%s", ezxml_attr(xmlnot, "siteurl"));
- sz += mir_snprintf((fullurl + sz), (SIZEOF(fullurl) - sz), "%s", acturl);
+ sz += mir_snprintf((fullurl + sz), (_countof(fullurl) - sz), "%s", acturl);
if (sz != 0 && fullurl[sz - 1] != '?')
- sz += mir_snprintf((fullurl + sz), (SIZEOF(fullurl) - sz), "?");
+ sz += mir_snprintf((fullurl + sz), (_countof(fullurl) - sz), "?");
- mir_snprintf((fullurl + sz), (SIZEOF(fullurl) - sz), "notification_id=%s&message_id=%s",
+ mir_snprintf((fullurl + sz), (_countof(fullurl) - sz), "notification_id=%s&message_id=%s",
ezxml_attr(xmlnot, "id"), ezxml_attr(xmlmsg, "id"));
SkinPlaySound(alertsoundname);
@@ -896,7 +896,7 @@ int CMsnProto::MSN_HandleCommands(ThreadData* info, char* cmdString)
struct { char *typeId, *strMsgBytes; } data;
};
- if (sttDivideWords(params, SIZEOF(tWords), tWords) < 2) {
+ if (sttDivideWords(params, _countof(tWords), tWords) < 2) {
LBL_InvalidCommand:
debugLogA("Invalid %.3s command, ignoring", cmdString);
break;
@@ -935,7 +935,7 @@ LBL_InvalidCommand:
struct { char *typeId, *strMsgBytes; } data;
};
- if (sttDivideWords(params, SIZEOF(tWords), tWords) < 2)
+ if (sttDivideWords(params, _countof(tWords), tWords) < 2)
goto LBL_InvalidCommand;
MimeHeaders tHeader;
@@ -966,7 +966,7 @@ LBL_InvalidCommand:
struct { char *typeId, *strMsgBytes; } data;
};
- if (sttDivideWords(params, SIZEOF(tWords), tWords) < 2)
+ if (sttDivideWords(params, _countof(tWords), tWords) < 2)
goto LBL_InvalidCommand;
HReadBuffer buf(info, 0);
@@ -1034,7 +1034,7 @@ LBL_InvalidCommand:
struct { char *typeId, *strMsgBytes; } data;
};
- if (sttDivideWords(params, SIZEOF(tWords), tWords) < 2)
+ if (sttDivideWords(params, _countof(tWords), tWords) < 2)
goto LBL_InvalidCommand;
MimeHeaders tHeader;
@@ -1198,7 +1198,7 @@ LBL_InvalidCommand:
struct { char *typeId, *strMsgBytes; } data;
};
- if (sttDivideWords(params, SIZEOF(tWords), tWords) < 2)
+ if (sttDivideWords(params, _countof(tWords), tWords) < 2)
goto LBL_InvalidCommand;
HReadBuffer buf(info, 0);
@@ -1271,7 +1271,7 @@ LBL_InvalidCommand:
struct { char *typeId, *strMsgBytes; } data;
};
- if (sttDivideWords(params, SIZEOF(tWords), tWords) < 2)
+ if (sttDivideWords(params, _countof(tWords), tWords) < 2)
goto LBL_InvalidCommand;
MimeHeaders tHeader;
@@ -1322,7 +1322,7 @@ LBL_InvalidCommand:
struct { char *typeId, *strMsgBytes; } data;
};
- if (sttDivideWords(params, SIZEOF(tWords), tWords) < 2)
+ if (sttDivideWords(params, _countof(tWords), tWords) < 2)
goto LBL_InvalidCommand;
MimeHeaders tHeader;
@@ -1434,7 +1434,7 @@ void CMsnProto::MSN_InviteMessage(ThreadData* info, char* msgBody, char* email,
ft->p2p_dest = mir_strdup(email);
TCHAR tComment[40];
- mir_sntprintf(tComment, SIZEOF(tComment), TranslateT("%I64u bytes"), ft->std.currentFileSize);
+ mir_sntprintf(tComment, _countof(tComment), TranslateT("%I64u bytes"), ft->std.currentFileSize);
PROTORECVFILET pre = { 0 };
pre.dwFlags = PRFF_TCHAR;
@@ -1452,9 +1452,9 @@ void CMsnProto::MSN_InviteMessage(ThreadData* info, char* msgBody, char* email,
ThreadData* newThread = new ThreadData;
if (inet_addr(IPAddress) != MyConnection.extIP || !IPAddressInt)
- mir_snprintf(newThread->mServer, SIZEOF(newThread->mServer), "%s:%s", IPAddress, Port);
+ mir_snprintf(newThread->mServer, _countof(newThread->mServer), "%s:%s", IPAddress, Port);
else
- mir_snprintf(newThread->mServer, SIZEOF(newThread->mServer), "%s:%u", IPAddressInt, atol(PortXInt) ^ 0x3141);
+ mir_snprintf(newThread->mServer, _countof(newThread->mServer), "%s:%u", IPAddressInt, atol(PortXInt) ^ 0x3141);
newThread->mType = SERVER_FILETRANS;
@@ -1531,7 +1531,7 @@ void CMsnProto::MSN_InviteMessage(ThreadData* info, char* msgBody, char* email,
if (IPAddress != NULL && Port == NULL && SessionID != NULL && SessionProtocol == NULL) { // netmeeting receive 2
char ipaddr[256];
- mir_snprintf(ipaddr, SIZEOF(ipaddr), "callto://%s", IPAddress);
+ mir_snprintf(ipaddr, _countof(ipaddr), "callto://%s", IPAddress);
ShellExecuteA(NULL, "open", ipaddr, NULL, NULL, SW_SHOW);
}
}
@@ -1548,7 +1548,7 @@ void CMsnProto::MSN_ProcessRemove(char* buf, size_t len)
int listId = atol(ezxml_attr(cont, "l"));
char szEmail[128];
- mir_snprintf(szEmail, SIZEOF(szEmail), "%s@%s", szCont, szDom);
+ mir_snprintf(szEmail, _countof(szEmail), "%s@%s", szCont, szDom);
Lists_Remove(listId, szEmail);
MsnContact* msc = Lists_Get(szEmail);
@@ -1609,7 +1609,7 @@ void CMsnProto::MSN_CustomSmiley(const char* msgBody, char* email, char* nick, i
ptrA smileyName(mir_urlEncode(buf));
TCHAR path[MAX_PATH];
- MSN_GetCustomSmileyFileName(hContact, path, SIZEOF(path), smileyName, iSmileyType);
+ MSN_GetCustomSmileyFileName(hContact, path, _countof(path), smileyName, iSmileyType);
ft->std.tszCurrentFile = mir_tstrdup(path);
if (p2p_IsDlFileOk(ft))
@@ -1644,7 +1644,7 @@ void CMsnProto::MSN_ProcessAdd(char* buf, size_t len)
int netId = atol(ezxml_attr(cont, "t"));
char szEmail[128];
- mir_snprintf(szEmail, SIZEOF(szEmail), "%s@%s", szCont, szDom);
+ mir_snprintf(szEmail, _countof(szEmail), "%s@%s", szCont, szDom);
UrlDecode((char*)szNick);
@@ -2206,7 +2206,7 @@ LBL_InvalidCommand:
newThread->mType = SERVER_SWITCHBOARD;
newThread->mInitialContactWLID = mir_strdup(data.callerEmail);
MSN_HContactFromEmail(data.callerEmail, data.callerNick, true, true);
- mir_snprintf(newThread->mCookie, SIZEOF(newThread->mCookie), "%s %d", data.authChallengeInfo, trid);
+ mir_snprintf(newThread->mCookie, _countof(newThread->mCookie), "%s %d", data.authChallengeInfo, trid);
ReleaseSemaphore(newThread->hWaitEvent, MSN_PACKETS_COMBINE, NULL);
@@ -2354,7 +2354,7 @@ LBL_InvalidCommand:
case ' XUU': // UUX: MSNP11 addition
{
char* tWords[1];
- if (sttDivideWords(params, SIZEOF(tWords), tWords) != SIZEOF(tWords))
+ if (sttDivideWords(params, _countof(tWords), tWords) != _countof(tWords))
goto LBL_InvalidCommand;
int len = atol(tWords[0]);
diff --git a/protocols/MSN/src/msn_errors.cpp b/protocols/MSN/src/msn_errors.cpp
index f67293eb2d..64a79fb45a 100644
--- a/protocols/MSN/src/msn_errors.cpp
+++ b/protocols/MSN/src/msn_errors.cpp
@@ -52,7 +52,7 @@ int CMsnProto::MSN_HandleErrors(ThreadData* info, char* cmdString)
struct { char *typeId, *strMsgBytes; } data;
};
- if (sttDivideWords(params, SIZEOF(tWords), tWords) < 2) {
+ if (sttDivideWords(params, _countof(tWords), tWords) < 2) {
debugLogA("Invalid %.3s command, ignoring", cmdString);
return 0;
}
@@ -90,7 +90,7 @@ int CMsnProto::MSN_HandleErrors(ThreadData* info, char* cmdString)
case ERR_DETAILED_ERR_IN_PAYLOAD:
case ERR_LIST_UNAVAILABLE:
char* tWords[4];
- if (sttDivideWords(cmdString, SIZEOF(tWords), tWords) == SIZEOF(tWords))
+ if (sttDivideWords(cmdString, _countof(tWords), tWords) == _countof(tWords))
HReadBuffer(info, 0).surelyRead(atol(tWords[3]));
return 0;
diff --git a/protocols/MSN/src/msn_ftold.cpp b/protocols/MSN/src/msn_ftold.cpp
index c5f6c3025b..94e257fade 100644
--- a/protocols/MSN/src/msn_ftold.cpp
+++ b/protocols/MSN/src/msn_ftold.cpp
@@ -64,7 +64,7 @@ void CMsnProto::msnftp_invite(filetransfer *ft)
pszFiles = *ft->std.ptszFiles;
char msg[1024];
- mir_snprintf(msg, SIZEOF(msg),
+ mir_snprintf(msg, _countof(msg),
"Content-Type: text/x-msmsgsinvite; charset=UTF-8\r\n\r\n"
"Application-Name: File Transfer\r\n"
"Application-GUID: {5D3E02AB-6190-11d3-BBBB-00C04F795683}\r\n"
@@ -152,7 +152,7 @@ int CMsnProto::MSN_HandleMSNFTP(ThreadData *info, char *cmdString)
char tCommand[30];
size_t tCommandLen;
- tCommandLen = mir_snprintf(tCommand, SIZEOF(tCommand), "FIL %i\r\n", info->mMsnFtp->std.totalBytes);
+ tCommandLen = mir_snprintf(tCommand, _countof(tCommand), "FIL %i\r\n", info->mMsnFtp->std.totalBytes);
info->send(tCommand, tCommandLen);
break;
@@ -176,7 +176,7 @@ LBL_InvalidCommand:
if (info->mCaller == 0) { //receive
char tCommand[MSN_MAX_EMAIL_LEN + 50];
size_t tCommandLen;
- tCommandLen = mir_snprintf(tCommand, SIZEOF(tCommand), "USR %s %s\r\n", MyOptions.szEmail, info->mCookie);
+ tCommandLen = mir_snprintf(tCommand, _countof(tCommand), "USR %s %s\r\n", MyOptions.szEmail, info->mCookie);
info->send(tCommand, tCommandLen);
}
else if (info->mCaller == 2) { //send
diff --git a/protocols/MSN/src/msn_lists.cpp b/protocols/MSN/src/msn_lists.cpp
index 35310c1cfb..227f6ff9db 100644
--- a/protocols/MSN/src/msn_lists.cpp
+++ b/protocols/MSN/src/msn_lists.cpp
@@ -243,7 +243,7 @@ void CMsnProto::MSN_CleanupLists(void)
mir_free(sze);
TCHAR title[128];
- mir_sntprintf(title, SIZEOF(title), TranslateT("%s protocol"), m_tszUserName);
+ mir_sntprintf(title, _countof(title), TranslateT("%s protocol"), m_tszUserName);
if (MessageBox(NULL, text, title, MB_YESNO | MB_ICONQUESTION | MB_SETFOREGROUND) == IDYES) {
MSN_AddUser(p.hContact, p.email, 0, LIST_LL);
@@ -260,7 +260,7 @@ void CMsnProto::MSN_CleanupLists(void)
if (p.list & (LIST_LL | LIST_FL) && p.hContact) {
TCHAR path[MAX_PATH];
- MSN_GetCustomSmileyFileName(p.hContact, path, SIZEOF(path), "", 0);
+ MSN_GetCustomSmileyFileName(p.hContact, path, _countof(path), "", 0);
if (path[0]) {
SMADD_CONT cont;
cont.cbSize = sizeof(SMADD_CONT);
diff --git a/protocols/MSN/src/msn_mail.cpp b/protocols/MSN/src/msn_mail.cpp
index 652bb0efcd..312cc2bfd7 100644
--- a/protocols/MSN/src/msn_mail.cpp
+++ b/protocols/MSN/src/msn_mail.cpp
@@ -255,14 +255,14 @@ void CMsnProto::sttNotificationMessage(char* msgBody, bool isInitial)
wchar_t* mimeSubjectW = tFileInfo.decode(Subject);
- mir_sntprintf(tBuffer2, SIZEOF(tBuffer2), TranslateT("Subject: %s"), mimeSubjectW);
+ mir_sntprintf(tBuffer2, _countof(tBuffer2), TranslateT("Subject: %s"), mimeSubjectW);
TCHAR* msgtxt = _stricmp(From, Fromaddr) ?
TranslateT("Hotmail from %s (%S)") : TranslateT("Hotmail from %s");
- mir_sntprintf(tBuffer, SIZEOF(tBuffer), msgtxt, mimeFromW, Fromaddr);
+ mir_sntprintf(tBuffer, _countof(tBuffer), msgtxt, mimeFromW, Fromaddr);
mir_free(mimeFromW);
mir_free(mimeSubjectW);
ShowPopup = true;
@@ -271,8 +271,8 @@ void CMsnProto::sttNotificationMessage(char* msgBody, bool isInitial)
const char* MailData = tFileInfo["Mail-Data"];
if (MailData != NULL) processMailData((char*)MailData);
- mir_sntprintf(tBuffer, SIZEOF(tBuffer), m_tszUserName);
- mir_sntprintf(tBuffer2, SIZEOF(tBuffer2), TranslateT("Unread mail is available: %d in Inbox and %d in other folders."), mUnreadMessages, mUnreadJunkEmails);
+ mir_sntprintf(tBuffer, _countof(tBuffer), m_tszUserName);
+ mir_sntprintf(tBuffer2, _countof(tBuffer2), TranslateT("Unread mail is available: %d in Inbox and %d in other folders."), mUnreadMessages, mUnreadJunkEmails);
}
if (UnreadMessages == mUnreadMessages && UnreadJunkEmails == mUnreadJunkEmails && !isInitial)
@@ -390,7 +390,7 @@ void CMsnProto::displayEmailCount(MCONTACT hContact)
rtrimt(name);
TCHAR szNick[128];
- mir_sntprintf(szNick, SIZEOF(szNick),
+ mir_sntprintf(szNick, _countof(szNick),
getByte("DisableHotmailJunk", 0) ? _T("%s [%d]") : _T("%s [%d][%d]"), name, mUnreadMessages, mUnreadJunkEmails);
nickChg = true;
diff --git a/protocols/MSN/src/msn_menu.cpp b/protocols/MSN/src/msn_menu.cpp
index 3899dc8cf8..e257a86e54 100644
--- a/protocols/MSN/src/msn_menu.cpp
+++ b/protocols/MSN/src/msn_menu.cpp
@@ -93,7 +93,7 @@ INT_PTR CMsnProto::MsnViewProfile(WPARAM hContact, LPARAM)
}
char tUrl[256];
- mir_snprintf(tUrl, SIZEOF(tUrl), "http://cid-%I64X.profiles.live.com", _atoi64(cid));
+ mir_snprintf(tUrl, _countof(tUrl), "http://cid-%I64X.profiles.live.com", _atoi64(cid));
MsnInvokeMyURL(false, tUrl);
return 0;
}
@@ -181,7 +181,7 @@ INT_PTR CMsnProto::MsnSendNetMeeting(WPARAM wParam, LPARAM)
char msg[1024];
- mir_snprintf(msg, SIZEOF(msg),
+ mir_snprintf(msg, _countof(msg),
"Content-Type: text/x-msmsgsinvite; charset=UTF-8\r\n\r\n"
"Application-Name: NetMeeting\r\n"
"Application-GUID: {44BBA842-CC51-11CF-AAFA-00AA00B6015C}\r\n"
@@ -232,7 +232,7 @@ static INT_PTR CALLBACK DlgProcSetNickname(HWND hwndDlg, UINT msg, WPARAM wParam
CMsnProto *proto = (CMsnProto*)GetWindowLongPtr(hwndDlg, GWLP_USERDATA);
if (proto->msnLoggedIn) {
TCHAR str[130];
- GetDlgItemText(hwndDlg, IDC_NICKNAME, str, SIZEOF(str));
+ GetDlgItemText(hwndDlg, IDC_NICKNAME, str, _countof(str));
proto->MSN_SendNickname(str);
}
}
@@ -349,7 +349,7 @@ void CMsnProto::MSN_EnableMenuItems(bool bEnable)
if (!bEnable)
mi.flags |= CMIF_GRAYED;
- for (int i = 0; i < SIZEOF(menuItemsMain); i++)
+ for (int i = 0; i < _countof(menuItemsMain); i++)
if (menuItemsMain[i] != NULL)
Menu_ModifyItem(menuItemsMain[i], &mi);
diff --git a/protocols/MSN/src/msn_mime.cpp b/protocols/MSN/src/msn_mime.cpp
index 1b5651794d..7be06009a9 100644
--- a/protocols/MSN/src/msn_mime.cpp
+++ b/protocols/MSN/src/msn_mime.cpp
@@ -339,7 +339,7 @@ static const struct _tag_cpltbl
static unsigned FindCP(const char* mimecp)
{
unsigned cp = CP_ACP;
- for (unsigned i = 0; i < SIZEOF(cptbl); ++i) {
+ for (unsigned i = 0; i < _countof(cptbl); ++i) {
if (_stricmp(mimecp, cptbl[i].mimecp) == 0) {
cp = cptbl[i].cp;
break;
diff --git a/protocols/MSN/src/msn_misc.cpp b/protocols/MSN/src/msn_misc.cpp
index 4077447e09..6c5e3a4fcd 100644
--- a/protocols/MSN/src/msn_misc.cpp
+++ b/protocols/MSN/src/msn_misc.cpp
@@ -122,7 +122,7 @@ void CMsnProto::InitCustomFolders(void)
if (InitCstFldRan) return;
TCHAR folder[MAX_PATH];
- mir_sntprintf(folder, SIZEOF(folder), _T("%%miranda_avatarcache%%\\%S"), m_szModuleName);
+ mir_sntprintf(folder, _countof(folder), _T("%%miranda_avatarcache%%\\%S"), m_szModuleName);
hCustomSmileyFolder = FoldersRegisterCustomPathT(LPGEN("Custom Smileys"), m_szModuleName, folder, m_tszUserName);
InitCstFldRan = true;
@@ -290,10 +290,10 @@ int CMsnProto::MSN_SetMyAvatar(const TCHAR* sztFname, void* pData, size_t cbLen)
return fmt;
TCHAR szFileName[MAX_PATH];
- MSN_GetAvatarFileName(NULL, szFileName, SIZEOF(szFileName), NULL);
+ MSN_GetAvatarFileName(NULL, szFileName, _countof(szFileName), NULL);
_tremove(szFileName);
- MSN_GetAvatarFileName(NULL, szFileName, SIZEOF(szFileName), szExt);
+ MSN_GetAvatarFileName(NULL, szFileName, _countof(szFileName), szExt);
int fileId = _topen(szFileName, _O_CREAT | _O_TRUNC | _O_WRONLY | O_BINARY, _S_IREAD | _S_IWRITE);
if (fileId >= 0) {
@@ -479,7 +479,7 @@ int ThreadData::sendMessage(int, const char *email, int netId, const char *parMs
#ifdef OBSOLETE
if (parFlags & MSG_OFFLINE)
- off += mir_snprintf((buf + off), (SIZEOF(buf) - off), "Dest-Agent: client\r\n");
+ off += mir_snprintf((buf + off), (_countof(buf) - off), "Dest-Agent: client\r\n");
#endif
}
@@ -541,7 +541,7 @@ void ThreadData::sendCaps(void)
char mversion[100], capMsg[1000];
CallService(MS_SYSTEM_GETVERSIONTEXT, sizeof(mversion), (LPARAM)mversion);
- mir_snprintf(capMsg, SIZEOF(capMsg),
+ mir_snprintf(capMsg, _countof(capMsg),
"Content-Type: text/x-clientcaps\r\n\r\n"
"Client-Name: Miranda NG %s (MSN v.%s)\r\n",
mversion, __VERSION_STRING_DOTS);
@@ -586,7 +586,7 @@ int ThreadData::sendRawMessage(int msgType, const char* data, int datLen)
void CMsnProto::MSN_SendTyping(ThreadData* info, const char* email, int netId, bool bTyping)
{
char tCommand[1024];
- mir_snprintf(tCommand, SIZEOF(tCommand),
+ mir_snprintf(tCommand, _countof(tCommand),
"Messaging: 2.0\r\n"
"Message-Type: %s\r\n"
"Content-Type: Application/Message\r\n"
@@ -632,7 +632,7 @@ void CMsnProto::MSN_SendStatusMessage(const char*)
size_t sz;
char szMsg[2048];
if (msnCurrentMedia.cbSize == 0) {
- sz = mir_snprintf(szMsg, SIZEOF(szMsg), "<Data><PSM>%s</PSM><CurrentMedia></CurrentMedia><MachineGuid>%s</MachineGuid>"
+ sz = mir_snprintf(szMsg, _countof(szMsg), "<Data><PSM>%s</PSM><CurrentMedia></CurrentMedia><MachineGuid>%s</MachineGuid>"
"<DDP></DDP><SignatureSound></SignatureSound><Scene></Scene><ColorScheme></ColorScheme></Data>",
msgEnc, MyOptions.szMachineGuid);
}
@@ -667,7 +667,7 @@ void CMsnProto::MSN_SendStatusMessage(const char*)
*szPlayer = HtmlEncodeUTF8T(msnCurrentMedia.ptszPlayer),
*szType = HtmlEncodeUTF8T(msnCurrentMedia.ptszType);
- sz = mir_snprintf(szMsg, SIZEOF(szMsg),
+ sz = mir_snprintf(szMsg, _countof(szMsg),
"<Data>"
"<PSM>%s</PSM>"
"<CurrentMedia>%s\\0%s\\01\\0%s\\0%s\\0%s\\0%s\\0%s\\0%s\\0%s\\0%s\\0%s\\0%s\\0\\0</CurrentMedia>"
@@ -799,7 +799,7 @@ void CMsnProto::MSN_SetServerStatus(int newStatus)
char szMsg[2048];
#ifdef OBSOLETE
if (m_iStatus < ID_STATUS_ONLINE) {
- int sz = mir_snprintf(szMsg, SIZEOF(szMsg),
+ int sz = mir_snprintf(szMsg, _countof(szMsg),
"<EndpointData><Capabilities>%u:%u</Capabilities></EndpointData>", myFlags, myFlagsEx);
msnNsThread->sendPacket("UUX", "%d\r\n%s", sz, szMsg);
@@ -820,13 +820,13 @@ void CMsnProto::MSN_SetServerStatus(int newStatus)
szPlace = dbv.pszVal;
else {
TCHAR buf[128] = _T("Miranda");
- DWORD buflen = SIZEOF(buf);
+ DWORD buflen = _countof(buf);
GetComputerName(buf, &buflen);
szPlace = mir_utf8encodeT(buf);
}
char** msgptr = GetStatusMsgLoc(newStatus);
- int sz = mir_snprintf(szMsg, SIZEOF(szMsg),
+ int sz = mir_snprintf(szMsg, _countof(szMsg),
"<user>"
"<sep n=\"PE\" epid=\"%s\"><VER>%s</VER><TYP>11</TYP><Capabilities>0:0</Capabilities></sep>"
"<s n=\"IM\"><Status>%s</Status></s>"
@@ -859,7 +859,7 @@ void CMsnProto::MSN_SetServerStatus(int newStatus)
// TODO: Send, MSN_SendStatusMessage anpassen.
#ifdef OBSOLETE
- int sz = mir_snprintf(szMsg, SIZEOF(szMsg),
+ int sz = mir_snprintf(szMsg, _countof(szMsg),
"<PrivateEndpointData>"
"<EpName>%s</EpName>"
"<Idle>%s</Idle>"
@@ -959,7 +959,7 @@ void CMsnProto::MSN_ShowError(const char* msgtext, ...)
TCHAR *buf = Langpack_PcharToTchar(msgtext);
va_start(tArgs, msgtext);
- mir_vsntprintf(tBuffer, SIZEOF(tBuffer), buf, tArgs);
+ mir_vsntprintf(tBuffer, _countof(tBuffer), buf, tArgs);
va_end(tArgs);
mir_free(buf);
@@ -1061,7 +1061,7 @@ void CALLBACK sttMainThreadCallback(PVOID dwParam)
if ((iserr && !pud->proto->MyOptions.ShowErrorsAsPopups) || !ServiceExists(MS_POPUP_ADDPOPUPCLASS)) {
if (pud->flags & MSN_ALLOW_MSGBOX) {
TCHAR szMsg[MAX_SECONDLINE + MAX_CONTACTNAME];
- mir_sntprintf(szMsg, SIZEOF(szMsg), _T("%s:\n%s"), pud->title, pud->text);
+ mir_sntprintf(szMsg, _countof(szMsg), _T("%s:\n%s"), pud->title, pud->text);
MessageBox(NULL, szMsg, TranslateT("MSN Protocol"),
MB_OK | (iserr ? MB_ICONERROR : MB_ICONINFORMATION));
}
@@ -1393,7 +1393,7 @@ void MSN_MakeDigest(const char* chl, char* dgst)
md5hash[i] &= 0x7FFFFFFF;
char chlString[128];
- mir_snprintf(chlString, SIZEOF(chlString), "%s%s00000000", chl, msnProductID);
+ mir_snprintf(chlString, _countof(chlString), "%s%s00000000", chl, msnProductID);
chlString[(mir_strlen(chl) + mir_strlen(msnProductID) + 7) & 0xF8] = 0;
LONGLONG high = 0, low = 0;
diff --git a/protocols/MSN/src/msn_natdetect.cpp b/protocols/MSN/src/msn_natdetect.cpp
index 18e3a5746e..6485612496 100644
--- a/protocols/MSN/src/msn_natdetect.cpp
+++ b/protocols/MSN/src/msn_natdetect.cpp
@@ -312,7 +312,7 @@ static bool IsIcfEnabled(void)
if (FAILED(hr)) goto error;
TCHAR szFileName[MAX_PATH];
- GetModuleFileName(NULL, szFileName, SIZEOF(szFileName));
+ GetModuleFileName(NULL, szFileName, _countof(szFileName));
wszFileName = mir_t2u(szFileName);
diff --git a/protocols/MSN/src/msn_opts.cpp b/protocols/MSN/src/msn_opts.cpp
index c5206af9ed..183252d3db 100644
--- a/protocols/MSN/src/msn_opts.cpp
+++ b/protocols/MSN/src/msn_opts.cpp
@@ -47,19 +47,19 @@ static IconItem iconList[] =
void MsnInitIcons(void)
{
- Icon_Register(hInst, "Protocols/MSN", iconList, SIZEOF(iconList), "MSN");
+ Icon_Register(hInst, "Protocols/MSN", iconList, _countof(iconList), "MSN");
}
HICON LoadIconEx(const char* name, bool big)
{
char szSettingName[100];
- mir_snprintf(szSettingName, SIZEOF(szSettingName), "MSN_%s", name);
+ mir_snprintf(szSettingName, _countof(szSettingName), "MSN_%s", name);
return IcoLib_GetIcon(szSettingName, big);
}
HANDLE GetIconHandle(int iconId)
{
- for (unsigned i = 0; i < SIZEOF(iconList); i++)
+ for (unsigned i = 0; i < _countof(iconList); i++)
if (iconList[i].defIconID == iconId)
return iconList[i].hIcolib;
@@ -69,7 +69,7 @@ HANDLE GetIconHandle(int iconId)
void ReleaseIconEx(const char* name, bool big)
{
char szSettingName[100];
- mir_snprintf(szSettingName, SIZEOF(szSettingName), "MSN_%s", name);
+ mir_snprintf(szSettingName, _countof(szSettingName), "MSN_%s", name);
IcoLib_Release(szSettingName, big);
}
@@ -174,7 +174,7 @@ static INT_PTR CALLBACK DlgProcMsnOpts(HWND hwndDlg, UINT msg, WPARAM wParam, LP
{
HWND tEditField = GetDlgItem(hwndDlg, IDC_MAILER_APP);
- GetWindowTextA(tEditField, szFile, SIZEOF(szFile));
+ GetWindowTextA(tEditField, szFile, _countof(szFile));
size_t tSelectLen = 0;
@@ -196,7 +196,7 @@ LBL_Continue:
OPENFILENAMEA ofn = { 0 };
ofn.lStructSize = sizeof(ofn);
ofn.hwndOwner = hwndDlg;
- ofn.nMaxFile = SIZEOF(szFile);
+ ofn.nMaxFile = _countof(szFile);
ofn.lpstrFile = szFile;
ofn.Flags = OFN_FILEMUSTEXIST | OFN_NOCHANGEDIR;
if (GetOpenFileNameA(&ofn) != TRUE)
@@ -204,7 +204,7 @@ LBL_Continue:
if (strchr(szFile, ' ') != NULL) {
char tmpBuf[MAX_PATH + 2];
- mir_snprintf(tmpBuf, SIZEOF(tmpBuf), "\"%s\"", szFile);
+ mir_snprintf(tmpBuf, _countof(tmpBuf), "\"%s\"", szFile);
mir_strcpy(szFile, tmpBuf);
}
@@ -225,7 +225,7 @@ LBL_Continue:
CMsnProto* proto = (CMsnProto*)GetWindowLongPtr(hwndDlg, GWLP_USERDATA);
- GetDlgItemTextA(hwndDlg, IDC_HANDLE, szEmail, SIZEOF(szEmail));
+ GetDlgItemTextA(hwndDlg, IDC_HANDLE, szEmail, _countof(szEmail));
if (mir_strcmp(_strlwr(szEmail), proto->MyOptions.szEmail)) {
reconnectRequired = true;
mir_strcpy(proto->MyOptions.szEmail, szEmail);
@@ -234,7 +234,7 @@ LBL_Continue:
proto->setDword("netId", (proto->MyOptions.netId = proto->GetMyNetID()));
}
- GetDlgItemTextA(hwndDlg, IDC_PASSWORD, password, SIZEOF(password));
+ GetDlgItemTextA(hwndDlg, IDC_PASSWORD, password, _countof(password));
if (!proto->getString("Password", &dbv)) {
if (mir_strcmp(password, dbv.pszVal)) {
reconnectRequired = true;
@@ -248,7 +248,7 @@ LBL_Continue:
}
#ifdef OBSOLETE
- GetDlgItemText(hwndDlg, IDC_HANDLE2, screenStr, SIZEOF(screenStr));
+ GetDlgItemText(hwndDlg, IDC_HANDLE2, screenStr, _countof(screenStr));
if (!proto->getTString("Nick", &dbv)) {
if (mir_tstrcmp(dbv.ptszVal, screenStr))
proto->MSN_SendNickname(screenStr);
@@ -275,7 +275,7 @@ LBL_Continue:
proto->setByte("RunMailerOnHotmail", (BYTE)IsDlgButtonChecked(hwndDlg, IDC_RUN_APP_ON_HOTMAIL));
proto->setByte("ManageServer", (BYTE)IsDlgButtonChecked(hwndDlg, IDC_MANAGEGROUPS));
- GetDlgItemText(hwndDlg, IDC_MAILER_APP, screenStr, SIZEOF(screenStr));
+ GetDlgItemText(hwndDlg, IDC_MAILER_APP, screenStr, _countof(screenStr));
proto->setTString("MailerPath", screenStr);
if (reconnectRequired && proto->msnLoggedIn)
@@ -382,13 +382,13 @@ static INT_PTR CALLBACK DlgProcMsnConnOpts(HWND hwndDlg, UINT msg, WPARAM wParam
CMsnProto* proto = (CMsnProto*)GetWindowLongPtr(hwndDlg, GWLP_USERDATA);
- GetDlgItemTextA(hwndDlg, IDC_DIRECTSERVER, str, SIZEOF(str));
+ GetDlgItemTextA(hwndDlg, IDC_DIRECTSERVER, str, _countof(str));
if (mir_strcmp(str, MSN_DEFAULT_LOGIN_SERVER))
proto->setString("DirectServer", str);
else
proto->delSetting("DirectServer");
- GetDlgItemTextA(hwndDlg, IDC_GATEWAYSERVER, str, SIZEOF(str));
+ GetDlgItemTextA(hwndDlg, IDC_GATEWAYSERVER, str, _countof(str));
if (mir_strcmp(str, MSN_DEFAULT_GATEWAY))
proto->setString("GatewayServer", str);
else
@@ -412,7 +412,7 @@ static INT_PTR CALLBACK DlgProcMsnConnOpts(HWND hwndDlg, UINT msg, WPARAM wParam
proto->setByte("AutoGetHost", (BYTE)gethst);
if (gethst == 0) {
- GetDlgItemTextA(hwndDlg, IDC_YOURHOST, str, SIZEOF(str));
+ GetDlgItemTextA(hwndDlg, IDC_YOURHOST, str, _countof(str));
proto->setString("YourHost", str);
}
else proto->delSetting("YourHost");
@@ -551,7 +551,7 @@ static INT_PTR CALLBACK DlgProcAccMgrUI(HWND hwndDlg, UINT msg, WPARAM wParam, L
CMsnProto* proto = (CMsnProto*)GetWindowLongPtr(hwndDlg, GWLP_USERDATA);
- GetDlgItemTextA(hwndDlg, IDC_HANDLE, szEmail, SIZEOF(szEmail));
+ GetDlgItemTextA(hwndDlg, IDC_HANDLE, szEmail, _countof(szEmail));
if (mir_strcmp(szEmail, proto->MyOptions.szEmail)) {
mir_strcpy(proto->MyOptions.szEmail, szEmail);
proto->setString("e-mail", szEmail);
@@ -559,7 +559,7 @@ static INT_PTR CALLBACK DlgProcAccMgrUI(HWND hwndDlg, UINT msg, WPARAM wParam, L
proto->setDword("netId", (proto->MyOptions.netId = proto->GetMyNetID()));
}
- GetDlgItemTextA(hwndDlg, IDC_PASSWORD, password, SIZEOF(password));
+ GetDlgItemTextA(hwndDlg, IDC_PASSWORD, password, _countof(password));
if (!proto->getString("Password", &dbv)) {
if (mir_strcmp(password, dbv.pszVal))
proto->setString("Password", password);
@@ -568,7 +568,7 @@ static INT_PTR CALLBACK DlgProcAccMgrUI(HWND hwndDlg, UINT msg, WPARAM wParam, L
else proto->setString("Password", password);
TCHAR szPlace[64];
- GetDlgItemText(hwndDlg, IDC_PLACE, szPlace, SIZEOF(szPlace));
+ GetDlgItemText(hwndDlg, IDC_PLACE, szPlace, _countof(szPlace));
if (szPlace[0])
proto->setTString("Place", szPlace);
else
diff --git a/protocols/MSN/src/msn_p2p.cpp b/protocols/MSN/src/msn_p2p.cpp
index 12568c3e52..dc965db7dd 100644
--- a/protocols/MSN/src/msn_p2p.cpp
+++ b/protocols/MSN/src/msn_p2p.cpp
@@ -235,7 +235,7 @@ void CMsnProto::p2p_savePicture2disk(filetransfer* ft)
PROTO_AVATAR_INFORMATION ai = { 0 };
ai.format = format;
ai.hContact = ft->std.hContact;
- MSN_GetAvatarFileName(ai.hContact, ai.filename, SIZEOF(ai.filename), ext);
+ MSN_GetAvatarFileName(ai.hContact, ai.filename, _countof(ai.filename), ext);
_trename(ft->std.tszCurrentFile, ai.filename);
@@ -1174,7 +1174,7 @@ void CMsnProto::p2p_InitFileTransfer(
}
if (pictmatch) {
TCHAR szFileName[MAX_PATH];
- MSN_GetAvatarFileName(NULL, szFileName, SIZEOF(szFileName), NULL);
+ MSN_GetAvatarFileName(NULL, szFileName, _countof(szFileName), NULL);
ft->fileId = _topen(szFileName, O_RDONLY | _O_BINARY, _S_IREAD);
if (ft->fileId == -1) {
p2p_sendStatus(ft, 603);
@@ -1224,7 +1224,7 @@ void CMsnProto::p2p_InitFileTransfer(
ft->std.totalFiles = 1;
TCHAR tComment[40];
- mir_sntprintf(tComment, SIZEOF(tComment), TranslateT("%I64u bytes"), ft->std.currentFileSize);
+ mir_sntprintf(tComment, _countof(tComment), TranslateT("%I64u bytes"), ft->std.currentFileSize);
PROTORECVFILET pre = { 0 };
pre.dwFlags = PRFF_TCHAR;
@@ -1396,7 +1396,7 @@ void CMsnProto::p2p_startConnect(const char* wlid, const char* szCallID, const c
newThread->mType = SERVER_P2P_DIRECT;
newThread->mInitialContactWLID = mir_strdup(wlid);
strncpy_s(newThread->mCookie, szCallID, _TRUNCATE);
- mir_snprintf(newThread->mServer, SIZEOF(newThread->mServer),
+ mir_snprintf(newThread->mServer, _countof(newThread->mServer),
ipv6 ? "[%s]:%s" : "%s:%s", pAddrTokBeg, pPortTokBeg);
newThread->startThread(&CMsnProto::p2p_fileActiveThread, this);
@@ -1739,7 +1739,7 @@ void CMsnProto::p2p_processMsgV2(ThreadData* info, char* msgbody, const char* wl
if (hdrdata.mRemSize || hdrdata.mTFCode == 0) {
char msgid[128];
- mir_snprintf(msgid, SIZEOF(msgid), "%s_%08x", wlid, hdrdata.mPacketNum);
+ mir_snprintf(msgid, _countof(msgid), "%s_%08x", wlid, hdrdata.mPacketNum);
int idx;
if (hdrdata.mTFCode == 0x01) {
@@ -1830,7 +1830,7 @@ void CMsnProto::p2p_processMsg(ThreadData* info, char* msgbody, const char* wlid
if (hdrdata.mPacketLen < hdrdata.mTotalSize) {
char msgid[128];
- mir_snprintf(msgid, SIZEOF(msgid), "%s_%08x", wlid, hdrdata.mID);
+ mir_snprintf(msgid, _countof(msgid), "%s_%08x", wlid, hdrdata.mID);
int idx = addCachedMsg(msgid, msgbody, (size_t)hdrdata.mOffset, hdrdata.mPacketLen,
(size_t)hdrdata.mTotalSize, false);
@@ -2094,7 +2094,7 @@ void CMsnProto::p2p_invite(unsigned iAppID, filetransfer* ft, const char *wlid)
if (ft->p2p_isV2) {
if (cont->places.getCount() && cont->places[0].cap1 & cap_SupportsP2PBootstrap) {
char wlid[128];
- mir_snprintf(wlid, SIZEOF(wlid),
+ mir_snprintf(wlid, _countof(wlid),
mir_strcmp(cont->places[0].id, sttVoidUid) ? "%s;%s" : "%s",
cont->email, cont->places[0].id);
@@ -2145,7 +2145,7 @@ void CMsnProto::p2p_invite(unsigned iAppID, filetransfer* ft, const char *wlid)
if (ft->p2p_isV2 && ft->std.currentFileNumber == 0) {
for (int i = 0; i < cont->places.getCount(); ++i) {
char wlid[128];
- mir_snprintf(wlid, SIZEOF(wlid),
+ mir_snprintf(wlid, _countof(wlid),
mir_strcmp(cont->places[i].id, sttVoidUid) ? "%s;%s" : "%s",
cont->email, cont->places[i].id);
diff --git a/protocols/MSN/src/msn_proto.cpp b/protocols/MSN/src/msn_proto.cpp
index c5709e7fbd..298f1e2892 100644
--- a/protocols/MSN/src/msn_proto.cpp
+++ b/protocols/MSN/src/msn_proto.cpp
@@ -128,7 +128,7 @@ CMsnProto::CMsnProto(const char* aProtoName, const TCHAR* aUserName) :
nlu1.szSettingsModule = szDbsettings;
nlu1.ptszDescriptiveName = szBuffer;
- mir_snprintf(szDbsettings, SIZEOF(szDbsettings), "%s_HTTPS", m_szModuleName);
+ mir_snprintf(szDbsettings, _countof(szDbsettings), "%s_HTTPS", m_szModuleName);
mir_sntprintf(szBuffer, TranslateT("%s plugin HTTPS connections"), m_tszUserName);
hNetlibUserHttps = (HANDLE)CallService(MS_NETLIB_REGISTERUSER, 0, (LPARAM)&nlu1);
@@ -494,7 +494,7 @@ void __cdecl CMsnProto::MsnFileAckThread(void* arg)
filetransfer* ft = (filetransfer*)arg;
TCHAR filefull[MAX_PATH];
- mir_sntprintf(filefull, SIZEOF(filefull), _T("%s\\%s"), ft->std.tszWorkingDir, ft->std.tszCurrentFile);
+ mir_sntprintf(filefull, _countof(filefull), _T("%s\\%s"), ft->std.tszWorkingDir, ft->std.tszCurrentFile);
replaceStrT(ft->std.tszCurrentFile, filefull);
ResetEvent(ft->hResumeEvt);
@@ -586,7 +586,7 @@ HANDLE __cdecl CMsnProto::FileAllow(MCONTACT, HANDLE hTransfer, const TCHAR* szP
if ((ft->std.tszWorkingDir = mir_tstrdup(szPath)) == NULL) {
TCHAR szCurrDir[MAX_PATH];
- GetCurrentDirectory(SIZEOF(szCurrDir), szCurrDir);
+ GetCurrentDirectory(_countof(szCurrDir), szCurrDir);
ft->std.tszWorkingDir = mir_tstrdup(szCurrDir);
}
else {
@@ -1226,7 +1226,7 @@ int __cdecl CMsnProto::OnEvent(PROTOEVENTTYPE eventType, WPARAM wParam, LPARAM l
case EV_PROTO_ONERASE:
char szDbsettings[64];
- mir_snprintf(szDbsettings, SIZEOF(szDbsettings), "%s_HTTPS", m_szModuleName);
+ mir_snprintf(szDbsettings, _countof(szDbsettings), "%s_HTTPS", m_szModuleName);
CallService(MS_DB_MODULE_DELETE, 0, (LPARAM)szDbsettings);
break;
diff --git a/protocols/MSN/src/msn_soapab.cpp b/protocols/MSN/src/msn_soapab.cpp
index a3785c4adf..85395980f5 100644
--- a/protocols/MSN/src/msn_soapab.cpp
+++ b/protocols/MSN/src/msn_soapab.cpp
@@ -76,8 +76,8 @@ ezxml_t CMsnProto::abSoapHdr(const char* service, const char* scenario, ezxml_t&
ezxml_t CMsnProto::getSoapResponse(ezxml_t bdy, const char* service)
{
char resp1[40], resp2[40];
- mir_snprintf(resp1, SIZEOF(resp1), "%sResponse", service);
- mir_snprintf(resp2, SIZEOF(resp2), "%sResult", service);
+ mir_snprintf(resp1, _countof(resp1), "%sResponse", service);
+ mir_snprintf(resp2, _countof(resp2), "%sResult", service);
ezxml_t res = ezxml_get(bdy, "soap:Body", 0, resp1, 0, resp2, -1);
if (res == NULL)
@@ -95,7 +95,7 @@ ezxml_t CMsnProto::getSoapFault(ezxml_t bdy, bool err)
void CMsnProto::UpdateABHost(const char* service, const char* url)
{
char hostname[128];
- mir_snprintf(hostname, SIZEOF(hostname), "ABHost-%s", service);
+ mir_snprintf(hostname, _countof(hostname), "ABHost-%s", service);
if (url)
setString(hostname, url);
@@ -114,7 +114,7 @@ void CMsnProto::UpdateABCacheKey(ezxml_t bdy, bool isSharing)
char* CMsnProto::GetABHost(const char* service, bool isSharing)
{
char hostname[128];
- mir_snprintf(hostname, SIZEOF(hostname), "ABHost-%s", service);
+ mir_snprintf(hostname, _countof(hostname), "ABHost-%s", service);
char* host = (char*)mir_alloc(256);
if (db_get_static(NULL, m_szModuleName, hostname, host, 256)) {
@@ -284,7 +284,7 @@ bool CMsnProto::MSN_SharingFindMembership(bool deltas, bool allowRecurse)
}
else if (mir_strcmp(szType, "Phone") == 0) {
netId = NETID_MOB;
- mir_snprintf(email, SIZEOF(email), "tel:%s", ezxml_txt(ezxml_child(memb, "PhoneNumber")));
+ mir_snprintf(email, _countof(email), "tel:%s", ezxml_txt(ezxml_child(memb, "PhoneNumber")));
szEmail = email;
}
else if (mir_strcmp(szType, "Email") == 0) {
@@ -686,7 +686,7 @@ bool CMsnProto::MSN_ABFind(const char* szMethod, const char* szGuid, bool deltas
szMsgUsr = ezxml_txt(ezxml_child(phn, "isMessengerEnabled"));
if (mir_strcmp(szMsgUsr, "true") == 0) {
szEmail = ezxml_txt(ezxml_child(phn, "number"));
- mir_snprintf(email, SIZEOF(email), "tel:%s", szEmail);
+ mir_snprintf(email, _countof(email), "tel:%s", szEmail);
szEmail = email;
netId = NETID_MOB;
break;
@@ -1584,7 +1584,7 @@ void CMsnProto::MSN_ABUpdateDynamicItem(bool allowRecurse)
tm *tmst = gmtime(&timer);
char tmstr[64];
- mir_snprintf(tmstr, SIZEOF(tmstr), "%04u-%02u-%02uT%02u:%02u:%02uZ",
+ mir_snprintf(tmstr, _countof(tmstr), "%04u-%02u-%02uT%02u:%02u:%02uZ",
tmst->tm_year + 1900, tmst->tm_mon + 1, tmst->tm_mday,
tmst->tm_hour, tmst->tm_min, tmst->tm_sec);
diff --git a/protocols/MSN/src/msn_soapstore.cpp b/protocols/MSN/src/msn_soapstore.cpp
index 8dce12549e..fc8a5b96f2 100644
--- a/protocols/MSN/src/msn_soapstore.cpp
+++ b/protocols/MSN/src/msn_soapstore.cpp
@@ -71,7 +71,7 @@ ezxml_t CMsnProto::storeSoapHdr(const char* service, const char* scenario, ezxml
char* CMsnProto::GetStoreHost(const char* service)
{
char hostname[128];
- mir_snprintf(hostname, SIZEOF(hostname), "StoreHost-%s", service);
+ mir_snprintf(hostname, _countof(hostname), "StoreHost-%s", service);
char* host = (char*)mir_alloc(256);
if (db_get_static(NULL, m_szModuleName, hostname, host, 256) || !*host)
@@ -83,7 +83,7 @@ char* CMsnProto::GetStoreHost(const char* service)
void CMsnProto::UpdateStoreHost(const char* service, const char* url)
{
char hostname[128];
- mir_snprintf(hostname, SIZEOF(hostname), "StoreHost-%s", service);
+ mir_snprintf(hostname, _countof(hostname), "StoreHost-%s", service);
setString(hostname, url);
}
diff --git a/protocols/MSN/src/msn_svcs.cpp b/protocols/MSN/src/msn_svcs.cpp
index b509b243f8..93144442b1 100644
--- a/protocols/MSN/src/msn_svcs.cpp
+++ b/protocols/MSN/src/msn_svcs.cpp
@@ -78,7 +78,7 @@ INT_PTR CMsnProto::GetAvatarInfo(WPARAM wParam, LPARAM lParam)
}
if (pai->hContact == NULL || _stricmp(cont->email, MyOptions.szEmail) == 0) {
- MSN_GetAvatarFileName(NULL, filename, SIZEOF(filename), NULL);
+ MSN_GetAvatarFileName(NULL, filename, _countof(filename), NULL);
pai->format = ProtoGetAvatarFormat(filename);
if (pai->format != PA_FORMAT_UNKNOWN)
mir_tstrcpy(pai->filename, filename);
@@ -93,7 +93,7 @@ INT_PTR CMsnProto::GetAvatarInfo(WPARAM wParam, LPARAM lParam)
}
else return GAIR_NOAVATAR;
- MSN_GetAvatarFileName(pai->hContact, filename, SIZEOF(filename), NULL);
+ MSN_GetAvatarFileName(pai->hContact, filename, _countof(filename), NULL);
pai->format = ProtoGetAvatarFormat(filename);
if (pai->format != PA_FORMAT_UNKNOWN) {
@@ -139,7 +139,7 @@ INT_PTR CMsnProto::GetAvatarInfo(WPARAM wParam, LPARAM lParam)
ft->std.hContact = pai->hContact;
ft->p2p_object = mir_strdup(szContext);
- MSN_GetAvatarFileName(pai->hContact, filename, SIZEOF(filename), _T("unk"));
+ MSN_GetAvatarFileName(pai->hContact, filename, _countof(filename), _T("unk"));
ft->std.tszCurrentFile = mir_tstrdup(filename);
p2p_invite(MSN_APPID_AVATAR, ft, NULL);
@@ -188,7 +188,7 @@ INT_PTR CMsnProto::SetAvatar(WPARAM, LPARAM lParam)
TCHAR* szFileName = (TCHAR*)lParam;
TCHAR tFileName[MAX_PATH];
- MSN_GetAvatarFileName(NULL, tFileName, SIZEOF(tFileName), NULL);
+ MSN_GetAvatarFileName(NULL, tFileName, _countof(tFileName), NULL);
_tremove(tFileName);
if (szFileName == NULL) {
diff --git a/protocols/MinecraftDynmap/src/dialogs.cpp b/protocols/MinecraftDynmap/src/dialogs.cpp
index cc6c8efbf3..ee04d32b47 100644
--- a/protocols/MinecraftDynmap/src/dialogs.cpp
+++ b/protocols/MinecraftDynmap/src/dialogs.cpp
@@ -30,14 +30,14 @@ static IconItem icons[] = {
{ "proto", LPGEN("Protocol icon"), IDI_PROTO },
};
-static HANDLE hIconLibItem[SIZEOF(icons)];
+static HANDLE hIconLibItem[_countof(icons)];
void InitIcons(void) {
- Icon_Register(g_hInstance, "Protocols/MinecraftDynmap", icons, SIZEOF(icons), "MinecraftDynmap");
+ Icon_Register(g_hInstance, "Protocols/MinecraftDynmap", icons, _countof(icons), "MinecraftDynmap");
}
HANDLE GetIconHandle(const char* name) {
- for (size_t i = 0; i < SIZEOF(icons); i++) {
+ for (size_t i = 0; i < _countof(icons); i++) {
if (strcmp(icons[i].szName, name) == 0) {
return hIconLibItem[i];
}
@@ -73,7 +73,7 @@ static void StoreDBText(MinecraftDynmapProto* ppro, HWND hwnd, int idCtrl, const
{
TCHAR tstr[250+1];
- GetDlgItemText(hwnd, idCtrl, tstr, SIZEOF(tstr));
+ GetDlgItemText(hwnd, idCtrl, tstr, _countof(tstr));
if (tstr[0] != '\0') {
db_set_ts(NULL, ppro->m_szModuleName, szSetting, tstr);
} else {
diff --git a/protocols/MinecraftDynmap/src/main.cpp b/protocols/MinecraftDynmap/src/main.cpp
index 9f60c4d084..28b45731ed 100644
--- a/protocols/MinecraftDynmap/src/main.cpp
+++ b/protocols/MinecraftDynmap/src/main.cpp
@@ -92,8 +92,8 @@ extern "C" int __declspec(dllexport) Load(void)
mir_getLP(&pluginInfo);
mir_getCLI();
- PROTOCOLDESCRIPTOR pd = { 0 };
- pd.cbSize = sizeof(pd);
+ PROTOCOLDESCRIPTOR pd = { 0 };
+ pd.cbSize = sizeof(pd);
pd.szName = "MinecraftDynmap";
pd.type = PROTOTYPE_PROTOCOL;
pd.fnInit = protoInit;
@@ -130,7 +130,7 @@ extern "C" int __declspec(dllexport) Load(void)
extern "C" int __declspec(dllexport) Unload(void)
{
- for (size_t i=0; i < SIZEOF(g_hEvents); i++)
+ for (size_t i=0; i < _countof(g_hEvents); i++)
UnhookEvent(g_hEvents[i]);
return 0;
diff --git a/protocols/Omegle/src/communication.cpp b/protocols/Omegle/src/communication.cpp
index eb7b739c75..ce0afcc440 100644
--- a/protocols/Omegle/src/communication.cpp
+++ b/protocols/Omegle/src/communication.cpp
@@ -162,12 +162,12 @@ std::string Omegle_client::get_server( bool not_last )
int q = not_last ? 1 : 0;
int server = db_get_b(NULL, parent->m_szModuleName, OMEGLE_KEY_SERVER, 0);
- if (server < 0 || server >= (int)(SIZEOF(servers)-q))
+ if (server < 0 || server >= (int)(_countof(servers)-q))
server = 0;
if (server == 0) {
srand(::time(NULL));
- server = (rand() % (SIZEOF(servers)-1-q))+1;
+ server = (rand() % (_countof(servers)-1-q))+1;
}
return servers[server];
@@ -176,7 +176,7 @@ std::string Omegle_client::get_server( bool not_last )
std::string Omegle_client::get_language()
{
int language = db_get_b(NULL, parent->m_szModuleName, OMEGLE_KEY_LANGUAGE, 0);
- if (language < 0 || language >= (SIZEOF(languages)))
+ if (language < 0 || language >= (_countof(languages)))
language = 0;
return language > 0 ? languages[language].id : "en";
@@ -300,7 +300,7 @@ bool Omegle_client::start()
if (this->spy_mode_) {
//// get last server from list, which is for spy mode
- //this->server_ = servers[SIZEOF(servers)-1];
+ //this->server_ = servers[_countof(servers)-1];
if (this->question_.empty()) {
data = "&wantsspy=1";
@@ -551,7 +551,7 @@ bool Omegle_client::events()
st.cbSize = sizeof(st);
// st.hIcon = IcoLib_GetIconByHandle(GetIconHandle("typing_on")); // TODO: typing icon
- mir_sntprintf(st.tszText, SIZEOF(st.tszText), TranslateT("%s is typing."), TranslateT("Stranger"));
+ mir_sntprintf(st.tszText, _countof(st.tszText), TranslateT("%s is typing."), TranslateT("Stranger"));
CallService(MS_MSG_SETSTATUSTEXT, (WPARAM)parent->GetChatHandle(), (LPARAM)&st);
}
@@ -566,7 +566,7 @@ bool Omegle_client::events()
st.cbSize = sizeof(st);
// st.hIcon = IcoLib_GetIconByHandle(GetIconHandle("typing_off")); // TODO: typing icon
- mir_sntprintf(st.tszText, SIZEOF(st.tszText), TranslateT("%s stopped typing."), TranslateT("Stranger"));
+ mir_sntprintf(st.tszText, _countof(st.tszText), TranslateT("%s stopped typing."), TranslateT("Stranger"));
CallService(MS_MSG_SETSTATUSTEXT, (WPARAM)parent->GetChatHandle(), (LPARAM)&st);
}
diff --git a/protocols/Omegle/src/dialogs.cpp b/protocols/Omegle/src/dialogs.cpp
index c2f13d2995..7d5754e8a3 100644
--- a/protocols/Omegle/src/dialogs.cpp
+++ b/protocols/Omegle/src/dialogs.cpp
@@ -47,7 +47,7 @@ static void StoreDBText(OmegleProto* ppro, HWND hwnd, int idCtrl, const char* sz
{
TCHAR tstr[250+1];
- GetDlgItemText(hwnd, idCtrl, tstr, SIZEOF(tstr));
+ GetDlgItemText(hwnd, idCtrl, tstr, _countof(tstr));
if (tstr[0] != '\0') {
db_set_ts(NULL, ppro->m_szModuleName, szSetting, tstr);
} else {
@@ -73,12 +73,12 @@ INT_PTR CALLBACK OmegleAccountProc( HWND hwnd, UINT message, WPARAM wparam, LPAR
// Server
SendDlgItemMessageA(hwnd, IDC_SERVER, CB_INSERTSTRING, 0, reinterpret_cast<LPARAM>(Translate(servers[0])));
- for(size_t i=1; i<SIZEOF(servers); i++)
+ for(size_t i=1; i<_countof(servers); i++)
SendDlgItemMessageA(hwnd, IDC_SERVER, CB_INSERTSTRING, i, reinterpret_cast<LPARAM>(servers[i]));
SendDlgItemMessage(hwnd, IDC_SERVER, CB_SETCURSEL, db_get_b(NULL, proto->m_szModuleName, OMEGLE_KEY_SERVER, 0), 0);
// Language
- for(size_t i=0; i<SIZEOF(languages); i++)
+ for(size_t i=0; i<_countof(languages); i++)
SendDlgItemMessageA(hwnd, IDC_LANGUAGE, CB_INSERTSTRING, i, reinterpret_cast<LPARAM>(Translate(languages[i].lang)));
SendDlgItemMessage(hwnd, IDC_LANGUAGE, CB_SETCURSEL, db_get_b(NULL, proto->m_szModuleName, OMEGLE_KEY_LANGUAGE, 0), 0);
@@ -150,12 +150,12 @@ INT_PTR CALLBACK OmegleOptionsProc( HWND hwnd, UINT message, WPARAM wparam, LPAR
// Server
SendDlgItemMessageA(hwnd, IDC_SERVER, CB_INSERTSTRING, 0, reinterpret_cast<LPARAM>(Translate(servers[0])));
- for(size_t i=1; i<SIZEOF(servers); i++)
+ for(size_t i=1; i<_countof(servers); i++)
SendDlgItemMessageA(hwnd, IDC_SERVER, CB_INSERTSTRING, i, reinterpret_cast<LPARAM>(servers[i]));
SendDlgItemMessage(hwnd, IDC_SERVER, CB_SETCURSEL, db_get_b(NULL, proto->m_szModuleName, OMEGLE_KEY_SERVER, 0), 0);
// Language
- for(size_t i=0; i<SIZEOF(languages); i++)
+ for(size_t i=0; i<_countof(languages); i++)
SendDlgItemMessageA(hwnd, IDC_LANGUAGE, CB_INSERTSTRING, i, reinterpret_cast<LPARAM>(Translate(languages[i].lang)));
SendDlgItemMessage(hwnd, IDC_LANGUAGE, CB_SETCURSEL, db_get_b(NULL, proto->m_szModuleName, OMEGLE_KEY_LANGUAGE, 0), 0);
diff --git a/protocols/Omegle/src/main.cpp b/protocols/Omegle/src/main.cpp
index fdc7d17897..be47e64da6 100644
--- a/protocols/Omegle/src/main.cpp
+++ b/protocols/Omegle/src/main.cpp
@@ -134,7 +134,7 @@ extern "C" int __declspec(dllexport) Load(void)
extern "C" int __declspec(dllexport) Unload(void)
{
//UninitContactMenus();
- for(size_t i=0; i<SIZEOF(g_hEvents); i++)
+ for(size_t i=0; i<_countof(g_hEvents); i++)
UnhookEvent(g_hEvents[i]);
return 0;
diff --git a/protocols/Omegle/src/proto.cpp b/protocols/Omegle/src/proto.cpp
index 7419a9dcb8..45686560e5 100644
--- a/protocols/Omegle/src/proto.cpp
+++ b/protocols/Omegle/src/proto.cpp
@@ -47,7 +47,7 @@ OmegleProto::OmegleProto(const char* proto_name, const TCHAR* username) :
NETLIBUSER nlu = {sizeof(nlu)};
nlu.flags = NUF_INCOMING | NUF_OUTGOING | NUF_HTTPCONNS | NUF_TCHAR;
nlu.szSettingsModule = m_szModuleName;
- mir_sntprintf(descr,SIZEOF(descr),TranslateT("%s server connection"),m_tszUserName);
+ mir_sntprintf(descr,_countof(descr),TranslateT("%s server connection"),m_tszUserName);
nlu.ptszDescriptiveName = descr;
m_hNetlibUser = (HANDLE)CallService(MS_NETLIB_REGISTERUSER,0,(LPARAM)&nlu);
if (m_hNetlibUser == NULL) {
diff --git a/protocols/Omegle/src/theme.cpp b/protocols/Omegle/src/theme.cpp
index 843eb50ddc..48f61ba93a 100644
--- a/protocols/Omegle/src/theme.cpp
+++ b/protocols/Omegle/src/theme.cpp
@@ -29,16 +29,16 @@ static IconItem icons[] =
{ "omegle", LPGEN("Omegle Icon"), IDI_OMEGLE },
};
-static HANDLE hIconLibItem[SIZEOF(icons)];
+static HANDLE hIconLibItem[_countof(icons)];
void InitIcons(void)
{
- Icon_Register(g_hInstance, "Protocols/Omegle", icons, SIZEOF(icons), "Omegle");
+ Icon_Register(g_hInstance, "Protocols/Omegle", icons, _countof(icons), "Omegle");
}
HANDLE GetIconHandle(const char* name)
{
- for(size_t i=0; i<SIZEOF(icons); i++)
+ for(size_t i=0; i<_countof(icons); i++)
{
if(mir_strcmp(icons[i].szName, name) == 0)
return hIconLibItem[i];
diff --git a/protocols/Omegle/src/utils.cpp b/protocols/Omegle/src/utils.cpp
index 8e804585d5..86db3feec1 100644
--- a/protocols/Omegle/src/utils.cpp
+++ b/protocols/Omegle/src/utils.cpp
@@ -120,7 +120,7 @@ std::string utils::text::trim(const std::string &data )
int utils::debug::log(const std::string &file_name, const std::string &text)
{
char szFile[MAX_PATH];
- GetModuleFileNameA(g_hInstance, szFile, SIZEOF(szFile));
+ GetModuleFileNameA(g_hInstance, szFile, _countof(szFile));
std::string path = szFile;
path = path.substr( 0, path.rfind( "\\" ));
path = path.substr( 0, path.rfind( "\\" ) + 1 );
diff --git a/protocols/Sametime/src/conference.cpp b/protocols/Sametime/src/conference.cpp
index cadbea21a9..836c94b507 100644
--- a/protocols/Sametime/src/conference.cpp
+++ b/protocols/Sametime/src/conference.cpp
@@ -410,7 +410,7 @@ INT_PTR CSametimeProto::onMenuCreateChat(WPARAM wParam, LPARAM lParam)
if (my_login_info && GetAwareIdFromContact(hContact, &id_block)) {
TCHAR title[512];
TCHAR* ts = mir_utf8decodeT(my_login_info->user_name);
- mir_sntprintf(title, SIZEOF(title), TranslateT("%s's conference"), ts);
+ mir_sntprintf(title, _countof(title), TranslateT("%s's conference"), ts);
mir_free(ts);
idb.user = id_block.user;
@@ -518,13 +518,13 @@ void CSametimeProto::InitConferenceMenu()
mi.pszContactOwner = m_szModuleName;
mi.ptszName = LPGENT("Leave conference");
- mir_snprintf(service, SIZEOF(service), "%s%s", m_szModuleName, MS_SAMETIME_MENULEAVECHAT);
+ mir_snprintf(service, _countof(service), "%s%s", m_szModuleName, MS_SAMETIME_MENULEAVECHAT);
mi.pszService = service;
mi.icolibItem = GetIconHandle(IDI_ICON_LEAVE);
hLeaveChatMenuItem = Menu_AddContactMenuItem(&mi);
mi.ptszName = LPGENT("Start conference");
- mir_snprintf(service, SIZEOF(service), "%s%s", m_szModuleName, MS_SAMETIME_MENUCREATECHAT);
+ mir_snprintf(service, _countof(service), "%s%s", m_szModuleName, MS_SAMETIME_MENUCREATECHAT);
mi.pszService = service;
mi.icolibItem = GetIconHandle(IDI_ICON_INVITE);
hCreateChatMenuItem = Menu_AddContactMenuItem(&mi);
diff --git a/protocols/Sametime/src/files.cpp b/protocols/Sametime/src/files.cpp
index f3e0a2fa2e..8393eb31a8 100644
--- a/protocols/Sametime/src/files.cpp
+++ b/protocols/Sametime/src/files.cpp
@@ -33,7 +33,7 @@ void mwFileTransfer_offered(mwFileTransfer* ft)
TCHAR descriptionT[512];
if (message) {
TCHAR* messageT = mir_utf8decodeT(message);
- mir_sntprintf(descriptionT, SIZEOF(descriptionT), _T("%s - %s"), filenameT, messageT);
+ mir_sntprintf(descriptionT, _countof(descriptionT), _T("%s - %s"), filenameT, messageT);
mir_free(messageT);
} else
_tcsncpy_s(descriptionT, filenameT, _TRUNCATE);
diff --git a/protocols/Sametime/src/messaging.cpp b/protocols/Sametime/src/messaging.cpp
index aafffea62e..46540ad090 100644
--- a/protocols/Sametime/src/messaging.cpp
+++ b/protocols/Sametime/src/messaging.cpp
@@ -98,7 +98,7 @@ void mwIm_place_invite(struct mwConversation* conv, const char* message, const c
TCHAR* tszMessage = mir_utf8decodeT(message);
TCHAR msg[512];
- mir_sntprintf(msg, SIZEOF(msg), TranslateT("SERVICE NOT IMPLEMENTED. %s"), tszMessage);
+ mir_sntprintf(msg, _countof(msg), TranslateT("SERVICE NOT IMPLEMENTED. %s"), tszMessage);
proto->showPopup(msg, SAMETIME_POPUP_INFO);
mir_free(tszMessage);
diff --git a/protocols/Sametime/src/options.cpp b/protocols/Sametime/src/options.cpp
index f9a2ee775f..d8c3c33bbc 100644
--- a/protocols/Sametime/src/options.cpp
+++ b/protocols/Sametime/src/options.cpp
@@ -103,14 +103,14 @@ static INT_PTR CALLBACK DlgProcOptNet(HWND hwndDlg, UINT msg, WPARAM wParam, LPA
WORD client_ver = proto->GetClientVersion();
if (client_ver) {
TCHAR verbuf[100];
- mir_sntprintf(verbuf, SIZEOF(verbuf), TranslateT("Client protocol version: %03d.%03d"), (client_ver & 0xFF00) >> 8, client_ver & 0xFF);
+ mir_sntprintf(verbuf, _countof(verbuf), TranslateT("Client protocol version: %03d.%03d"), (client_ver & 0xFF00) >> 8, client_ver & 0xFF);
SetDlgItemText(hwndDlg, IDC_ST_CLIENTVER, verbuf);
}
WORD server_ver = proto->GetServerVersion();
if (server_ver) {
TCHAR verbuf[100];
- mir_sntprintf(verbuf, SIZEOF(verbuf), TranslateT("Server protocol version: %03d.%03d"), (server_ver & 0xFF00) >> 8, server_ver & 0xFF);
+ mir_sntprintf(verbuf, _countof(verbuf), TranslateT("Server protocol version: %03d.%03d"), (server_ver & 0xFF00) >> 8, server_ver & 0xFF);
SetDlgItemText(hwndDlg, IDC_ST_SERVERVER, verbuf);
}
diff --git a/protocols/Sametime/src/sametime.cpp b/protocols/Sametime/src/sametime.cpp
index d29923d882..a800096d0d 100644
--- a/protocols/Sametime/src/sametime.cpp
+++ b/protocols/Sametime/src/sametime.cpp
@@ -94,12 +94,12 @@ static IconItem iconList[] =
void SametimeInitIcons(void)
{
- Icon_Register(hInst, "Protocols/Sametime", iconList, SIZEOF(iconList), "SAMETIME");
+ Icon_Register(hInst, "Protocols/Sametime", iconList, _countof(iconList), "SAMETIME");
}
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;
return NULL;
@@ -108,14 +108,14 @@ HANDLE GetIconHandle(int iconId)
HICON LoadIconEx(const char* name, bool big)
{
char szSettingName[100];
- mir_snprintf(szSettingName, SIZEOF(szSettingName), "%s_%s", "SAMETIME", name);
+ mir_snprintf(szSettingName, _countof(szSettingName), "%s_%s", "SAMETIME", name);
return IcoLib_GetIcon(szSettingName, big);
}
void ReleaseIconEx(const char* name, bool big)
{
char szSettingName[100];
- mir_snprintf(szSettingName, SIZEOF(szSettingName), "%s_%s", "SAMETIME", name);
+ mir_snprintf(szSettingName, _countof(szSettingName), "%s_%s", "SAMETIME", name);
IcoLib_Release(szSettingName, big);
}
diff --git a/protocols/Sametime/src/sametime_proto.cpp b/protocols/Sametime/src/sametime_proto.cpp
index 446f477672..9003bfbe21 100644
--- a/protocols/Sametime/src/sametime_proto.cpp
+++ b/protocols/Sametime/src/sametime_proto.cpp
@@ -15,7 +15,7 @@ CSametimeProto::CSametimeProto(const char* pszProtoName, const TCHAR* tszUserNam
{
// Register m_hNetlibUser user
TCHAR name[128];
- mir_sntprintf(name, SIZEOF(name), TranslateT("%s connection"), m_tszUserName);
+ mir_sntprintf(name, _countof(name), TranslateT("%s connection"), m_tszUserName);
NETLIBUSER nlu = { 0 };
nlu.cbSize = sizeof(nlu);
nlu.flags = NUF_TCHAR | NUF_OUTGOING | NUF_INCOMING | NUF_HTTPCONNS;
@@ -45,7 +45,7 @@ CSametimeProto::CSametimeProto(const char* pszProtoName, const TCHAR* tszUserNam
RegisterPopups();
InitAwayMsg();
- mir_snprintf(szProtoGroups, SIZEOF(szProtoGroups), "%s_GROUPS", m_szModuleName);
+ mir_snprintf(szProtoGroups, _countof(szProtoGroups), "%s_GROUPS", m_szModuleName);
m_iStatus = ID_STATUS_OFFLINE;
previous_status = ID_STATUS_OFFLINE;
@@ -177,7 +177,7 @@ HANDLE CSametimeProto::SearchBasic(const TCHAR* id)
HWND CSametimeProto::SearchAdvanced(HWND owner)
{
TCHAR buf[512];
- if (GetDlgItemText(owner, IDC_EDIT1, buf, SIZEOF(buf))) {
+ if (GetDlgItemText(owner, IDC_EDIT1, buf, _countof(buf))) {
debugLog(_T("CSametimeProto::SearchAdvanced() buf:len=[%d]"), buf == NULL ? -1 : mir_tstrlen(buf));
return (HWND)SearchForUser(T2Utf(buf), TRUE);
}
diff --git a/protocols/Sametime/src/sametime_session.cpp b/protocols/Sametime/src/sametime_session.cpp
index d8e146447e..11076a6284 100644
--- a/protocols/Sametime/src/sametime_session.cpp
+++ b/protocols/Sametime/src/sametime_session.cpp
@@ -155,7 +155,7 @@ void __cdecl SessionAnnounce(struct mwSession* session, struct mwLoginInfo* from
TCHAR stzFromBuff[256];
stzFrom = mir_utf8decodeT(from->user_name);
stzText = mir_utf8decodeT(text);
- mir_sntprintf(stzFromBuff, SIZEOF(stzFromBuff), TranslateT("Session announcement - from '%s'"), stzFrom);
+ mir_sntprintf(stzFromBuff, _countof(stzFromBuff), TranslateT("Session announcement - from '%s'"), stzFrom);
MessageBox(0, TranslateTS(stzText), stzFromBuff, MB_OK);
mir_free(stzText);
mir_free(stzFrom);
@@ -567,7 +567,7 @@ void CSametimeProto::InitSessionMenu()
mi.popupPosition = 500085001;
mi.position = 2000060000;
mi.ptszName = LPGENT("Send announcement...");
- mir_snprintf(service, SIZEOF(service), "%s%s", m_szModuleName, MS_SAMETIME_MENUANNOUNCESESSION);
+ mir_snprintf(service, _countof(service), "%s%s", m_szModuleName, MS_SAMETIME_MENUANNOUNCESESSION);
mi.pszService = service;
mi.icolibItem = GetIconHandle(IDI_ICON_ANNOUNCE);
mi.pszContactOwner = m_szModuleName;
diff --git a/protocols/Sametime/src/utils.cpp b/protocols/Sametime/src/utils.cpp
index 1d464b16a1..8bf46c72d1 100644
--- a/protocols/Sametime/src/utils.cpp
+++ b/protocols/Sametime/src/utils.cpp
@@ -40,8 +40,8 @@ void CSametimeProto::RegisterPopups()
puc.ptszDescription = szDescr;
puc.pszName = szName;
- mir_snprintf(szName, SIZEOF(szName), "%s_%s", m_szModuleName, "Notify");
- mir_sntprintf(szDescr, SIZEOF(szDescr), _T("%s/%s"), m_tszUserName, TranslateT("Notification"));
+ mir_snprintf(szName, _countof(szName), "%s_%s", m_szModuleName, "Notify");
+ mir_sntprintf(szDescr, _countof(szDescr), _T("%s/%s"), m_tszUserName, TranslateT("Notification"));
puc.hIcon = CopyIcon(LoadIconEx("notify", FALSE));
ReleaseIconEx("notify", FALSE);
puc.iSeconds = 8;
@@ -49,8 +49,8 @@ void CSametimeProto::RegisterPopups()
puc.colorText = GetSysColor(COLOR_WINDOWTEXT);
hPopupNotify = Popup_RegisterClass(&puc);
- mir_snprintf(szName, SIZEOF(szName), "%s_%s", m_szModuleName, "Error");
- mir_sntprintf(szDescr, SIZEOF(szDescr), _T("%s/%s"), m_tszUserName, TranslateT("Error"));
+ mir_snprintf(szName, _countof(szName), "%s_%s", m_szModuleName, "Error");
+ mir_sntprintf(szDescr, _countof(szDescr), _T("%s/%s"), m_tszUserName, TranslateT("Error"));
puc.hIcon = CopyIcon(LoadIconEx("error", FALSE));
ReleaseIconEx("error", FALSE);
puc.iSeconds = 10;
@@ -89,9 +89,9 @@ void CALLBACK sttMainThreadCallback(PVOID dwParam)
ppd.ptszTitle = puData->title;
ppd.ptszText = puData->text;
if (puData->flag == SAMETIME_POPUP_ERROR)
- mir_snprintf(szName, SIZEOF(szName), "%s_%s", proto->m_szModuleName, "Error");
+ mir_snprintf(szName, _countof(szName), "%s_%s", proto->m_szModuleName, "Error");
else
- mir_snprintf(szName, SIZEOF(szName), "%s_%s", proto->m_szModuleName, "Notify");
+ mir_snprintf(szName, _countof(szName), "%s_%s", proto->m_szModuleName, "Notify");
ppd.pszClassName = szName;
CallService(MS_POPUP_ADDPOPUPCLASS, 0, (LPARAM)&ppd);
}
diff --git a/protocols/SkypeWeb/src/http_request.h b/protocols/SkypeWeb/src/http_request.h
index f12a5111b1..b939d9508d 100644
--- a/protocols/SkypeWeb/src/http_request.h
+++ b/protocols/SkypeWeb/src/http_request.h
@@ -257,7 +257,7 @@ public:
}
char message[1024];
- mir_snprintf(message, SIZEOF(message), "Send request to %s", szUrl);
+ mir_snprintf(message, _countof(message), "Send request to %s", szUrl);
CallService(MS_NETLIB_LOG, (WPARAM)hConnection, (LPARAM)&message);
return (NETLIBHTTPREQUEST*)CallService(MS_NETLIB_HTTPTRANSACTION, (WPARAM)hConnection, (LPARAM)this);
diff --git a/protocols/SkypeWeb/src/skype_avatars.cpp b/protocols/SkypeWeb/src/skype_avatars.cpp
index 0988f2a6d2..92045e962d 100644
--- a/protocols/SkypeWeb/src/skype_avatars.cpp
+++ b/protocols/SkypeWeb/src/skype_avatars.cpp
@@ -63,7 +63,7 @@ void CSkypeProto::OnReceiveAvatar(const NETLIBHTTPREQUEST *response, void *arg)
PROTO_AVATAR_INFORMATION ai = { 0 };
ai.format = ProtoGetBufferFormat(response->pData);
setByte(hContact, "AvatarType", ai.format);
- GetAvatarFileName(hContact, ai.filename, SIZEOF(ai.filename));
+ GetAvatarFileName(hContact, ai.filename, _countof(ai.filename));
FILE *out = _tfopen(ai.filename, _T("wb"));
if (out == NULL) {
@@ -98,8 +98,8 @@ INT_PTR CSkypeProto::SvcGetAvatarInfo(WPARAM, LPARAM lParam)
pai->format = getByte(pai->hContact, "AvatarType", PA_FORMAT_JPEG);
TCHAR tszFileName[MAX_PATH];
- GetAvatarFileName(pai->hContact, tszFileName, SIZEOF(tszFileName));
- _tcsncpy(pai->filename, tszFileName, SIZEOF(pai->filename));
+ GetAvatarFileName(pai->hContact, tszFileName, _countof(tszFileName));
+ _tcsncpy(pai->filename, tszFileName, _countof(pai->filename));
if (::_taccess(pai->filename, 0) == 0 && !getBool(pai->hContact, "NeedNewAvatar", 0))
return GAIR_SUCCESS;
@@ -117,7 +117,7 @@ INT_PTR CSkypeProto::SvcGetAvatarInfo(WPARAM, LPARAM lParam)
INT_PTR CSkypeProto::SvcGetMyAvatar(WPARAM wParam, LPARAM lParam)
{
TCHAR path[MAX_PATH];
- GetAvatarFileName(NULL, path, SIZEOF(path));
+ GetAvatarFileName(NULL, path, _countof(path));
_tcsncpy((TCHAR*)wParam, path, (int)lParam);
return 0;
}
@@ -155,7 +155,7 @@ void CSkypeProto::SetAvatarUrl(MCONTACT hContact, CMString &tszUrl)
setByte(hContact, "NeedNewAvatar", 1);
PROTO_AVATAR_INFORMATION ai = { 0 };
ai.hContact = hContact;
- GetAvatarFileName(ai.hContact, ai.filename, SIZEOF(ai.filename));
+ GetAvatarFileName(ai.hContact, ai.filename, _countof(ai.filename));
ai.format = ProtoGetAvatarFormat(ai.filename);
ProtoBroadcastAck(hContact, ACKTYPE_AVATAR, ACKRESULT_SUCCESS, (HANDLE)&ai, 0);
}
@@ -165,7 +165,7 @@ INT_PTR CSkypeProto::SvcSetMyAvatar(WPARAM, LPARAM lParam)
{
TCHAR *path = (TCHAR*)lParam;
TCHAR avatarPath[MAX_PATH];
- GetAvatarFileName(NULL, avatarPath, SIZEOF(avatarPath));
+ GetAvatarFileName(NULL, avatarPath, _countof(avatarPath));
if (path != NULL)
{
if (!CopyFile(path, avatarPath, FALSE))
diff --git a/protocols/SkypeWeb/src/skype_chatrooms.cpp b/protocols/SkypeWeb/src/skype_chatrooms.cpp
index 70b31e4447..51b70c307a 100644
--- a/protocols/SkypeWeb/src/skype_chatrooms.cpp
+++ b/protocols/SkypeWeb/src/skype_chatrooms.cpp
@@ -575,7 +575,7 @@ int CSkypeProto::OnGroupChatMenuHook(WPARAM, LPARAM lParam)
{ LPGENT("&Leave chat session"), 20, MENU_ITEM, FALSE },
{ LPGENT("&Change topic"), 30, MENU_ITEM, FALSE }
};
- gcmi->nItems = SIZEOF(Items);
+ gcmi->nItems = _countof(Items);
gcmi->Item = (gc_item*)Items;
}
else if (gcmi->Type == MENU_ON_NICKLIST)
@@ -595,7 +595,7 @@ int CSkypeProto::OnGroupChatMenuHook(WPARAM, LPARAM lParam)
{ LPGENT("&Admin"), 30, MENU_POPUPITEM },
{ LPGENT("&User"), 40, MENU_POPUPITEM }
};
- gcmi->nItems = SIZEOF(Items);
+ gcmi->nItems = _countof(Items);
gcmi->Item = (gc_item*)Items;
}
}
@@ -656,7 +656,7 @@ INT_PTR CSkypeProto::GcCreateDlgProc(HWND hwndDlg, UINT msg, WPARAM wParam, LPAR
uids.insert(ppro->getStringA(SKYPE_SETTINGS_ID));
TCHAR tszTitle[1024];
- GetDlgItemText(hwndDlg, IDC_TITLE, tszTitle, SIZEOF(tszTitle));
+ GetDlgItemText(hwndDlg, IDC_TITLE, tszTitle, _countof(tszTitle));
ppro->SendRequest(new CreateChatroomRequest(ppro->m_szRegToken, uids, ptrA(ppro->getStringA(SKYPE_SETTINGS_ID)), ppro->m_szServer));
for (int i = 0; i < uids.getCount(); i++)
mir_free(uids[i]);
diff --git a/protocols/SkypeWeb/src/skype_icons.cpp b/protocols/SkypeWeb/src/skype_icons.cpp
index 2972273e33..0848c87077 100644
--- a/protocols/SkypeWeb/src/skype_icons.cpp
+++ b/protocols/SkypeWeb/src/skype_icons.cpp
@@ -43,10 +43,10 @@ void CSkypeProto::InitIcons()
sid.pszName = szSettingName;
sid.section.t = szSectionName;
- mir_sntprintf(szSectionName, SIZEOF(szSectionName), _T("%s/%s"), LPGENT("Protocols"), LPGENT(MODULE));
- for (int i = 0; i < SIZEOF(Icons); i++)
+ mir_sntprintf(szSectionName, _countof(szSectionName), _T("%s/%s"), LPGENT("Protocols"), LPGENT(MODULE));
+ for (int i = 0; i < _countof(Icons); i++)
{
- mir_snprintf(szSettingName, SIZEOF(szSettingName), "%s_%s", MODULE, Icons[i].Name);
+ mir_snprintf(szSettingName, _countof(szSettingName), "%s_%s", MODULE, Icons[i].Name);
sid.description.t = Icons[i].Description;
sid.iDefaultIndex = -Icons[i].IconId;
@@ -57,7 +57,7 @@ void CSkypeProto::InitIcons()
HANDLE CSkypeProto::GetIconHandle(const char *name)
{
- for (size_t i = 0; i < SIZEOF(Icons); i++)
+ for (size_t i = 0; i < _countof(Icons); i++)
if (mir_strcmpi(Icons[i].Name, name) == 0)
return Icons[i].Handle;
return 0;
@@ -66,7 +66,7 @@ HANDLE CSkypeProto::GetIconHandle(const char *name)
HANDLE CSkypeProto::Skin_GetIconHandle(const char *name)
{
char iconName[100];
- mir_snprintf(iconName, SIZEOF(iconName), "%s_%s", MODULE, name);
+ mir_snprintf(iconName, _countof(iconName), "%s_%s", MODULE, name);
HANDLE hIcon = IcoLib_GetIconHandle(iconName);
if (hIcon == NULL)
hIcon = GetIconHandle(name);
@@ -75,6 +75,6 @@ HANDLE CSkypeProto::Skin_GetIconHandle(const char *name)
void CSkypeProto::UninitIcons()
{
- for (size_t i = 0; i < SIZEOF(Icons); i++)
+ for (size_t i = 0; i < _countof(Icons); i++)
IcoLib_RemoveIcon(Icons[i].Name);
} \ No newline at end of file
diff --git a/protocols/SkypeWeb/src/skype_login.cpp b/protocols/SkypeWeb/src/skype_login.cpp
index 97d0eedce3..2e7d99a311 100644
--- a/protocols/SkypeWeb/src/skype_login.cpp
+++ b/protocols/SkypeWeb/src/skype_login.cpp
@@ -219,7 +219,7 @@ void CSkypeProto::SendPresence(bool isLogin)
else
{
TCHAR compName[MAX_COMPUTERNAME_LENGTH + 1];
- DWORD size = SIZEOF(compName);
+ DWORD size = _countof(compName);
GetComputerName(compName, &size);
epname = mir_utf8encodeT(compName);
}
diff --git a/protocols/SkypeWeb/src/skype_menus.cpp b/protocols/SkypeWeb/src/skype_menus.cpp
index f845444451..d840a8f143 100644
--- a/protocols/SkypeWeb/src/skype_menus.cpp
+++ b/protocols/SkypeWeb/src/skype_menus.cpp
@@ -48,7 +48,7 @@ int CSkypeProto::OnPrebuildContactMenu(WPARAM hContact, LPARAM)
int CSkypeProto::PrebuildContactMenu(WPARAM hContact, LPARAM lParam)
{
- for (int i = 0; i < SIZEOF(ContactMenuItems); i++)
+ for (int i = 0; i < _countof(ContactMenuItems); i++)
Menu_ShowItem(ContactMenuItems[i], false);
CSkypeProto *proto = CSkypeProto::GetContactAccount(hContact);
return proto ? proto->OnPrebuildContactMenu(hContact, lParam) : 0;
diff --git a/protocols/SkypeWeb/src/skype_proto.cpp b/protocols/SkypeWeb/src/skype_proto.cpp
index 90b9715ca3..bf99dbe576 100644
--- a/protocols/SkypeWeb/src/skype_proto.cpp
+++ b/protocols/SkypeWeb/src/skype_proto.cpp
@@ -23,7 +23,7 @@ PROTO<CSkypeProto>(protoName, userName), password(NULL)
m_hProtoIcon = Icons[0].Handle;
wchar_t name[128];
- mir_sntprintf(name, SIZEOF(name), TranslateT("%s connection"), m_tszUserName);
+ mir_sntprintf(name, _countof(name), TranslateT("%s connection"), m_tszUserName);
NETLIBUSER nlu = { 0 };
nlu.cbSize = sizeof(nlu);
nlu.flags = NUF_OUTGOING | NUF_INCOMING | NUF_HTTPCONNS | NUF_UNICODE;
diff --git a/protocols/SkypeWeb/src/skype_utils.cpp b/protocols/SkypeWeb/src/skype_utils.cpp
index 58702f8aef..62370071af 100644
--- a/protocols/SkypeWeb/src/skype_utils.cpp
+++ b/protocols/SkypeWeb/src/skype_utils.cpp
@@ -32,13 +32,13 @@ void CSkypeProto::SetSrmmReadStatus(MCONTACT hContact)
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);
StatusTextData st = { 0 };
st.cbSize = sizeof(st);
st.hIcon = Skin_LoadIcon(SKINICON_OTHER_HISTORY);
- mir_sntprintf(st.tszText, SIZEOF(st.tszText), TranslateT("Message read: %s"), ttime);
+ mir_sntprintf(st.tszText, _countof(st.tszText), TranslateT("Message read: %s"), ttime);
CallService(MS_MSG_SETSTATUSTEXT, (WPARAM)hContact, (LPARAM)&st);
}
@@ -394,7 +394,7 @@ char *CSkypeProto::RemoveHtml(const char *text)
std::string entity = data.substr(begin + 1, i - begin - 1);
bool found = false;
- for (int j = 0; j < SIZEOF(htmlEntities); j++)
+ for (int j = 0; j < _countof(htmlEntities); j++)
{
if (!mir_strcmpi(entity.c_str(), htmlEntities[j].entity))
{
diff --git a/protocols/Steam/src/api/friend_list.h b/protocols/Steam/src/api/friend_list.h
index 4c1d6f8ef2..7721f0c921 100644
--- a/protocols/Steam/src/api/friend_list.h
+++ b/protocols/Steam/src/api/friend_list.h
@@ -20,13 +20,13 @@ public:
HttpRequest(REQUEST_POST, STEAM_WEB_URL "/actions/AddFriendAjax")
{
char login[MAX_PATH];
- mir_snprintf(login, SIZEOF(login), "%s||oauth:%s", steamId, token);
+ mir_snprintf(login, _countof(login), "%s||oauth:%s", steamId, token);
char cookie[MAX_PATH];
- mir_snprintf(cookie, SIZEOF(cookie), "steamLogin=%s;sessionid=%s;forceMobile=1", login, sessionId);
+ mir_snprintf(cookie, _countof(cookie), "steamLogin=%s;sessionid=%s;forceMobile=1", login, sessionId);
char data[128];
- mir_snprintf(data, SIZEOF(data),
+ mir_snprintf(data, _countof(data),
"sessionID=%s&steamid=%s",
sessionId,
who);
@@ -44,13 +44,13 @@ public:
HttpRequest(REQUEST_POST, STEAM_WEB_URL "/actions/BlockUserAjax")
{
char login[MAX_PATH];
- mir_snprintf(login, SIZEOF(login), "%s||oauth:%s", steamId, token);
+ mir_snprintf(login, _countof(login), "%s||oauth:%s", steamId, token);
char cookie[MAX_PATH];
- mir_snprintf(cookie, SIZEOF(cookie), "steamLogin=%s;sessionid=%s;forceMobile=1", login, sessionId);
+ mir_snprintf(cookie, _countof(cookie), "steamLogin=%s;sessionid=%s;forceMobile=1", login, sessionId);
char data[128];
- mir_snprintf(data, SIZEOF(data),
+ mir_snprintf(data, _countof(data),
"sessionID=%s&action=ignore&steamid=%s",
sessionId,
who);
@@ -68,13 +68,13 @@ public:
HttpRequest(REQUEST_POST, STEAM_WEB_URL "/actions/RemoveFriendAjax")
{
char login[MAX_PATH];
- mir_snprintf(login, SIZEOF(login), "%s||oauth:%s", steamId, token);
+ mir_snprintf(login, _countof(login), "%s||oauth:%s", steamId, token);
char cookie[MAX_PATH];
- mir_snprintf(cookie, SIZEOF(cookie), "steamLogin=%s;sessionid=%s;forceMobile=1", login, sessionId);
+ mir_snprintf(cookie, _countof(cookie), "steamLogin=%s;sessionid=%s;forceMobile=1", login, sessionId);
char data[128];
- mir_snprintf(data, SIZEOF(data),
+ mir_snprintf(data, _countof(data),
"sessionID=%s&steamid=%s",
sessionId,
who);
diff --git a/protocols/Steam/src/api/login.h b/protocols/Steam/src/api/login.h
index 64b41f07cb..00392dd34d 100644
--- a/protocols/Steam/src/api/login.h
+++ b/protocols/Steam/src/api/login.h
@@ -8,7 +8,7 @@ public:
HttpRequest(REQUEST_POST, STEAM_API_URL "/ISteamWebUserPresenceOAuth/Logon/v0001")
{
char data[256];
- mir_snprintf(data, SIZEOF(data), "access_token=%s&ui_mode=web", token);
+ mir_snprintf(data, _countof(data), "access_token=%s&ui_mode=web", token);
SetData(data, strlen(data));
AddHeader("Content-Type", "application/x-www-form-urlencoded");
@@ -22,7 +22,7 @@ public:
HttpRequest(REQUEST_POST, STEAM_API_URL "/ISteamWebUserPresenceOAuth/Logoff/v0001")
{
char data[256];
- mir_snprintf(data, SIZEOF(data), "access_token=%s&umqid=%s", token, umqId);
+ mir_snprintf(data, _countof(data), "access_token=%s&umqid=%s", token, umqId);
SetData(data, strlen(data));
AddHeader("Content-Type", "application/x-www-form-urlencoded");
diff --git a/protocols/Steam/src/api/pending.h b/protocols/Steam/src/api/pending.h
index f9965d341f..4e971275b4 100644
--- a/protocols/Steam/src/api/pending.h
+++ b/protocols/Steam/src/api/pending.h
@@ -8,13 +8,13 @@ public:
HttpRequest(REQUEST_POST, FORMAT, STEAM_WEB_URL "/profiles/%s/home_process", steamId)
{
char login[MAX_PATH];
- mir_snprintf(login, SIZEOF(login), "%s||oauth:%s", steamId, token);
+ mir_snprintf(login, _countof(login), "%s||oauth:%s", steamId, token);
char cookie[MAX_PATH];
- mir_snprintf(cookie, SIZEOF(cookie), "steamLogin=%s;sessionid=%s;forceMobile=1", login, sessionId);
+ mir_snprintf(cookie, _countof(cookie), "steamLogin=%s;sessionid=%s;forceMobile=1", login, sessionId);
char data[MAX_PATH];
- mir_snprintf(data, SIZEOF(data), "sessionID=%s&id=%s&perform=accept&action=approvePending&itype=friend&json=1&xml=0", sessionId, who);
+ mir_snprintf(data, _countof(data), "sessionID=%s&id=%s&perform=accept&action=approvePending&itype=friend&json=1&xml=0", sessionId, who);
SetData(data, strlen(data));
AddHeader("Cookie", cookie);
@@ -29,13 +29,13 @@ public:
HttpRequest(REQUEST_POST, FORMAT, STEAM_WEB_URL "/profiles/%s/home_process", steamId)
{
char login[MAX_PATH];
- mir_snprintf(login, SIZEOF(login), "%s||oauth:%s", steamId, token);
+ mir_snprintf(login, _countof(login), "%s||oauth:%s", steamId, token);
char cookie[MAX_PATH];
- mir_snprintf(cookie, SIZEOF(cookie), "steamLogin=%s;sessionid=%s;forceMobile=1", login, sessionId);
+ mir_snprintf(cookie, _countof(cookie), "steamLogin=%s;sessionid=%s;forceMobile=1", login, sessionId);
char data[MAX_PATH];
- mir_snprintf(data, SIZEOF(data), "sessionID=%s&id=%s&perform=ignore&action=approvePending&itype=friend&json=1&xml=0", sessionId, who);
+ mir_snprintf(data, _countof(data), "sessionID=%s&id=%s&perform=ignore&action=approvePending&itype=friend&json=1&xml=0", sessionId, who);
SetData(data, strlen(data));
AddHeader("Cookie", cookie);
@@ -50,13 +50,13 @@ public:
HttpRequest(REQUEST_POST, FORMAT, STEAM_WEB_URL "/profiles/%s/home_process", steamId)
{
char login[MAX_PATH];
- mir_snprintf(login, SIZEOF(login), "%s||oauth:%s", steamId, token);
+ mir_snprintf(login, _countof(login), "%s||oauth:%s", steamId, token);
char cookie[MAX_PATH];
- mir_snprintf(cookie, SIZEOF(cookie), "steamLogin=%s;sessionid=%s;forceMobile=1", login, sessionId);
+ mir_snprintf(cookie, _countof(cookie), "steamLogin=%s;sessionid=%s;forceMobile=1", login, sessionId);
char data[MAX_PATH];
- mir_snprintf(data, SIZEOF(data), "sessionID=%s&id=%s&perform=block&action=approvePending&itype=friend&json=1&xml=0", sessionId, who);
+ mir_snprintf(data, _countof(data), "sessionID=%s&id=%s&perform=block&action=approvePending&itype=friend&json=1&xml=0", sessionId, who);
SetData(data, strlen(data));
AddHeader("Cookie", cookie);
diff --git a/protocols/Steam/src/api/session.h b/protocols/Steam/src/api/session.h
index 3e13a2e418..5499d33c74 100644
--- a/protocols/Steam/src/api/session.h
+++ b/protocols/Steam/src/api/session.h
@@ -10,7 +10,7 @@ public:
flags = NLHRF_HTTP11 | NLHRF_SSL | NLHRF_NODUMP;
char data[512];
- mir_snprintf(data, SIZEOF(data),
+ mir_snprintf(data, _countof(data),
"oauth_token=%s&steamid=%s&webcookie=%s",
token,
steamId,
diff --git a/protocols/Steam/src/http_request.h b/protocols/Steam/src/http_request.h
index aa14d9037d..73fce0eb1b 100644
--- a/protocols/Steam/src/http_request.h
+++ b/protocols/Steam/src/http_request.h
@@ -86,7 +86,7 @@ public:
szUrl = m_url.GetBuffer();
char message[1024];
- mir_snprintf(message, SIZEOF(message), "Send request to %s", szUrl);
+ mir_snprintf(message, _countof(message), "Send request to %s", szUrl);
CallService(MS_NETLIB_LOG, (WPARAM)hConnection, (LPARAM)&message);
return (NETLIBHTTPREQUEST*)CallService(MS_NETLIB_HTTPTRANSACTION, (WPARAM)hConnection, (LPARAM)this);
diff --git a/protocols/Steam/src/main.cpp b/protocols/Steam/src/main.cpp
index 5f67cea6a6..15436fbe90 100644
--- a/protocols/Steam/src/main.cpp
+++ b/protocols/Steam/src/main.cpp
@@ -47,7 +47,7 @@ extern "C" int __declspec(dllexport) Load(void)
Proto_RegisterModule(&pd);
char iconName[100];
- mir_snprintf(iconName, SIZEOF(iconName), "%s_%s", MODULE, "gaming");
+ mir_snprintf(iconName, _countof(iconName), "%s_%s", MODULE, "gaming");
// extra statuses
HookEvent(ME_SKIN2_ICONSCHANGED, OnReloadIcons);
diff --git a/protocols/Steam/src/steam_avatars.cpp b/protocols/Steam/src/steam_avatars.cpp
index 63554fd630..bd3b14f60e 100644
--- a/protocols/Steam/src/steam_avatars.cpp
+++ b/protocols/Steam/src/steam_avatars.cpp
@@ -3,7 +3,7 @@
TCHAR* CSteamProto::GetAvatarFilePath(MCONTACT hContact)
{
TCHAR path[MAX_PATH];
- mir_sntprintf(path, SIZEOF(path), _T("%s\\%S"), VARST(_T("%miranda_avatarcache%")), m_szModuleName);
+ mir_sntprintf(path, _countof(path), _T("%s\\%S"), VARST(_T("%miranda_avatarcache%")), m_szModuleName);
DWORD dwAttributes = GetFileAttributes(path);
if (dwAttributes == 0xffffffff || (dwAttributes & FILE_ATTRIBUTE_DIRECTORY) == 0)
diff --git a/protocols/Steam/src/steam_contacts.cpp b/protocols/Steam/src/steam_contacts.cpp
index f9a6b0c0c0..4c87e79575 100644
--- a/protocols/Steam/src/steam_contacts.cpp
+++ b/protocols/Steam/src/steam_contacts.cpp
@@ -625,7 +625,7 @@ void CSteamProto::OnAuthRequested(const NETLIBHTTPREQUEST *response, void *arg)
lastName = mir_strdup("");
char reason[MAX_PATH];
- mir_snprintf(reason, SIZEOF(reason), Translate("%s has added you to his or her Friend List"), nickName);
+ mir_snprintf(reason, _countof(reason), Translate("%s has added you to his or her Friend List"), nickName);
// blob is: 0(DWORD), hContact(DWORD), nick(ASCIIZ), firstName(ASCIIZ), lastName(ASCIIZ), sid(ASCIIZ), reason(ASCIIZ)
DWORD cbBlob = (DWORD)(sizeof(DWORD)* 2 + mir_strlen(nickName) + mir_strlen(firstName) + mir_strlen(lastName) + mir_strlen(steamId) + mir_strlen(reason) + 5);
diff --git a/protocols/Steam/src/steam_dialogs.cpp b/protocols/Steam/src/steam_dialogs.cpp
index c804369dbb..3e768f982d 100644
--- a/protocols/Steam/src/steam_dialogs.cpp
+++ b/protocols/Steam/src/steam_dialogs.cpp
@@ -10,7 +10,7 @@ CSteamPasswordEditor::CSteamPasswordEditor(CSteamProto *proto) :
void CSteamPasswordEditor::OnInitDialog()
{
char iconName[100];
- mir_snprintf(iconName, SIZEOF(iconName), "%s_%s", MODULE, "main");
+ mir_snprintf(iconName, _countof(iconName), "%s_%s", MODULE, "main");
SendMessage(m_hwnd, WM_SETICON, ICON_BIG, (LPARAM)IcoLib_GetIcon(iconName, false));
SendMessage(m_hwnd, WM_SETICON, ICON_SMALL, (LPARAM)IcoLib_GetIcon(iconName, true));
@@ -48,7 +48,7 @@ CSteamGuardDialog::CSteamGuardDialog(CSteamProto *proto, const char *domain) :
void CSteamGuardDialog::OnInitDialog()
{
char iconName[100];
- mir_snprintf(iconName, SIZEOF(iconName), "%s_%s", MODULE, "main");
+ mir_snprintf(iconName, _countof(iconName), "%s_%s", MODULE, "main");
SendMessage(m_hwnd, WM_SETICON, ICON_BIG, (LPARAM)IcoLib_GetIcon(iconName, false));
SendMessage(m_hwnd, WM_SETICON, ICON_SMALL, (LPARAM)IcoLib_GetIcon(iconName, true));
@@ -59,7 +59,7 @@ void CSteamGuardDialog::OnInitDialog()
void CSteamGuardDialog::OnOk(CCtrlButton*)
{
- mir_strncpy(m_guardCode, ptrA(m_text.GetTextA()), SIZEOF(m_guardCode) + 1);
+ mir_strncpy(m_guardCode, ptrA(m_text.GetTextA()), _countof(m_guardCode) + 1);
EndDialog(m_hwnd, 1);
}
@@ -95,7 +95,7 @@ CSteamCaptchaDialog::~CSteamCaptchaDialog()
void CSteamCaptchaDialog::OnInitDialog()
{
char iconName[100];
- mir_snprintf(iconName, SIZEOF(iconName), "%s_%s", MODULE, "main");
+ mir_snprintf(iconName, _countof(iconName), "%s_%s", MODULE, "main");
SendMessage(m_hwnd, WM_SETICON, ICON_BIG, (LPARAM)IcoLib_GetIcon(iconName, false));
SendMessage(m_hwnd, WM_SETICON, ICON_SMALL, (LPARAM)IcoLib_GetIcon(iconName, true));
@@ -106,7 +106,7 @@ void CSteamCaptchaDialog::OnInitDialog()
void CSteamCaptchaDialog::OnOk(CCtrlButton*)
{
- mir_strncpy(m_captchaText, ptrA(m_text.GetTextA()), SIZEOF(m_captchaText) + 1);
+ mir_strncpy(m_captchaText, ptrA(m_text.GetTextA()), _countof(m_captchaText) + 1);
EndDialog(m_hwnd, 1);
}
diff --git a/protocols/Steam/src/steam_menus.cpp b/protocols/Steam/src/steam_menus.cpp
index 75c6db25e4..6e1f1b1658 100644
--- a/protocols/Steam/src/steam_menus.cpp
+++ b/protocols/Steam/src/steam_menus.cpp
@@ -45,7 +45,7 @@ int CSteamProto::JoinToGameCommand(WPARAM hContact, LPARAM)
{
char url[MAX_PATH];
DWORD gameId = getDword(hContact, "GameID", 0);
- mir_snprintf(url, SIZEOF(url), "steam://rungameid/%lu", gameId);
+ mir_snprintf(url, _countof(url), "steam://rungameid/%lu", gameId);
CallService(MS_UTILS_OPENURL, 0, (LPARAM)url);
return 0;
@@ -88,7 +88,7 @@ int CSteamProto::OnPrebuildContactMenu(WPARAM wParam, LPARAM)
int CSteamProto::PrebuildContactMenu(WPARAM wParam, LPARAM lParam)
{
- for (int i = 0; i < SIZEOF(CSteamProto::contactMenuItems); i++)
+ for (int i = 0; i < _countof(CSteamProto::contactMenuItems); i++)
Menu_ShowItem(CSteamProto::contactMenuItems[i], false);
CSteamProto* ppro = CSteamProto::GetContactProtoInstance((MCONTACT)wParam);
diff --git a/protocols/Steam/src/steam_proto.cpp b/protocols/Steam/src/steam_proto.cpp
index 9a36e5df52..c2e342e53f 100644
--- a/protocols/Steam/src/steam_proto.cpp
+++ b/protocols/Steam/src/steam_proto.cpp
@@ -19,10 +19,10 @@ CSteamProto::CSteamProto(const char* protoName, const TCHAR* userName) :
GetModuleFileName(g_hInstance, filePath, MAX_PATH);
wchar_t sectionName[100];
- mir_sntprintf(sectionName, SIZEOF(sectionName), _T("%s/%s"), LPGENT("Protocols"), LPGENT(MODULE));
+ mir_sntprintf(sectionName, _countof(sectionName), _T("%s/%s"), LPGENT("Protocols"), LPGENT(MODULE));
char settingName[100];
- mir_snprintf(settingName, SIZEOF(settingName), "%s_%s", MODULE, "main");
+ mir_snprintf(settingName, _countof(settingName), "%s_%s", MODULE, "main");
SKINICONDESC sid = { 0 };
sid.flags = SIDF_ALL_TCHAR;
@@ -33,7 +33,7 @@ CSteamProto::CSteamProto(const char* protoName, const TCHAR* userName) :
sid.iDefaultIndex = -IDI_STEAM;
IcoLib_AddIcon(&sid);
- mir_snprintf(settingName, SIZEOF(settingName), "%s_%s", MODULE, "gaming");
+ mir_snprintf(settingName, _countof(settingName), "%s_%s", MODULE, "gaming");
sid.description.t = LPGENT("Gaming icon");
sid.iDefaultIndex = -IDI_GAMING;
IcoLib_AddIcon(&sid);
@@ -64,7 +64,7 @@ CSteamProto::CSteamProto(const char* protoName, const TCHAR* userName) :
// netlib support
TCHAR name[128];
- mir_sntprintf(name, SIZEOF(name), TranslateT("%s connection"), m_tszUserName);
+ mir_sntprintf(name, _countof(name), TranslateT("%s connection"), m_tszUserName);
NETLIBUSER nlu = { sizeof(nlu) };
nlu.flags = NUF_INCOMING | NUF_OUTGOING | NUF_HTTPCONNS | NUF_TCHAR;
diff --git a/protocols/Steam/src/steam_xstatus.cpp b/protocols/Steam/src/steam_xstatus.cpp
index 74de926836..72a4a0e5b6 100644
--- a/protocols/Steam/src/steam_xstatus.cpp
+++ b/protocols/Steam/src/steam_xstatus.cpp
@@ -20,7 +20,7 @@ int CSteamProto::GetContactXStatus(MCONTACT hContact)
void SetContactExtraIcon(MCONTACT hContact, int status)
{
char iconName[100];
- mir_snprintf(iconName, SIZEOF(iconName), "%s_%s", MODULE, "gaming");
+ mir_snprintf(iconName, _countof(iconName), "%s_%s", MODULE, "gaming");
ExtraIcon_SetIcon(hExtraXStatus, hContact, (status > 0) ? IcoLib_GetIconHandle(iconName) : NULL);
}
@@ -96,7 +96,7 @@ HICON CSteamProto::GetXStatusIcon(int status, UINT flags)
return 0;
char iconName[100];
- mir_snprintf(iconName, SIZEOF(iconName), "%s_%s", MODULE, "gaming");
+ mir_snprintf(iconName, _countof(iconName), "%s_%s", MODULE, "gaming");
HICON icon = IcoLib_GetIcon(iconName, (flags & LR_BIGICON) != 0);
return (flags & LR_SHARED) ? icon : CopyIcon(icon);
diff --git a/protocols/Tlen/src/tlen.cpp b/protocols/Tlen/src/tlen.cpp
index 8ae89022a8..5667c73c3c 100644
--- a/protocols/Tlen/src/tlen.cpp
+++ b/protocols/Tlen/src/tlen.cpp
@@ -86,7 +86,7 @@ static IconItem iconList[] =
static 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;
@@ -108,7 +108,7 @@ void ReleaseIcolibIcon(HICON hIcon) {
static void TlenRegisterIcons()
{
- Icon_Register(hInst, "Protocols/Tlen", iconList, SIZEOF(iconList), "TLEN");
+ Icon_Register(hInst, "Protocols/Tlen", iconList, _countof(iconList), "TLEN");
}
int TlenProtocol::PrebuildContactMenu(WPARAM hContact, LPARAM lParam)
@@ -189,7 +189,7 @@ INT_PTR TlenProtocol::MenuHandleInbox(WPARAM wParam, LPARAM lParam)
memset(&cookie, 0, sizeof(cookie));
if (login != NULL && password != NULL) {
- mir_snprintf( form, SIZEOF(form), "username=%s&password=%s", login, password);
+ mir_snprintf( form, _countof(form), "username=%s&password=%s", login, password);
headers[0].szName = "Content-Type";
headers[0].szValue = "application/x-www-form-urlencoded";
memset(&req, 0, sizeof(req));
@@ -225,7 +225,7 @@ INT_PTR TlenProtocol::MenuHandleInbox(WPARAM wParam, LPARAM lParam)
}
mir_free(login);
mir_free(password);
- mir_snprintf(szFileName, SIZEOF(szFileName), "http://poczta.o2.pl/login.html?sid=%s", cookie);
+ mir_snprintf(szFileName, _countof(szFileName), "http://poczta.o2.pl/login.html?sid=%s", cookie);
CallService(MS_UTILS_OPENURL, OUF_NEWWINDOW, (LPARAM)szFileName);
return 0;
}
diff --git a/protocols/Tlen/src/tlen_advsearch.cpp b/protocols/Tlen/src/tlen_advsearch.cpp
index 1689a93173..aea0a806d0 100644
--- a/protocols/Tlen/src/tlen_advsearch.cpp
+++ b/protocols/Tlen/src/tlen_advsearch.cpp
@@ -61,7 +61,7 @@ static void FetchField(HWND hwndDlg, UINT idCtrl, char *fieldName, char **str, i
if (hwndDlg == NULL || fieldName == NULL || str == NULL || strSize == NULL)
return;
- GetDlgItemTextA(hwndDlg, idCtrl, text, SIZEOF(text));
+ GetDlgItemTextA(hwndDlg, idCtrl, text, _countof(text));
if (text[0]) {
if ((localFieldName=TlenTextEncode(fieldName)) != NULL) {
if ((localText=TlenTextEncode(text)) != NULL) {
diff --git a/protocols/Tlen/src/tlen_avatar.cpp b/protocols/Tlen/src/tlen_avatar.cpp
index e0722447a9..d548dc3c31 100644
--- a/protocols/Tlen/src/tlen_avatar.cpp
+++ b/protocols/Tlen/src/tlen_avatar.cpp
@@ -42,7 +42,7 @@ void TlenGetAvatarFileName(TlenProtocol *proto, TLEN_LIST_ITEM *item, TCHAR* pts
else {
proto->debugLog(_T("getAvatarFilename(): Can not create directory for avatar cache: %s. errno=%d: %s"), ptszDest, errno, strerror(errno));
TCHAR buffer[512];
- mir_sntprintf(buffer, SIZEOF(buffer), TranslateT("Cannot create avatars cache directory. ERROR: %d: %s\n%s"), errno, _tcserror(errno), ptszDest);
+ mir_sntprintf(buffer, _countof(buffer), TranslateT("Cannot create avatars cache directory. ERROR: %d: %s\n%s"), errno, _tcserror(errno), ptszDest);
PUShowMessageT(buffer, SM_WARNING);
}
}
@@ -69,7 +69,7 @@ static void RemoveAvatar(TlenProtocol *proto, MCONTACT hContact) {
if (hContact == NULL) {
proto->threadData->avatarHash[0] = '\0';
}
- TlenGetAvatarFileName( proto, NULL, tFileName, SIZEOF(tFileName)-1);
+ TlenGetAvatarFileName( proto, NULL, tFileName, _countof(tFileName)-1);
DeleteFile(tFileName);
db_unset(hContact, "ContactPhoto", "File");
db_unset(hContact, proto->m_szModuleName, "AvatarHash");
@@ -100,7 +100,7 @@ static void SetAvatar(TlenProtocol *proto, MCONTACT hContact, TLEN_LIST_ITEM *it
proto->threadData->avatarFormat = format;
mir_strcpy(proto->threadData->avatarHash, md5);
}
- TlenGetAvatarFileName(proto, item, filename, SIZEOF(filename)-1);
+ TlenGetAvatarFileName(proto, item, filename, _countof(filename)-1);
DeleteFile(filename);
FILE *out = _tfopen(filename, TEXT("wb") );
if (out != NULL) {
@@ -111,7 +111,7 @@ static void SetAvatar(TlenProtocol *proto, MCONTACT hContact, TLEN_LIST_ITEM *it
db_set_dw(hContact, proto->m_szModuleName, "AvatarFormat", format);
} else {
TCHAR buffer[128];
- mir_sntprintf(buffer, SIZEOF(buffer), TranslateT("Cannot save new avatar file \"%s\" Error:\n\t%s (Error: %d)"), filename, _tcserror(errno), errno);
+ mir_sntprintf(buffer, _countof(buffer), TranslateT("Cannot save new avatar file \"%s\" Error:\n\t%s (Error: %d)"), filename, _tcserror(errno), errno);
PUShowMessageT(buffer, SM_WARNING);
proto->debugLog(buffer);
return;
diff --git a/protocols/Tlen/src/tlen_file.cpp b/protocols/Tlen/src/tlen_file.cpp
index 4ab81e9819..2ed6d32e7e 100644
--- a/protocols/Tlen/src/tlen_file.cpp
+++ b/protocols/Tlen/src/tlen_file.cpp
@@ -558,7 +558,7 @@ void TlenProcessF(XmlNode *node, ThreadData *info)
char *from=TlenXmlGetAttrValue(node, "f");
if (from != NULL) {
if (strchr(from, '@') == NULL) {
- mir_snprintf(jid, SIZEOF(jid), "%s@%s", from, info->server);
+ mir_snprintf(jid, _countof(jid), "%s@%s", from, info->server);
} else {
strncpy_s(jid, from, _TRUNCATE);
}
@@ -585,7 +585,7 @@ void TlenProcessF(XmlNode *node, ThreadData *info)
}
}
else if (numFiles > 1) {
- mir_snprintf(szFilename, SIZEOF(szFilename), Translate("%d Files"), numFiles);
+ mir_snprintf(szFilename, _countof(szFilename), Translate("%d Files"), numFiles);
}
}
diff --git a/protocols/Tlen/src/tlen_iqid.cpp b/protocols/Tlen/src/tlen_iqid.cpp
index a6a7f39bd4..96b925d0b2 100644
--- a/protocols/Tlen/src/tlen_iqid.cpp
+++ b/protocols/Tlen/src/tlen_iqid.cpp
@@ -54,7 +54,7 @@ void TlenIqResultAuth(TlenProtocol *proto, XmlNode *iqNode)
char text[128];
TlenSend(proto, "</s>");
- mir_snprintf(text, SIZEOF(text), Translate("Authentication failed for %s@%s."), proto->threadData->username, proto->threadData->server);
+ mir_snprintf(text, _countof(text), Translate("Authentication failed for %s@%s."), proto->threadData->username, proto->threadData->server);
MessageBoxA(NULL, text, Translate("Tlen Authentication"), MB_OK|MB_ICONSTOP|MB_SETFOREGROUND);
ProtoBroadcastAck(proto->m_szModuleName, NULL, ACKTYPE_LOGIN, ACKRESULT_FAILED, NULL, LOGINERR_WRONGPASSWORD);
proto->threadData = NULL; // To disallow auto reconnect
@@ -260,7 +260,7 @@ void TlenIqResultVcard(TlenProtocol *proto, XmlNode *iqNode)
if (strchr(jid, '@') != NULL) {
strncpy_s(text, jid, _TRUNCATE);
} else {
- mir_snprintf(text, SIZEOF(text), "%s@%s", jid, dbv.pszVal); // Add @tlen.pl
+ mir_snprintf(text, _countof(text), "%s@%s", jid, dbv.pszVal); // Add @tlen.pl
}
db_free(&dbv);
if ((hContact=TlenHContactFromJID(proto, text)) == NULL) {
@@ -421,7 +421,7 @@ void TlenIqResultSearch(TlenProtocol *proto, XmlNode *iqNode)
if (strchr(jid, '@') != NULL) {
strncpy_s(jsr.jid, jid, _TRUNCATE);
} else {
- mir_snprintf(jsr.jid, SIZEOF(jsr.jid), "%s@%s", jid, dbv.pszVal);
+ mir_snprintf(jsr.jid, _countof(jsr.jid), "%s@%s", jid, dbv.pszVal);
}
jsr.jid[sizeof(jsr.jid)-1] = '\0';
jsr.hdr.id.t = mir_a2t(jid);
@@ -469,7 +469,7 @@ void TlenIqResultSearch(TlenProtocol *proto, XmlNode *iqNode)
if (strchr(proto->searchJID, '@') != NULL)
strncpy_s(jsr.jid, proto->searchJID, _TRUNCATE);
else
- mir_snprintf(jsr.jid, SIZEOF(jsr.jid), "%s@%s", proto->searchJID, dbv.pszVal);
+ mir_snprintf(jsr.jid, _countof(jsr.jid), "%s@%s", proto->searchJID, dbv.pszVal);
jsr.hdr.nick.t = jsr.hdr.firstName.t = jsr.hdr.lastName.t = jsr.hdr.email.t = jsr.hdr.id.t = TEXT("");
ProtoBroadcastAck(proto->m_szModuleName, NULL, ACKTYPE_SEARCH, ACKRESULT_DATA, (HANDLE) id, (LPARAM) &jsr);
diff --git a/protocols/Tlen/src/tlen_muc.cpp b/protocols/Tlen/src/tlen_muc.cpp
index 2b733f6285..1571b0d843 100644
--- a/protocols/Tlen/src/tlen_muc.cpp
+++ b/protocols/Tlen/src/tlen_muc.cpp
@@ -70,7 +70,7 @@ static char *getDisplayName(TlenProtocol *proto, const char *id)
MCONTACT hContact;
DBVARIANT dbv;
if (!db_get(NULL, proto->m_szModuleName, "LoginServer", &dbv)) {
- mir_snprintf(jid, SIZEOF(jid), "%s@%s", id, dbv.pszVal);
+ mir_snprintf(jid, _countof(jid), "%s@%s", id, dbv.pszVal);
db_free(&dbv);
if (((hContact=TlenHContactFromJID(proto, jid)) != NULL) || !mir_strcmp(id, proto->threadData->username)) {
CONTACTINFO ci = { sizeof(ci) };
@@ -107,7 +107,7 @@ int TlenMUCRecvInvitation(TlenProtocol *proto, const char *roomId, const char *r
char jid[256];
DBVARIANT dbv;
if (!db_get(NULL, proto->m_szModuleName, "LoginServer", &dbv)) {
- mir_snprintf(jid, SIZEOF(jid), "%s@%s", from, dbv.pszVal);
+ mir_snprintf(jid, _countof(jid), "%s@%s", from, dbv.pszVal);
db_free(&dbv);
} else {
mir_strcpy(jid, from);
@@ -119,7 +119,7 @@ int TlenMUCRecvInvitation(TlenProtocol *proto, const char *roomId, const char *r
TLEN_LIST_ITEM *item;
DBVARIANT dbv;
if (!db_get(NULL, proto->m_szModuleName, "LoginServer", &dbv)) {
- mir_snprintf(jid, SIZEOF(jid), "%s@%s", from, dbv.pszVal);
+ mir_snprintf(jid, _countof(jid), "%s@%s", from, dbv.pszVal);
db_free(&dbv);
} else {
mir_strcpy(jid, from);
@@ -190,7 +190,7 @@ static int TlenMUCSendQuery(TlenProtocol *proto, int type, const char *parent, i
if (type == 3) { // find chat room by name
char serialId[32];
TLEN_LIST_ITEM *item;
- mir_snprintf(serialId, SIZEOF(serialId), TLEN_IQID"%d", TlenSerialNext(proto));
+ mir_snprintf(serialId, _countof(serialId), TLEN_IQID"%d", TlenSerialNext(proto));
item = TlenListAdd(proto, LIST_SEARCH, serialId);
item->roomName = mir_strdup(parent);
TlenSend(proto, "<iq to='c' type='3' n='%s' id='%s'/>", parent, serialId);
@@ -236,7 +236,7 @@ INT_PTR TlenProtocol::MUCContactMenuHandleMUC(WPARAM wParam, LPARAM lParam)
if ((hContact=wParam) != NULL && isOnline) {
if (!db_get(hContact, m_szModuleName, "jid", &dbv)) {
char serialId[32];
- mir_snprintf(serialId, SIZEOF(serialId), TLEN_IQID"%d", TlenSerialNext(this));
+ mir_snprintf(serialId, _countof(serialId), TLEN_IQID"%d", TlenSerialNext(this));
item = TlenListAdd(this, LIST_INVITATIONS, serialId);
item->nick = mir_strdup(dbv.pszVal);
TlenSend(this, "<p to='c' tp='c' id='%s'/>", serialId);
diff --git a/protocols/Tlen/src/tlen_opt.cpp b/protocols/Tlen/src/tlen_opt.cpp
index 6442ecf019..42a58970fb 100644
--- a/protocols/Tlen/src/tlen_opt.cpp
+++ b/protocols/Tlen/src/tlen_opt.cpp
@@ -90,7 +90,7 @@ int TlenProtocol::OptionsInit(WPARAM wParam, LPARAM)
odp.ptszTitle = m_tszUserName;
odp.flags = ODPF_BOLDGROUPS | ODPF_TCHAR;
odp.dwInitParam = (LPARAM)this;
- 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.ptszTab = tabPages[i].tabName;
@@ -158,7 +158,7 @@ INT_PTR CALLBACK TlenAccMgrUIDlgProc(HWND hwndDlg, UINT msg, WPARAM wParam, LPAR
bool reconnectRequired = false;
DBVARIANT dbv;
- GetDlgItemTextA(hwndDlg, IDC_EDIT_USERNAME, text, SIZEOF(text));
+ GetDlgItemTextA(hwndDlg, IDC_EDIT_USERNAME, text, _countof(text));
if (db_get(NULL, proto->m_szModuleName, "LoginName", &dbv)) {
reconnectRequired = true;
}
@@ -170,7 +170,7 @@ INT_PTR CALLBACK TlenAccMgrUIDlgProc(HWND hwndDlg, UINT msg, WPARAM wParam, LPAR
db_set_s(NULL, proto->m_szModuleName, "LoginName", strlwr(text));
if (IsDlgButtonChecked(hwndDlg, IDC_SAVEPASSWORD)) {
- GetDlgItemTextA(hwndDlg, IDC_EDIT_PASSWORD, text, SIZEOF(text));
+ GetDlgItemTextA(hwndDlg, IDC_EDIT_PASSWORD, text, _countof(text));
if (db_get(NULL, proto->m_szModuleName, "Password", &dbv)) {
reconnectRequired = true;
}
@@ -302,7 +302,7 @@ static INT_PTR CALLBACK TlenBasicOptDlgProc(HWND hwndDlg, UINT msg, WPARAM wPara
bool reconnectRequired = false;
DBVARIANT dbv;
- GetDlgItemTextA(hwndDlg, IDC_EDIT_USERNAME, text, SIZEOF(text));
+ GetDlgItemTextA(hwndDlg, IDC_EDIT_USERNAME, text, _countof(text));
if (db_get(NULL, proto->m_szModuleName, "LoginName", &dbv)) {
reconnectRequired = true;
}
@@ -314,7 +314,7 @@ static INT_PTR CALLBACK TlenBasicOptDlgProc(HWND hwndDlg, UINT msg, WPARAM wPara
db_set_s(NULL, proto->m_szModuleName, "LoginName", strlwr(text));
if (IsDlgButtonChecked(hwndDlg, IDC_SAVEPASSWORD)) {
- GetDlgItemTextA(hwndDlg, IDC_EDIT_PASSWORD, text, SIZEOF(text));
+ GetDlgItemTextA(hwndDlg, IDC_EDIT_PASSWORD, text, _countof(text));
if (db_get(NULL, proto->m_szModuleName, "Password", &dbv)) {
reconnectRequired = true;
}
@@ -527,7 +527,7 @@ static INT_PTR CALLBACK TlenAdvOptDlgProc(HWND hwndDlg, UINT msg, WPARAM wParam,
bool reconnectRequired = false;
DBVARIANT dbv;
- GetDlgItemTextA(hwndDlg, IDC_EDIT_LOGIN_SERVER, text, SIZEOF(text));
+ GetDlgItemTextA(hwndDlg, IDC_EDIT_LOGIN_SERVER, text, _countof(text));
if (db_get(NULL, proto->m_szModuleName, "LoginServer", &dbv)) {
reconnectRequired = true;
}
@@ -538,7 +538,7 @@ static INT_PTR CALLBACK TlenAdvOptDlgProc(HWND hwndDlg, UINT msg, WPARAM wParam,
}
db_set_s(NULL, proto->m_szModuleName, "LoginServer", strlwr(text));
- GetDlgItemTextA(hwndDlg, IDC_HOST, text, SIZEOF(text));
+ GetDlgItemTextA(hwndDlg, IDC_HOST, text, _countof(text));
if (db_get(NULL, proto->m_szModuleName, "ManualHost", &dbv)) {
reconnectRequired = true;
}
@@ -568,16 +568,16 @@ static INT_PTR CALLBACK TlenAdvOptDlgProc(HWND hwndDlg, UINT msg, WPARAM wParam,
db_set_b(NULL, proto->m_szModuleName, "UseFileProxy", (BYTE) IsDlgButtonChecked(hwndDlg, IDC_FILE_USE_PROXY));
db_set_w(NULL, proto->m_szModuleName, "FileProxyType", (WORD) SendDlgItemMessage(hwndDlg, IDC_FILE_PROXY_TYPE, CB_GETCURSEL, 0, 0));
- GetDlgItemTextA(hwndDlg, IDC_FILE_PROXY_HOST, text, SIZEOF(text));
+ GetDlgItemTextA(hwndDlg, IDC_FILE_PROXY_HOST, text, _countof(text));
db_set_s(NULL, proto->m_szModuleName, "FileProxyHost", text);
db_set_w(NULL, proto->m_szModuleName, "FileProxyPort", (WORD) GetDlgItemInt(hwndDlg, IDC_FILE_PROXY_PORT, NULL, FALSE));
db_set_b(NULL, proto->m_szModuleName, "FileProxyAuth", (BYTE) IsDlgButtonChecked(hwndDlg, IDC_FILE_PROXY_USE_AUTH));
- GetDlgItemTextA(hwndDlg, IDC_FILE_PROXY_USER, text, SIZEOF(text));
+ GetDlgItemTextA(hwndDlg, IDC_FILE_PROXY_USER, text, _countof(text));
db_set_s(NULL, proto->m_szModuleName, "FileProxyUsername", text);
- GetDlgItemTextA(hwndDlg, IDC_FILE_PROXY_PASSWORD, text, SIZEOF(text));
+ GetDlgItemTextA(hwndDlg, IDC_FILE_PROXY_PASSWORD, text, _countof(text));
db_set_s(NULL, proto->m_szModuleName, "FileProxyPassword", text);
if (reconnectRequired && proto->isConnected)
@@ -656,7 +656,7 @@ static INT_PTR CALLBACK TlenPopupsDlgProc(HWND hwndDlg, UINT msg, WPARAM wParam,
} else {
delay=GetDlgItemInt(hwndDlg, IDC_DELAY, NULL, FALSE);
}
- mir_sntprintf(title, SIZEOF(title), TranslateT("%S mail"), proto->m_szModuleName);
+ mir_sntprintf(title, _countof(title), TranslateT("%S mail"), proto->m_szModuleName);
MailPopupPreview((DWORD) SendDlgItemMessage(hwndDlg,IDC_COLORBKG,CPM_GETCOLOUR,0,0),
(DWORD) SendDlgItemMessage(hwndDlg,IDC_COLORTXT,CPM_GETCOLOUR,0,0),
title,
diff --git a/protocols/Tlen/src/tlen_p2p_new.cpp b/protocols/Tlen/src/tlen_p2p_new.cpp
index 3234fa47f0..1313ee2521 100644
--- a/protocols/Tlen/src/tlen_p2p_new.cpp
+++ b/protocols/Tlen/src/tlen_p2p_new.cpp
@@ -183,7 +183,7 @@ void TlenBindUDPSocket(TLEN_FILE_TRANSFER *ft)
char host_name[256];
gethostname(host_name, sizeof(host_name));
hp = gethostbyname(host_name);
- mir_snprintf(host_name, SIZEOF(host_name), "%u.%u.%u.%u", (unsigned char)hp->h_addr_list[0][0],
+ mir_snprintf(host_name, _countof(host_name), "%u.%u.%u.%u", (unsigned char)hp->h_addr_list[0][0],
(unsigned char)hp->h_addr_list[0][1],
(unsigned char)hp->h_addr_list[0][2],
(unsigned char)hp->h_addr_list[0][3]);
@@ -257,7 +257,7 @@ void __cdecl TlenProcessP2P(XmlNode *node, ThreadData *info) {
if ((item=TlenListAdd(ft->proto, LIST_FILE, ft->iqId)) != NULL) {
char fileInfo[128];
item->ft = ft;
- mir_snprintf(fileInfo, SIZEOF(fileInfo), "%s file(s), %s bytes", c, s);
+ mir_snprintf(fileInfo, _countof(fileInfo), "%s file(s), %s bytes", c, s);
TCHAR* filenameT = mir_utf8decodeT((char*)fileInfo);
PROTORECVFILET pre = { 0 };
pre.dwFlags = PRFF_TCHAR;
diff --git a/protocols/Tlen/src/tlen_picture.cpp b/protocols/Tlen/src/tlen_picture.cpp
index ea3fb7e2bb..255c1b8e03 100644
--- a/protocols/Tlen/src/tlen_picture.cpp
+++ b/protocols/Tlen/src/tlen_picture.cpp
@@ -34,7 +34,7 @@ static void LogPictureMessage(TlenProtocol *proto, const char *jid, const char *
{
char message[1024];
const char *msg = isSent ? LPGEN("Image sent file://%s") : LPGEN("Image received file://%s");
- mir_snprintf(message, SIZEOF(message), Translate(msg), filename);
+ mir_snprintf(message, _countof(message), Translate(msg), filename);
TlenLogMessage(proto, TlenHContactFromJID(proto, jid), isSent ? DBEF_SENT : 0, message);
}
@@ -49,7 +49,7 @@ static void TlenPsPostThread(void *ptr) {
DWORD ret;
item->ft->s = socket;
item->ft->hFileEvent = CreateEvent(NULL, FALSE, FALSE, NULL);
- ret = mir_snprintf(header, SIZEOF(header), "<pic auth='%s' t='p' to='%s' size='%d' idt='%s'/>", proto->threadData->username, item->ft->jid, item->ft->fileTotalSize, item->jid);
+ ret = mir_snprintf(header, _countof(header), "<pic auth='%s' t='p' to='%s' size='%d' idt='%s'/>", proto->threadData->username, item->ft->jid, item->ft->fileTotalSize, item->jid);
TlenWsSend(proto, socket, header, (int)ret);
ret = WaitForSingleObject(item->ft->hFileEvent, 1000 * 60 * 5);
if (ret == WAIT_OBJECT_0) {
@@ -58,7 +58,7 @@ static void TlenPsPostThread(void *ptr) {
int i;
char header[512];
char fileBuffer[2048];
- i = mir_snprintf(header, SIZEOF(header), "<pic st='%s' idt='%s'/>", item->ft->iqId, item->jid);
+ i = mir_snprintf(header, _countof(header), "<pic st='%s' idt='%s'/>", item->ft->iqId, item->jid);
TlenWsSend(proto, socket, header, i);
proto->debugLogA("Sending picture data...");
for (i = item->ft->filesSize[0]; i > 0; ) {
@@ -114,7 +114,7 @@ static void TlenPsGetThread(void *ptr) {
char header[512];
char fileBuffer[2048];
TlenXmlInitState(&xmlState);
- int header_len = mir_snprintf(header, SIZEOF(header), "<pic auth='%s' t='g' to='%s' pid='1001' idt='%s' rt='%s'/>", proto->threadData->username, item->ft->jid, item->jid, item->ft->id2);
+ int header_len = mir_snprintf(header, _countof(header), "<pic auth='%s' t='g' to='%s' pid='1001' idt='%s' rt='%s'/>", proto->threadData->username, item->ft->jid, item->jid, item->ft->id2);
TlenWsSend(proto, socket, header, header_len);
proto->debugLogA("Reveiving picture data...");
{
@@ -221,7 +221,7 @@ void TlenProcessPic(XmlNode *node, TlenProtocol *proto) {
char fileName[MAX_PATH];
char *ext = TlenXmlGetAttrValue(node, "ext");
char *tmpPath = Utils_ReplaceVars( "%miranda_userdata%" );
- int tPathLen = mir_snprintf(fileName, SIZEOF(fileName), "%s\\Images\\Tlen", tmpPath);
+ int tPathLen = mir_snprintf(fileName, _countof(fileName), "%s\\Images\\Tlen", tmpPath);
long oldSize = 0, lSize = atol(size);
DWORD dwAttributes = GetFileAttributesA( fileName );
if ( dwAttributes == 0xffffffff || ( dwAttributes & FILE_ATTRIBUTE_DIRECTORY ) == 0 )
@@ -229,7 +229,7 @@ void TlenProcessPic(XmlNode *node, TlenProtocol *proto) {
mir_free(tmpPath);
fileName[ tPathLen++ ] = '\\';
- mir_snprintf( fileName + tPathLen, SIZEOF(fileName) - tPathLen, "%s.%s", crc, ext );
+ mir_snprintf( fileName + tPathLen, _countof(fileName) - tPathLen, "%s.%s", crc, ext );
fp = fopen( fileName, "rb" );
if (fp) {
fseek(fp, 0, SEEK_END);
@@ -260,7 +260,7 @@ BOOL SendPicture(TlenProtocol *proto, MCONTACT hContact) {
char *jid = dbv.pszVal;
TCHAR tszFilter[512], tszFileName[MAX_PATH];
- Bitmap_GetFilter(tszFilter, SIZEOF(tszFilter));
+ Bitmap_GetFilter(tszFilter, _countof(tszFilter));
tszFileName[0] = '\0';
OPENFILENAME ofn = {0};
@@ -285,7 +285,7 @@ BOOL SendPicture(TlenProtocol *proto, MCONTACT hContact) {
char fileBuffer[2048];
int id = TlenSerialNext(proto);
T2Utf szFileName(tszFileName);
- mir_snprintf(idStr, SIZEOF(idStr), "%d", id);
+ mir_snprintf(idStr, _countof(idStr), "%d", id);
item = TlenListAdd(proto, LIST_PICTURE, idStr);
item->ft = TlenFileCreateFT(proto, jid);
item->ft->files = (char **) mir_alloc(sizeof(char *));
diff --git a/protocols/Tlen/src/tlen_svc.cpp b/protocols/Tlen/src/tlen_svc.cpp
index 75dfe31c80..8fd1cb213d 100644
--- a/protocols/Tlen/src/tlen_svc.cpp
+++ b/protocols/Tlen/src/tlen_svc.cpp
@@ -684,7 +684,7 @@ INT_PTR TlenProtocol::GetAvatarInfo(WPARAM wParam, LPARAM lParam)
return GAIR_NOAVATAR;
if (avatarHash != NULL && !downloadingAvatar) {
- TlenGetAvatarFileName(this, item, pai->filename, SIZEOF(pai->filename)-1);
+ TlenGetAvatarFileName(this, item, pai->filename, _countof(pai->filename)-1);
pai->format = ( pai->hContact == NULL ) ? threadData->avatarFormat : item->avatarFormat;
return GAIR_SUCCESS;
}
@@ -800,7 +800,7 @@ HANDLE TlenProtocol::SendFile(MCONTACT hContact, const TCHAR* szDescription, TCH
db_free(&dbv);
int id = TlenSerialNext(this);
- mir_snprintf(idStr, SIZEOF(idStr), "%d", id);
+ mir_snprintf(idStr, _countof(idStr), "%d", id);
TLEN_LIST_ITEM *item = TlenListAdd(this, LIST_FILE, idStr);
if (item != NULL) {
ft->iqId = mir_strdup(idStr);
diff --git a/protocols/Tlen/src/tlen_thread.cpp b/protocols/Tlen/src/tlen_thread.cpp
index f6c86885b8..4c3c43769f 100644
--- a/protocols/Tlen/src/tlen_thread.cpp
+++ b/protocols/Tlen/src/tlen_thread.cpp
@@ -72,13 +72,13 @@ static INT_PTR CALLBACK TlenPasswordDlgProc(HWND hwndDlg, UINT msg, WPARAM wPara
switch (msg) {
case WM_INITDIALOG:
TranslateDialogDefault(hwndDlg);
- mir_snprintf(text, SIZEOF(text), Translate("Enter password for %s"), (char *) lParam);
+ mir_snprintf(text, _countof(text), Translate("Enter password for %s"), (char *) lParam);
SetDlgItemTextA(hwndDlg, IDC_JID, text);
return TRUE;
case WM_COMMAND:
switch (LOWORD(wParam)) {
case IDOK:
- GetDlgItemTextA(hwndDlg, IDC_PASSWORD, onlinePassword, SIZEOF(onlinePassword));
+ GetDlgItemTextA(hwndDlg, IDC_PASSWORD, onlinePassword, _countof(onlinePassword));
//EndDialog(hwndDlg, (int) onlinePassword);
//return TRUE;
// Fall through
@@ -207,7 +207,7 @@ void __cdecl TlenServerThread(ThreadData *info)
return;
}
- mir_snprintf(jidStr, SIZEOF(jidStr), "%s@%s", info->username, info->server);
+ mir_snprintf(jidStr, _countof(jidStr), "%s@%s", info->username, info->server);
db_set_s(NULL, info->proto->m_szModuleName, "jid", jidStr);
if (!db_get(NULL, info->proto->m_szModuleName, "ManualHost", &dbv)) {
@@ -402,7 +402,7 @@ static void TlenSendAuth(TlenProtocol *proto) {
int iqId;
char text[128];
char *str = TlenPasswordHash(proto->threadData->password);
- mir_snprintf(text, SIZEOF(text), "%s%s", proto->threadData->streamId, str);
+ mir_snprintf(text, _countof(text), "%s%s", proto->threadData->streamId, str);
mir_free(str);
str = TlenSha1(text);
char *p=TlenTextEncode(proto->threadData->username);
@@ -912,7 +912,7 @@ static void TlenProcessW(XmlNode *node, ThreadData *info)
char *f = TlenXmlGetAttrValue(node, "f");
if (f != NULL) {
char webContactName[128];
- mir_snprintf(webContactName, SIZEOF(webContactName), Translate("%s Web Messages"), info->proto->m_szModuleName);
+ mir_snprintf(webContactName, _countof(webContactName), Translate("%s Web Messages"), info->proto->m_szModuleName);
MCONTACT hContact = TlenHContactFromJID(info->proto, webContactName);
if (hContact == NULL) {
hContact = TlenDBCreateContact(info->proto, webContactName, webContactName, TRUE);
@@ -1198,7 +1198,7 @@ static void TlenProcessV(XmlNode *node, ThreadData *info)
char *from=TlenXmlGetAttrValue(node, "f");
if (from != NULL) {
if (strchr(from, '@') == NULL) {
- mir_snprintf(jid, SIZEOF(jid), "%s@%s", from, info->server);
+ mir_snprintf(jid, _countof(jid), "%s@%s", from, info->server);
} else {
strncpy_s(jid, from, _TRUNCATE);
}
diff --git a/protocols/Tlen/src/tlen_userinfo.cpp b/protocols/Tlen/src/tlen_userinfo.cpp
index 161bb926ae..3d1dc7c4e4 100644
--- a/protocols/Tlen/src/tlen_userinfo.cpp
+++ b/protocols/Tlen/src/tlen_userinfo.cpp
@@ -99,7 +99,7 @@ static void FetchField(HWND hwndDlg, UINT idCtrl, char *fieldName, char **str, i
if (hwndDlg == NULL || fieldName == NULL || str == NULL || strSize == NULL)
return;
- GetDlgItemTextA(hwndDlg, idCtrl, text, SIZEOF(text));
+ GetDlgItemTextA(hwndDlg, idCtrl, text, _countof(text));
if (text[0]) {
if ((localFieldName=TlenTextEncode(fieldName)) != NULL) {
if ((localText=TlenTextEncode(text)) != NULL) {
diff --git a/protocols/Tlen/src/tlen_voice.cpp b/protocols/Tlen/src/tlen_voice.cpp
index a08e906761..3842268777 100644
--- a/protocols/Tlen/src/tlen_voice.cpp
+++ b/protocols/Tlen/src/tlen_voice.cpp
@@ -493,7 +493,7 @@ static void TlenVoiceReceiveParse(TLEN_FILE_TRANSFER *ft)
}
{
char ttt[2048];
- mir_snprintf(ttt, SIZEOF(ttt), "%s %d %d ", statusTxt, ft->proto->framesAvailableForPlayback, ft->proto->availOverrunValue);
+ mir_snprintf(ttt, _countof(ttt), "%s %d %d ", statusTxt, ft->proto->framesAvailableForPlayback, ft->proto->availOverrunValue);
SetDlgItemTextA(ft->proto->voiceDlgHWND, IDC_STATUS, ttt);
}
TlenP2PPacketFree(packet);
@@ -683,7 +683,7 @@ INT_PTR TlenProtocol::VoiceContactMenuHandleVoice(WPARAM wParam, LPARAM lParam)
DBVARIANT dbv;
if (!db_get(hContact, m_szModuleName, "jid", &dbv)) {
char serialId[32];
- mir_snprintf(serialId, SIZEOF(serialId), "%d", TlenSerialNext(this));
+ mir_snprintf(serialId, _countof(serialId), "%d", TlenSerialNext(this));
TLEN_LIST_ITEM *item = TlenListAdd(this, LIST_VOICE, serialId);
if (item != NULL) {
TLEN_FILE_TRANSFER *ft = TlenFileCreateFT(this, dbv.pszVal);
@@ -931,7 +931,7 @@ static char *getDisplayName(TlenProtocol *proto, const char *id)
MCONTACT hContact;
DBVARIANT dbv;
if (!db_get(NULL, proto->m_szModuleName, "LoginServer", &dbv)) {
- mir_snprintf(jid, SIZEOF(jid), "%s@%s", id, dbv.pszVal);
+ mir_snprintf(jid, _countof(jid), "%s@%s", id, dbv.pszVal);
db_free(&dbv);
if ((hContact = TlenHContactFromJID(proto, jid)) != NULL)
return mir_strdup((char *)CallService(MS_CLIST_GETCONTACTDISPLAYNAME, hContact, 0));
@@ -1012,11 +1012,11 @@ int TlenVoiceAccept(TlenProtocol *proto, const char *id, const char *from)
char jid[256];
DBVARIANT dbv;
if (!db_get(NULL, proto->m_szModuleName, "LoginServer", &dbv)) {
- mir_snprintf(jid, SIZEOF(jid), "%s@%s", from, dbv.pszVal);
+ mir_snprintf(jid, _countof(jid), "%s@%s", from, dbv.pszVal);
db_free(&dbv);
}
else {
- strncpy(jid, from, SIZEOF(jid) - 1);
+ strncpy(jid, from, _countof(jid) - 1);
}
ignore = !IsAuthorized(proto, jid);
ask = true;
@@ -1025,11 +1025,11 @@ int TlenVoiceAccept(TlenProtocol *proto, const char *id, const char *from)
char jid[256];
DBVARIANT dbv;
if (!db_get(NULL, proto->m_szModuleName, "LoginServer", &dbv)) {
- mir_snprintf(jid, SIZEOF(jid), "%s@%s", from, dbv.pszVal);
+ mir_snprintf(jid, _countof(jid), "%s@%s", from, dbv.pszVal);
db_free(&dbv);
}
else {
- strncpy(jid, from, SIZEOF(jid) - 1);
+ strncpy(jid, from, _countof(jid) - 1);
}
ask = !IsAuthorized(proto, jid);
ignore = false;
diff --git a/protocols/Tlen/src/tlen_ws.cpp b/protocols/Tlen/src/tlen_ws.cpp
index 7e31aedd37..7db8152810 100644
--- a/protocols/Tlen/src/tlen_ws.cpp
+++ b/protocols/Tlen/src/tlen_ws.cpp
@@ -32,13 +32,13 @@ BOOL TlenWsInit(TlenProtocol *proto)
nlu.cbSize = sizeof(nlu);
nlu.flags = NUF_OUTGOING | NUF_INCOMING | NUF_HTTPCONNS | NUF_TCHAR; // | NUF_HTTPGATEWAY;
- mir_sntprintf(name, SIZEOF(name), TranslateT("%s connection"), proto->m_tszUserName);
+ mir_sntprintf(name, _countof(name), TranslateT("%s connection"), proto->m_tszUserName);
nlu.ptszDescriptiveName = name;
nlu.szSettingsModule = proto->m_szModuleName;
proto->m_hNetlibUser = (HANDLE) CallService(MS_NETLIB_REGISTERUSER, 0, (LPARAM) &nlu);
nlu.flags = NUF_OUTGOING | NUF_INCOMING | NUF_NOOPTIONS | NUF_TCHAR;
- mir_sntprintf(name, SIZEOF(name), TranslateT("%s SOCKS connection"), proto->m_tszUserName);
+ mir_sntprintf(name, _countof(name), TranslateT("%s SOCKS connection"), proto->m_tszUserName);
nlu.ptszDescriptiveName = name;
proto->hFileNetlibUser = (HANDLE) CallService(MS_NETLIB_REGISTERUSER, 0, (LPARAM) &nlu);
nlus.cbSize = sizeof(nlus);
diff --git a/protocols/Tox/src/tox_avatars.cpp b/protocols/Tox/src/tox_avatars.cpp
index c95ebad620..fada4ad92c 100644
--- a/protocols/Tox/src/tox_avatars.cpp
+++ b/protocols/Tox/src/tox_avatars.cpp
@@ -3,7 +3,7 @@
std::tstring CToxProto::GetAvatarFilePath(MCONTACT hContact)
{
TCHAR path[MAX_PATH];
- mir_sntprintf(path, SIZEOF(path), _T("%s\\%S"), VARST(_T("%miranda_avatarcache%")), m_szModuleName);
+ mir_sntprintf(path, _countof(path), _T("%s\\%S"), VARST(_T("%miranda_avatarcache%")), m_szModuleName);
DWORD dwAttributes = GetFileAttributes(path);
if (dwAttributes == 0xffffffff || (dwAttributes & FILE_ATTRIBUTE_DIRECTORY) == 0)
@@ -129,7 +129,7 @@ INT_PTR CToxProto::GetAvatarInfo(WPARAM, LPARAM lParam)
std::tstring path = GetAvatarFilePath(pai->hContact);
if (IsFileExists(path))
{
- mir_tstrncpy(pai->filename, path.c_str(), SIZEOF(pai->filename));
+ mir_tstrncpy(pai->filename, path.c_str(), _countof(pai->filename));
pai->format = PA_FORMAT_PNG;
return GAIR_SUCCESS;
@@ -224,7 +224,7 @@ void CToxProto::OnGotFriendAvatarInfo(AvatarTransferParam *transfer)
}
TCHAR path[MAX_PATH];
- mir_sntprintf(path, SIZEOF(path), _T("%s\\%S"), VARST(_T("%miranda_avatarcache%")), m_szModuleName);
+ mir_sntprintf(path, _countof(path), _T("%s\\%S"), VARST(_T("%miranda_avatarcache%")), m_szModuleName);
OnFileAllow(transfer->pfts.hContact, transfer, path);
}
diff --git a/protocols/Tox/src/tox_chatrooms.cpp b/protocols/Tox/src/tox_chatrooms.cpp
index 629d46c510..00145f635f 100644
--- a/protocols/Tox/src/tox_chatrooms.cpp
+++ b/protocols/Tox/src/tox_chatrooms.cpp
@@ -29,7 +29,7 @@ MCONTACT CToxProto::AddChatRoom(int groupNumber)
setWord(hContact, TOX_SETTINGS_CHAT_ID, groupNumber);
TCHAR title[MAX_PATH];
- mir_sntprintf(title, SIZEOF(title), _T("%s #%d"), TranslateT("Groupchat"), groupNumber);
+ mir_sntprintf(title, _countof(title), _T("%s #%d"), TranslateT("Groupchat"), groupNumber);
setTString(hContact, "Nick", title);
DBVARIANT dbv;
diff --git a/protocols/Tox/src/tox_icons.cpp b/protocols/Tox/src/tox_icons.cpp
index e1b00b2688..3bb4302513 100644
--- a/protocols/Tox/src/tox_icons.cpp
+++ b/protocols/Tox/src/tox_icons.cpp
@@ -23,10 +23,10 @@ void CToxProto::InitIcons()
sid.pszName = szSettingName;
sid.section.t = szSectionName;
- mir_sntprintf(szSectionName, SIZEOF(szSectionName), _T("%s/%s"), LPGENT("Protocols"), LPGENT(MODULE));
- for (int i = 0; i < SIZEOF(Icons); i++)
+ mir_sntprintf(szSectionName, _countof(szSectionName), _T("%s/%s"), LPGENT("Protocols"), LPGENT(MODULE));
+ for (int i = 0; i < _countof(Icons); i++)
{
- mir_snprintf(szSettingName, SIZEOF(szSettingName), "%s_%s", MODULE, Icons[i].Name);
+ mir_snprintf(szSettingName, _countof(szSettingName), "%s_%s", MODULE, Icons[i].Name);
sid.description.t = Icons[i].Description;
sid.iDefaultIndex = -Icons[i].IconId;
@@ -36,7 +36,7 @@ void CToxProto::InitIcons()
HICON CToxProto::GetIcon(const char *name, bool size)
{
- for (size_t i = 0; i < SIZEOF(Icons); i++)
+ for (size_t i = 0; i < _countof(Icons); i++)
if (mir_strcmpi(Icons[i].Name, name) == 0)
return IcoLib_GetIconByHandle(Icons[i].Handle, size);
@@ -45,7 +45,7 @@ HICON CToxProto::GetIcon(const char *name, bool size)
HANDLE CToxProto::GetIconHandle(const char *name)
{
- for (size_t i = 0; i < SIZEOF(Icons); i++)
+ for (size_t i = 0; i < _countof(Icons); i++)
if (mir_strcmpi(Icons[i].Name, name) == 0)
return Icons[i].Handle;
@@ -55,7 +55,7 @@ HANDLE CToxProto::GetIconHandle(const char *name)
HANDLE CToxProto::Skin_GetIconHandle(const char *name)
{
char iconName[100];
- mir_snprintf(iconName, SIZEOF(iconName), "%s_%s", MODULE, name);
+ mir_snprintf(iconName, _countof(iconName), "%s_%s", MODULE, name);
HANDLE hIcon = IcoLib_GetIconHandle(iconName);
if (hIcon == NULL)
hIcon = GetIconHandle(name);
@@ -65,6 +65,6 @@ HANDLE CToxProto::Skin_GetIconHandle(const char *name)
void CToxProto::UninitIcons()
{
- for (size_t i = 0; i < SIZEOF(Icons); i++)
+ for (size_t i = 0; i < _countof(Icons); i++)
IcoLib_RemoveIcon(Icons[i].Name);
} \ No newline at end of file
diff --git a/protocols/Tox/src/tox_menus.cpp b/protocols/Tox/src/tox_menus.cpp
index 914920eb9d..db4bd40ef1 100644
--- a/protocols/Tox/src/tox_menus.cpp
+++ b/protocols/Tox/src/tox_menus.cpp
@@ -29,7 +29,7 @@ int CToxProto::OnPrebuildContactMenu(WPARAM hContact, LPARAM)
int CToxProto::PrebuildContactMenu(WPARAM hContact, LPARAM lParam)
{
- for (int i = 0; i < SIZEOF(ContactMenuItems); i++)
+ for (int i = 0; i < _countof(ContactMenuItems); i++)
Menu_ShowItem(ContactMenuItems[i], FALSE);
CToxProto *proto = CToxProto::GetContactAccount(hContact);
return proto ? proto->OnPrebuildContactMenu(hContact, lParam) : 0;
diff --git a/protocols/Tox/src/tox_multimedia.cpp b/protocols/Tox/src/tox_multimedia.cpp
index e03e94b6d2..7fa7a9c7b8 100644
--- a/protocols/Tox/src/tox_multimedia.cpp
+++ b/protocols/Tox/src/tox_multimedia.cpp
@@ -27,7 +27,7 @@ INT_PTR CToxCallDlgBase::DlgProc(UINT msg, WPARAM wParam, LPARAM lParam)
void CToxCallDlgBase::SetIcon(const char *name)
{
char iconName[100];
- mir_snprintf(iconName, SIZEOF(iconName), "%s_%s", MODULE, name);
+ mir_snprintf(iconName, _countof(iconName), "%s_%s", MODULE, name);
SendMessage(m_hwnd, WM_SETICON, ICON_BIG, (LPARAM)IcoLib_GetIcon(iconName, false));
SendMessage(m_hwnd, WM_SETICON, ICON_SMALL, (LPARAM)IcoLib_GetIcon(iconName, true));
}
@@ -56,7 +56,7 @@ void CToxIncomingCall::OnInitDialog()
from.SetText(nick);
TCHAR title[MAX_PATH];
- mir_sntprintf(title, SIZEOF(title), TranslateT("Incoming call from %s"), nick);
+ mir_sntprintf(title, _countof(title), TranslateT("Incoming call from %s"), nick);
SetTitle(title);
SetIcon("audio_ring");
}
@@ -98,7 +98,7 @@ void CToxOutgoingCall::OnInitDialog()
to.SetText(nick);
TCHAR title[MAX_PATH];
- mir_sntprintf(title, SIZEOF(title), TranslateT("Outgoing call to %s"), nick);
+ mir_sntprintf(title, _countof(title), TranslateT("Outgoing call to %s"), nick);
SetTitle(title);
SetIcon("audio_end");
}
@@ -138,7 +138,7 @@ void CToxOutgoingCall::OnCall(CCtrlBase*)
char *message = NULL;
TCHAR title[MAX_PATH];
- if (GetWindowText(m_hwnd, title, SIZEOF(title)))
+ if (GetWindowText(m_hwnd, title, _countof(title)))
message = mir_utf8encodeT(title);
else
message = mir_utf8encode("Outgoing call");
@@ -191,7 +191,7 @@ ToxAvCSettings* CToxProto::GetAudioCSettings()
debugLogA(__FUNCTION__": failed to get input device caps (%d)", error);
TCHAR errorMessage[MAX_PATH];
- waveInGetErrorText(error, errorMessage, SIZEOF(errorMessage));
+ waveInGetErrorText(error, errorMessage, _countof(errorMessage));
CToxProto::ShowNotification(
TranslateT("Unable to find input audio device"),
errorMessage);
@@ -290,7 +290,7 @@ void CToxProto::OnAvInvite(void*, int32_t callId, void *arg)
}
TCHAR message[MAX_PATH];
- mir_sntprintf(message, SIZEOF(message), TranslateT("Incoming call from %s"), pcli->pfnGetContactDisplayName(hContact, 0));
+ mir_sntprintf(message, _countof(message), TranslateT("Incoming call from %s"), pcli->pfnGetContactDisplayName(hContact, 0));
T2Utf szMessage(message);
PROTORECVEVENT recv = { 0 };
@@ -317,7 +317,7 @@ INT_PTR CToxProto::OnRecvAudioCall(WPARAM hContact, LPARAM lParam)
cle.hIcon = IcoLib_GetIconByHandle(GetIconHandle("audio_ring"));
TCHAR szTooltip[MAX_PATH];
- mir_sntprintf(szTooltip, SIZEOF(szTooltip), TranslateT("Incoming call from %s"), pcli->pfnGetContactDisplayName(hContact, 0));
+ mir_sntprintf(szTooltip, _countof(szTooltip), TranslateT("Incoming call from %s"), pcli->pfnGetContactDisplayName(hContact, 0));
cle.ptszTooltip = szTooltip;
char szService[MAX_PATH];
@@ -488,7 +488,7 @@ void CToxProto::OnAvStart(void*, int32_t callId, void *arg)
toxav_hangup(proto->toxAv, callId);
TCHAR errorMessage[MAX_PATH];
- waveInGetErrorText(error, errorMessage, SIZEOF(errorMessage));
+ waveInGetErrorText(error, errorMessage, _countof(errorMessage));
CToxProto::ShowNotification(
TranslateT("Unable to find output audio device"),
errorMessage);
diff --git a/protocols/Tox/src/tox_netlib.cpp b/protocols/Tox/src/tox_netlib.cpp
index 697e89ffa4..b08bc7ddf9 100644
--- a/protocols/Tox/src/tox_netlib.cpp
+++ b/protocols/Tox/src/tox_netlib.cpp
@@ -3,7 +3,7 @@
void CToxProto::InitNetlib()
{
wchar_t name[128];
- mir_sntprintf(name, SIZEOF(name), TranslateT("%s connection"), m_tszUserName);
+ mir_sntprintf(name, _countof(name), TranslateT("%s connection"), m_tszUserName);
NETLIBUSER nlu = {0};
nlu.cbSize = sizeof(nlu);
diff --git a/protocols/Tox/src/tox_network.cpp b/protocols/Tox/src/tox_network.cpp
index 26958fbeef..e8fa7ef88d 100644
--- a/protocols/Tox/src/tox_network.cpp
+++ b/protocols/Tox/src/tox_network.cpp
@@ -20,7 +20,7 @@ void CToxProto::BootstrapNode(const char *address, int port, const char *hexKey)
void CToxProto::BootstrapNodesFromDb(bool isIPv6)
{
char module[MAX_PATH];
- mir_snprintf(module, SIZEOF(module), "%s_Nodes", m_szModuleName);
+ mir_snprintf(module, _countof(module), "%s_Nodes", m_szModuleName);
int nodeCount = db_get_w(NULL, module, TOX_SETTINGS_NODE_COUNT, 0);
if (nodeCount > 0)
{
@@ -52,21 +52,21 @@ void CToxProto::BootstrapNodesFromIni(bool isIPv6)
mir_strcpy(fileName, VARS(TOX_INI_PATH));
char *section, sections[MAX_PATH], value[MAX_PATH];
- GetPrivateProfileSectionNamesA(sections, SIZEOF(sections), fileName);
+ GetPrivateProfileSectionNamesA(sections, _countof(sections), fileName);
section = sections;
while (*section != NULL)
{
if (strstr(section, TOX_SETTINGS_NODE_PREFIX) == section)
{
- GetPrivateProfileStringA(section, "IPv4", NULL, value, SIZEOF(value), fileName);
+ GetPrivateProfileStringA(section, "IPv4", NULL, value, _countof(value), fileName);
ptrA address(mir_strdup(value));
int port = GetPrivateProfileIntA(section, "Port", 33445, fileName);
- GetPrivateProfileStringA(section, "PubKey", NULL, value, SIZEOF(value), fileName);
+ GetPrivateProfileStringA(section, "PubKey", NULL, value, _countof(value), fileName);
ptrA pubKey(mir_strdup(value));
BootstrapNode(address, port, pubKey);
if (isIPv6)
{
- GetPrivateProfileStringA(section, "IPv6", NULL, value, SIZEOF(value), fileName);
+ GetPrivateProfileStringA(section, "IPv6", NULL, value, _countof(value), fileName);
address = mir_strdup(value);
BootstrapNode(address, port, pubKey);
}
diff --git a/protocols/Tox/src/tox_options.cpp b/protocols/Tox/src/tox_options.cpp
index d5cc88a42c..2396638eca 100644
--- a/protocols/Tox/src/tox_options.cpp
+++ b/protocols/Tox/src/tox_options.cpp
@@ -109,7 +109,7 @@ void CToxOptionsMain::ProfileCreate_OnClick(CCtrlButton*)
void CToxOptionsMain::ProfileImport_OnClick(CCtrlButton*)
{
TCHAR filter[MAX_PATH];
- mir_sntprintf(filter, SIZEOF(filter), _T("%s(*.tox)%c*.tox%c%s(*.*)%c*.*%c%c"),
+ mir_sntprintf(filter, _countof(filter), _T("%s(*.tox)%c*.tox%c%s(*.*)%c*.*%c%c"),
TranslateT("Tox profile"), 0, 0, TranslateT("All files"), 0, 0, 0);
TCHAR profilePath[MAX_PATH] = { 0 };
@@ -141,11 +141,11 @@ void CToxOptionsMain::ProfileImport_OnClick(CCtrlButton*)
void CToxOptionsMain::ProfileExport_OnClick(CCtrlButton*)
{
TCHAR filter[MAX_PATH];
- mir_sntprintf(filter, SIZEOF(filter), _T("%s(*.tox)%c*.tox%c%c"),
+ mir_sntprintf(filter, _countof(filter), _T("%s(*.tox)%c*.tox%c%c"),
TranslateT("Tox profile"), 0, 0, 0);
TCHAR profilePath[MAX_PATH];
- mir_tstrncpy(profilePath, _T("tox_save.tox"), SIZEOF(profilePath));
+ mir_tstrncpy(profilePath, _T("tox_save.tox"), _countof(profilePath));
OPENFILENAME ofn = { sizeof(ofn) };
ofn.hwndOwner = m_hwnd;
@@ -195,7 +195,7 @@ CToxOptionsMultimedia::CToxOptionsMultimedia(CToxProto *proto)
bool CToxOptionsMultimedia::GetDeviceFullName(GUID guid, TCHAR *deviceName, DWORD deviceNameLength)
{
TCHAR registryKey[MAX_PATH];
- mir_sntprintf(registryKey, SIZEOF(registryKey), _T("System\\CurrentControlSet\\Control\\MediaCategories\\{%08X-%04X-%04X-%02X%02X-%02X%02X%02X%02X%02X%02X}"),
+ mir_sntprintf(registryKey, _countof(registryKey), _T("System\\CurrentControlSet\\Control\\MediaCategories\\{%08X-%04X-%04X-%02X%02X-%02X%02X%02X%02X%02X%02X}"),
guid.Data1, guid.Data2, guid.Data3, guid.Data4[0], guid.Data4[1], guid.Data4[2], guid.Data4[3], guid.Data4[4], guid.Data4[5], guid.Data4[6], guid.Data4[7]);
HKEY hKey;
@@ -220,7 +220,7 @@ void CToxOptionsMultimedia::OnInitDialog()
DWORD count = 0;
TCHAR deviceName[MAX_PATH];
- DWORD deviceNameLength = SIZEOF(deviceName);
+ DWORD deviceNameLength = _countof(deviceName);
WAVEINCAPS2 wic2;
count = waveInGetNumDevs();
@@ -401,22 +401,22 @@ void CToxOptionsNodeList::OnInitDialog()
mir_strcpy(fileName, VARS(TOX_INI_PATH));
char *section, sections[MAX_PATH], value[MAX_PATH];
- GetPrivateProfileSectionNamesA(sections, SIZEOF(sections), fileName);
+ GetPrivateProfileSectionNamesA(sections, _countof(sections), fileName);
section = sections;
while (*section != NULL)
{
if (strstr(section, TOX_SETTINGS_NODE_PREFIX) == section)
{
- GetPrivateProfileStringA(section, "IPv4", NULL, value, SIZEOF(value), fileName);
+ GetPrivateProfileStringA(section, "IPv4", NULL, value, _countof(value), fileName);
iItem = m_nodes.AddItem(mir_a2t(value), -1, NULL, 0);
- GetPrivateProfileStringA(section, "IPv6", NULL, value, SIZEOF(value), fileName);
+ GetPrivateProfileStringA(section, "IPv6", NULL, value, _countof(value), fileName);
m_nodes.SetItem(iItem, 1, mir_a2t(value));
- GetPrivateProfileStringA(section, "Port", NULL, value, SIZEOF(value), fileName);
+ GetPrivateProfileStringA(section, "Port", NULL, value, _countof(value), fileName);
m_nodes.SetItem(iItem, 2, mir_a2t(value));
- GetPrivateProfileStringA(section, "PubKey", NULL, value, SIZEOF(value), fileName);
+ GetPrivateProfileStringA(section, "PubKey", NULL, value, _countof(value), fileName);
m_nodes.SetItem(iItem, 3, mir_a2t(value));
}
section += mir_strlen(section) + 1;
@@ -424,7 +424,7 @@ void CToxOptionsNodeList::OnInitDialog()
}
char module[MAX_PATH], setting[MAX_PATH];
- mir_snprintf(module, SIZEOF(module), "%s_Nodes", m_proto->m_szModuleName);
+ mir_snprintf(module, _countof(module), "%s_Nodes", m_proto->m_szModuleName);
int nodeCount = db_get_w(NULL, module, TOX_SETTINGS_NODE_COUNT, 0);
for (int i = 0; i < nodeCount; i++)
{
@@ -530,7 +530,7 @@ void CToxOptionsNodeList::OnApply()
lvi.pszText = (TCHAR*)mir_alloc(MAX_PATH * sizeof(TCHAR));
char module[MAX_PATH];
- mir_snprintf(module, SIZEOF(module), "%s_Nodes", m_proto->m_szModuleName);
+ mir_snprintf(module, _countof(module), "%s_Nodes", m_proto->m_szModuleName);
int iItem = 0;
int itemCount = m_nodes.GetItemCount();
diff --git a/protocols/Tox/src/tox_profile.cpp b/protocols/Tox/src/tox_profile.cpp
index 4e2f450dfd..93fb9e9929 100644
--- a/protocols/Tox/src/tox_profile.cpp
+++ b/protocols/Tox/src/tox_profile.cpp
@@ -11,7 +11,7 @@ std::tstring CToxProto::GetToxProfilePath(const TCHAR *accountName)
{
TCHAR profilePath[MAX_PATH];
TCHAR profileRootPath[MAX_PATH];
- FoldersGetCustomPathT(hProfileFolderPath, profileRootPath, SIZEOF(profileRootPath), VARST(_T("%miranda_userdata%")));
+ FoldersGetCustomPathT(hProfileFolderPath, profileRootPath, _countof(profileRootPath), VARST(_T("%miranda_userdata%")));
mir_sntprintf(profilePath, MAX_PATH, _T("%s\\%s.tox"), profileRootPath, accountName);
return profilePath;
}
diff --git a/protocols/Tox/src/tox_search.cpp b/protocols/Tox/src/tox_search.cpp
index 43162c5f15..54e4e09665 100644
--- a/protocols/Tox/src/tox_search.cpp
+++ b/protocols/Tox/src/tox_search.cpp
@@ -73,15 +73,15 @@ void CToxProto::SearchByNameAsync(void *arg)
mir_strcpy(fileName, VARS(TOX_INI_PATH));
char *section, sections[MAX_PATH], value[TOX_PUBLIC_KEY_SIZE * 2];
- GetPrivateProfileSectionNamesA(sections, SIZEOF(sections), fileName);
+ GetPrivateProfileSectionNamesA(sections, _countof(sections), fileName);
section = sections;
while (*section != NULL)
{
if (strstr(section, "Dns_") == section)
{
- GetPrivateProfileStringA(section, "Domain", NULL, value, SIZEOF(value), fileName);
+ GetPrivateProfileStringA(section, "Domain", NULL, value, _countof(value), fileName);
ptrA dnsDomain(mir_strdup(value));
- GetPrivateProfileStringA(section, "PubKey", NULL, value, SIZEOF(value), fileName);
+ GetPrivateProfileStringA(section, "PubKey", NULL, value, _countof(value), fileName);
ToxBinAddress dnsPubKey = value;
if (domain == NULL || mir_strcmpi(domain, dnsDomain) == 0)
@@ -95,7 +95,7 @@ void CToxProto::SearchByNameAsync(void *arg)
{
dnsString[length] = 0;
char dnsQuery[MAX_PATH * 2];
- mir_snprintf(dnsQuery, SIZEOF(dnsQuery), "_%s._tox.%s", dnsString, dnsDomain);
+ mir_snprintf(dnsQuery, _countof(dnsQuery), "_%s._tox.%s", dnsString, dnsDomain);
ToxHexAddress address = ResolveToxAddressFromDns(dnsQuery);
if (!address.IsEmpty())
@@ -106,7 +106,7 @@ void CToxProto::SearchByNameAsync(void *arg)
psr.nick.a = mir_strdup(name);
char email[MAX_PATH];
- mir_snprintf(email, SIZEOF(email), "%s@%s", name, domain);
+ mir_snprintf(email, _countof(email), "%s@%s", name, domain);
psr.email.a = mir_strdup(email);
ProtoBroadcastAck(NULL, ACKTYPE_SEARCH, ACKRESULT_DATA, (HANDLE)1, (LPARAM)&psr);
@@ -123,7 +123,7 @@ void CToxProto::SearchByNameAsync(void *arg)
if (resolved == 0 && domain)
{
char dnsQuery[MAX_PATH];
- mir_snprintf(dnsQuery, SIZEOF(dnsQuery), "%s._tox.%s", name, domain);
+ mir_snprintf(dnsQuery, _countof(dnsQuery), "%s._tox.%s", name, domain);
ToxHexAddress address = ResolveToxAddressFromDns(dnsQuery);
if (!address.IsEmpty())
@@ -134,7 +134,7 @@ void CToxProto::SearchByNameAsync(void *arg)
psr.nick.a = mir_strdup(name);
char email[MAX_PATH];
- mir_snprintf(email, SIZEOF(email), "%s@%s", name, domain);
+ mir_snprintf(email, _countof(email), "%s@%s", name, domain);
psr.email.a = mir_strdup(email);
ProtoBroadcastAck(NULL, ACKTYPE_SEARCH, ACKRESULT_DATA, (HANDLE)1, (LPARAM)&psr);
@@ -184,7 +184,7 @@ HWND CToxProto::OnSearchAdvanced(HWND owner)
std::regex regex("^\\s*([A-Fa-f0-9]{76})\\s*$");
TCHAR text[MAX_PATH];
- GetDlgItemText(owner, IDC_SEARCH, text, SIZEOF(text));
+ GetDlgItemText(owner, IDC_SEARCH, text, _countof(text));
const std::string query = T2Utf(text);
if (std::regex_search(query, match, regex))
diff --git a/protocols/Tox/src/tox_transfer.cpp b/protocols/Tox/src/tox_transfer.cpp
index b2b0949237..b74ac1ca53 100644
--- a/protocols/Tox/src/tox_transfer.cpp
+++ b/protocols/Tox/src/tox_transfer.cpp
@@ -76,7 +76,7 @@ HANDLE CToxProto::OnFileAllow(MCONTACT hContact, HANDLE hTransfer, const TCHAR *
// stupid fix
TCHAR fullPath[MAX_PATH];
- mir_sntprintf(fullPath, SIZEOF(fullPath), _T("%s\\%s"), transfer->pfts.tszWorkingDir, transfer->pfts.tszCurrentFile);
+ mir_sntprintf(fullPath, _countof(fullPath), _T("%s\\%s"), transfer->pfts.tszWorkingDir, transfer->pfts.tszCurrentFile);
transfer->ChangeName(fullPath);
if (!ProtoBroadcastAck(hContact, ACKTYPE_FILE, ACKRESULT_FILERESUME, (HANDLE)transfer, (LPARAM)&transfer->pfts))
diff --git a/protocols/Twitter/src/connection.cpp b/protocols/Twitter/src/connection.cpp
index 5bb7e52b51..23d6e15e33 100644
--- a/protocols/Twitter/src/connection.cpp
+++ b/protocols/Twitter/src/connection.cpp
@@ -167,7 +167,7 @@ bool TwitterProto::NegotiateConnection()
// this looks like bad code.. can someone clean this up please? or confirm that it's ok
wchar_t buf[1024] = {};
- mir_snwprintf(buf, SIZEOF(buf), AuthorizeUrl.c_str(), oauthToken.c_str());
+ mir_snwprintf(buf, _countof(buf), AuthorizeUrl.c_str(), oauthToken.c_str());
debugLogW(_T("**NegotiateConnection - Launching %s"), buf);
ShellExecute(NULL, L"open", buf, NULL, NULL, SW_SHOWNORMAL);
diff --git a/protocols/Twitter/src/main.cpp b/protocols/Twitter/src/main.cpp
index 58bc371096..4a36d4412b 100644
--- a/protocols/Twitter/src/main.cpp
+++ b/protocols/Twitter/src/main.cpp
@@ -110,7 +110,7 @@ extern "C" int __declspec(dllexport) Load(void)
extern "C" int __declspec(dllexport) Unload(void)
{
UninitContactMenus();
- for (size_t i = 1; i < SIZEOF(g_hEvents); i++)
+ for (size_t i = 1; i < _countof(g_hEvents); i++)
UnhookEvent(g_hEvents[i]);
return 0;
diff --git a/protocols/Twitter/src/oauth.cpp b/protocols/Twitter/src/oauth.cpp
index b2d8aa4795..563e5fcbc5 100644
--- a/protocols/Twitter/src/oauth.cpp
+++ b/protocols/Twitter/src/oauth.cpp
@@ -90,7 +90,7 @@ wstring mir_twitter::UrlGetQuery(const wstring& url)
wchar_t buf[1024*4] = {};
components.lpszExtraInfo = buf;
- components.dwExtraInfoLength = SIZEOF(buf);
+ components.dwExtraInfoLength = _countof(buf);
BOOL crackUrlOk = InternetCrackUrl(url.c_str(), url.size(), 0, &components);
_ASSERTE(crackUrlOk);
@@ -308,7 +308,7 @@ wstring mir_twitter::OAuthNormalizeUrl(const wstring& url)
if (Compare(brokenURL[L"scheme"], L"http", false) && !(Compare(brokenURL[L"port"], L"80", false)) ||
(Compare(brokenURL[L"scheme"], L"https", false) && !(Compare(brokenURL[L"port"], L"443", false))))
{
- mir_snwprintf(port, SIZEOF(port), L":%s", brokenURL[L"port"]);
+ mir_snwprintf(port, _countof(port), L":%s", brokenURL[L"port"]);
}
// InternetCrackUrl includes ? and # elements in the path,
@@ -366,7 +366,7 @@ wstring mir_twitter::OAuthCreateNonce()
wstring nonce;
for (int i = 0; i <= 16; ++i)
- nonce += ALPHANUMERIC[rand() % (SIZEOF(ALPHANUMERIC) - 1)]; // don't count null terminator in array
+ nonce += ALPHANUMERIC[rand() % (_countof(ALPHANUMERIC) - 1)]; // don't count null terminator in array
return nonce;
}
@@ -378,7 +378,7 @@ wstring mir_twitter::OAuthCreateTimestamp()
_ASSERTE(utcNow != -1);
wchar_t buf[100] = {};
- mir_snwprintf(buf, SIZEOF(buf), L"%I64u", utcNow);
+ mir_snwprintf(buf, _countof(buf), L"%I64u", utcNow);
return buf;
}
diff --git a/protocols/Twitter/src/proto.cpp b/protocols/Twitter/src/proto.cpp
index 752a3f78a2..c9bd871c80 100644
--- a/protocols/Twitter/src/proto.cpp
+++ b/protocols/Twitter/src/proto.cpp
@@ -45,7 +45,7 @@ TwitterProto::TwitterProto(const char *proto_name, const TCHAR *username) :
// Initialize hotkeys
char text[512];
- mir_snprintf(text, SIZEOF(text), "%s/Tweet", m_szModuleName);
+ mir_snprintf(text, _countof(text), "%s/Tweet", m_szModuleName);
HOTKEYDESC hkd = { sizeof(hkd) };
hkd.pszName = text;
@@ -332,7 +332,7 @@ int TwitterProto::OnModulesLoaded(WPARAM, LPARAM)
// Create avatar network connection (TODO: probably remove this)
char module[512];
- mir_snprintf(module, SIZEOF(module), "%sAv", m_szModuleName);
+ mir_snprintf(module, _countof(module), "%sAv", m_szModuleName);
nlu.szSettingsModule = module;
mir_sntprintf(descr, TranslateT("%s avatar connection"), m_tszUserName);
nlu.ptszDescriptiveName = descr;
@@ -387,7 +387,7 @@ int TwitterProto::ShowPinDialog()
void TwitterProto::ShowPopup(const wchar_t *text, int Error)
{
POPUPDATAT popup = {};
- mir_sntprintf(popup.lptzContactName, SIZEOF(popup.lptzContactName), TranslateT("%s Protocol"), m_tszUserName);
+ mir_sntprintf(popup.lptzContactName, _countof(popup.lptzContactName), TranslateT("%s Protocol"), m_tszUserName);
wcsncpy_s(popup.lptzText, text, _TRUNCATE);
if (Error) {
@@ -405,8 +405,8 @@ void TwitterProto::ShowPopup(const wchar_t *text, int Error)
void TwitterProto::ShowPopup(const char *text, int Error)
{
POPUPDATAT popup = {};
- mir_sntprintf(popup.lptzContactName, SIZEOF(popup.lptzContactName), TranslateT("%s Protocol"), m_tszUserName);
- mbcs_to_tcs(CP_UTF8, text, popup.lptzText, SIZEOF(popup.lptzText));
+ mir_sntprintf(popup.lptzContactName, _countof(popup.lptzContactName), TranslateT("%s Protocol"), m_tszUserName);
+ mbcs_to_tcs(CP_UTF8, text, popup.lptzText, _countof(popup.lptzText));
if (Error) {
popup.iSeconds = -1;
popup.colorBack = 0x000000FF;
@@ -429,7 +429,7 @@ void TwitterProto::SendTweetWorker(void *p)
char *text = static_cast<char*>(p);
if (mir_strlen(text) > 140) { // looks like the chat max outgoing msg thing doesn't work, so i'll do it here.
TCHAR errorPopup[280];
- mir_sntprintf(errorPopup, SIZEOF(errorPopup), _T("Don't be crazy! Everyone knows the max tweet size is 140, and you're trying to fit %d chars in there?"), mir_strlen(text));
+ mir_sntprintf(errorPopup, _countof(errorPopup), _T("Don't be crazy! Everyone knows the max tweet size is 140, and you're trying to fit %d chars in there?"), mir_strlen(text));
ShowPopup(errorPopup, 1);
return;
}
@@ -462,7 +462,7 @@ void TwitterProto::UpdateSettings()
std::tstring TwitterProto::GetAvatarFolder()
{
TCHAR path[MAX_PATH];
- mir_sntprintf(path, SIZEOF(path), _T("%s\\%s"), VARST(_T("%miranda_avatarcache%")), m_tszUserName);
+ mir_sntprintf(path, _countof(path), _T("%s\\%s"), VARST(_T("%miranda_avatarcache%")), m_tszUserName);
return path;
}
diff --git a/protocols/Twitter/src/theme.cpp b/protocols/Twitter/src/theme.cpp
index 8dcf0c2069..71e6d0316b 100644
--- a/protocols/Twitter/src/theme.cpp
+++ b/protocols/Twitter/src/theme.cpp
@@ -31,18 +31,18 @@ static IconItem icons[] =
{ LPGEN("Visit Homepage"), "homepage", 0 },
};
-static HANDLE hIconLibItem[SIZEOF(icons)];
+static HANDLE hIconLibItem[_countof(icons)];
// TODO: uninit
void InitIcons(void)
{
- Icon_Register(g_hInstance, "Protocols/Twitter", icons, SIZEOF(icons), "Twitter");
- icons[SIZEOF(icons) - 1].hIcolib = Skin_GetIconHandle(SKINICON_EVENT_URL);
+ Icon_Register(g_hInstance, "Protocols/Twitter", icons, _countof(icons), "Twitter");
+ icons[_countof(icons) - 1].hIcolib = Skin_GetIconHandle(SKINICON_EVENT_URL);
}
HANDLE GetIconHandle(const char* name)
{
- for (size_t i = 0; i < SIZEOF(icons); i++)
+ for (size_t i = 0; i < _countof(icons); i++)
if (mir_strcmp(icons[i].szName, name) == 0)
return hIconLibItem[i];
@@ -106,16 +106,16 @@ void InitContactMenus()
void UninitContactMenus()
{
- for (size_t i = 0; i < SIZEOF(g_hMenuItems); i++)
+ for (size_t i = 0; i < _countof(g_hMenuItems); i++)
CallService(MO_REMOVEMENUITEM, (WPARAM)g_hMenuItems[i], 0);
UnhookEvent(g_hMenuEvts[0]);
- for (size_t i = 1; i < SIZEOF(g_hMenuEvts); i++)
+ for (size_t i = 1; i < _countof(g_hMenuEvts); i++)
DestroyServiceFunction(g_hMenuEvts[i]);
}
void ShowContactMenus(bool show)
{
- for (size_t i = 0; i < SIZEOF(g_hMenuItems); i++)
+ for (size_t i = 0; i < _countof(g_hMenuItems); i++)
Menu_ShowItem(g_hMenuItems[i], show);
}
diff --git a/protocols/Twitter/src/ui.cpp b/protocols/Twitter/src/ui.cpp
index c1575bd090..71dbb239c9 100644
--- a/protocols/Twitter/src/ui.cpp
+++ b/protocols/Twitter/src/ui.cpp
@@ -50,7 +50,7 @@ INT_PTR CALLBACK first_run_dialog(HWND hwndDlg, UINT msg, WPARAM wParam, LPARAM
db_free(&dbv);
}
- for (size_t i = 0; i < SIZEOF(sites); i++)
+ for (size_t i = 0; i < _countof(sites); i++)
SendDlgItemMessage(hwndDlg, IDC_SERVER, CB_ADDSTRING, 0, reinterpret_cast<LPARAM>(sites[i]));
if (!db_get_s(0, proto->ModuleName(), TWITTER_KEY_BASEURL, &dbv)) {
@@ -82,12 +82,12 @@ INT_PTR CALLBACK first_run_dialog(HWND hwndDlg, UINT msg, WPARAM wParam, LPARAM
char str[128];
TCHAR tstr[128];
- GetDlgItemTextA(hwndDlg, IDC_SERVER, str, SIZEOF(str) - 1);
+ GetDlgItemTextA(hwndDlg, IDC_SERVER, str, _countof(str) - 1);
if (str[mir_strlen(str) - 1] != '/')
- mir_strncat(str, "/", SIZEOF(str) - mir_strlen(str));
+ mir_strncat(str, "/", _countof(str) - mir_strlen(str));
db_set_s(0, proto->ModuleName(), TWITTER_KEY_BASEURL, str);
- GetDlgItemText(hwndDlg, IDC_GROUP, tstr, SIZEOF(tstr));
+ GetDlgItemText(hwndDlg, IDC_GROUP, tstr, _countof(tstr));
db_set_ts(0, proto->ModuleName(), TWITTER_KEY_GROUP, tstr);
return true;
@@ -113,7 +113,7 @@ INT_PTR CALLBACK tweet_proc(HWND hwndDlg, UINT msg, WPARAM wParam, LPARAM lParam
// Set window title
TCHAR title[512];
- mir_sntprintf(title, SIZEOF(title), _T("Send Tweet for %s"), proto->m_tszUserName);
+ mir_sntprintf(title, _countof(title), _T("Send Tweet for %s"), proto->m_tszUserName);
SetWindowText(hwndDlg, title);
return true;
@@ -122,7 +122,7 @@ INT_PTR CALLBACK tweet_proc(HWND hwndDlg, UINT msg, WPARAM wParam, LPARAM lParam
TCHAR msg[141];
proto = reinterpret_cast<TwitterProto*>(GetWindowLongPtr(hwndDlg, GWLP_USERDATA));
- GetDlgItemText(hwndDlg, IDC_TWEETMSG, msg, SIZEOF(msg));
+ GetDlgItemText(hwndDlg, IDC_TWEETMSG, msg, _countof(msg));
ShowWindow(hwndDlg, SW_HIDE);
char *narrow = mir_t2a_cp(msg, CP_UTF8);
@@ -147,7 +147,7 @@ INT_PTR CALLBACK tweet_proc(HWND hwndDlg, UINT msg, WPARAM wParam, LPARAM lParam
break;
case WM_SETREPLY:
char foo[512];
- mir_snprintf(foo, SIZEOF(foo), "@%s ", (char*)wParam);
+ mir_snprintf(foo, _countof(foo), "@%s ", (char*)wParam);
size_t len = mir_strlen(foo);
SetDlgItemTextA(hwndDlg, IDC_TWEETMSG, foo);
@@ -181,7 +181,7 @@ INT_PTR CALLBACK options_proc(HWND hwndDlg, UINT msg, WPARAM wParam, LPARAM lPar
CheckDlgButton(hwndDlg, IDC_CHATFEED, db_get_b(0, proto->ModuleName(), TWITTER_KEY_CHATFEED, 0) ? BST_CHECKED : BST_UNCHECKED);
- for (size_t i = 0; i < SIZEOF(sites); i++)
+ for (size_t i = 0; i < _countof(sites); i++)
SendDlgItemMessage(hwndDlg, IDC_BASEURL, CB_ADDSTRING, 0, reinterpret_cast<LPARAM>(sites[i]));
if (!db_get_s(0, proto->ModuleName(), TWITTER_KEY_BASEURL, &dbv)) {
@@ -191,7 +191,7 @@ INT_PTR CALLBACK options_proc(HWND hwndDlg, UINT msg, WPARAM wParam, LPARAM lPar
else SendDlgItemMessage(hwndDlg, IDC_BASEURL, CB_SETCURSEL, 0, 0);
char pollrate_str[32];
- mir_snprintf(pollrate_str, SIZEOF(pollrate_str), "%d", db_get_dw(0, proto->ModuleName(), TWITTER_KEY_POLLRATE, 80));
+ mir_snprintf(pollrate_str, _countof(pollrate_str), "%d", db_get_dw(0, proto->ModuleName(), TWITTER_KEY_POLLRATE, 80));
SetDlgItemTextA(hwndDlg, IDC_POLLRATE, pollrate_str);
CheckDlgButton(hwndDlg, IDC_TWEET_MSG, db_get_b(0, proto->ModuleName(), TWITTER_KEY_TWEET_TO_MSG, 0) ? BST_CHECKED : BST_UNCHECKED);
@@ -226,17 +226,17 @@ INT_PTR CALLBACK options_proc(HWND hwndDlg, UINT msg, WPARAM wParam, LPARAM lPar
proto = reinterpret_cast<TwitterProto*>(GetWindowLongPtr(hwndDlg, GWLP_USERDATA));
char str[128];
- GetDlgItemTextA(hwndDlg, IDC_UN, str, SIZEOF(str));
+ GetDlgItemTextA(hwndDlg, IDC_UN, str, _countof(str));
db_set_s(0, proto->ModuleName(), TWITTER_KEY_UN, str);
- GetDlgItemTextA(hwndDlg, IDC_BASEURL, str, SIZEOF(str) - 1);
+ GetDlgItemTextA(hwndDlg, IDC_BASEURL, str, _countof(str) - 1);
if (str[mir_strlen(str) - 1] != '/')
- mir_strncat(str, "/", SIZEOF(str) - mir_strlen(str));
+ mir_strncat(str, "/", _countof(str) - mir_strlen(str));
db_set_s(0, proto->ModuleName(), TWITTER_KEY_BASEURL, str);
db_set_b(0, proto->ModuleName(), TWITTER_KEY_CHATFEED, IsDlgButtonChecked(hwndDlg, IDC_CHATFEED) != 0);
- GetDlgItemTextA(hwndDlg, IDC_POLLRATE, str, SIZEOF(str));
+ GetDlgItemTextA(hwndDlg, IDC_POLLRATE, str, _countof(str));
int rate = atoi(str);
if (rate == 0)
rate = 80;
@@ -260,7 +260,7 @@ namespace popup_options
return -1;
else if (IsDlgButtonChecked(hwndDlg, IDC_TIMEOUT_CUSTOM)) {
char str[32];
- GetDlgItemTextA(hwndDlg, IDC_TIMEOUT, str, SIZEOF(str));
+ GetDlgItemTextA(hwndDlg, IDC_TIMEOUT, str, _countof(str));
return atoi(str);
}
else // Default checked (probably)
@@ -330,7 +330,7 @@ namespace popup_options
}
// Pick a random quote
- int q = rand() % SIZEOF(quotes);
+ int q = rand() % _countof(quotes);
_tcsncpy(popup.lptzContactName, quotes[q].name, MAX_CONTACTNAME);
_tcsncpy(popup.lptzText, quotes[q].text, MAX_SECONDLINE);
@@ -478,7 +478,7 @@ INT_PTR CALLBACK pin_proc(HWND hwndDlg, UINT msg, WPARAM wParam, LPARAM lParam)
proto = reinterpret_cast<TwitterProto*>(GetWindowLongPtr(hwndDlg, GWLP_USERDATA));
char str[128];
- GetDlgItemTextA(hwndDlg, IDC_PIN, str, SIZEOF(str));
+ GetDlgItemTextA(hwndDlg, IDC_PIN, str, _countof(str));
db_set_s(0, proto->ModuleName(), TWITTER_KEY_OAUTH_PIN, str);
EndDialog(hwndDlg, wParam);
diff --git a/protocols/VKontakte/src/misc.cpp b/protocols/VKontakte/src/misc.cpp
index 85c2c6cbb0..39bc02044a 100644
--- a/protocols/VKontakte/src/misc.cpp
+++ b/protocols/VKontakte/src/misc.cpp
@@ -55,9 +55,9 @@ bool tlstrstr(TCHAR* _s1, TCHAR* _s2)
TCHAR s1[1024], s2[1024];
_tcsncpy_s(s1, _s1, _TRUNCATE);
- CharLowerBuff(s1, SIZEOF(s1));
+ CharLowerBuff(s1, _countof(s1));
_tcsncpy_s(s2, _s2, _TRUNCATE);
- CharLowerBuff(s2, SIZEOF(s2));
+ CharLowerBuff(s2, _countof(s2));
return _tcsstr(s1, s2) != NULL;
}
@@ -82,12 +82,12 @@ static IconItem iconList[] =
void InitIcons()
{
- Icon_Register(hInst, LPGEN("Protocols")"/"LPGEN("VKontakte"), iconList, SIZEOF(iconList), "VKontakte");
+ Icon_Register(hInst, LPGEN("Protocols")"/"LPGEN("VKontakte"), iconList, _countof(iconList), "VKontakte");
}
HANDLE GetIconHandle(int iCommand)
{
- for (int i = 0; i < SIZEOF(iconList); i++)
+ for (int i = 0; i < _countof(iconList); i++)
if (iconList[i].defIconID == iCommand)
return iconList[i].hIcolib;
@@ -735,13 +735,13 @@ void CVkProto::SetSrmmReadStatus(MCONTACT hContact)
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);
StatusTextData st = { 0 };
st.cbSize = sizeof(st);
st.hIcon = IcoLib_GetIconByHandle(GetIconHandle(IDI_READMSG));
- mir_sntprintf(st.tszText, SIZEOF(st.tszText), TranslateT("Message read: %s"), ttime);
+ mir_sntprintf(st.tszText, _countof(st.tszText), TranslateT("Message read: %s"), ttime);
CallService(MS_MSG_SETSTATUSTEXT, (WPARAM)hContact, (LPARAM)&st);
}
@@ -756,7 +756,7 @@ char* CVkProto::GetStickerId(const char* Msg, int &stickerid)
if (tmpMsg)
iRes = sscanf(tmpMsg, "[sticker:%d]", &stickerid);
if (iRes == 1) {
- mir_snprintf(HeadMsg, SIZEOF(HeadMsg), "[sticker:%d]", stickerid);
+ mir_snprintf(HeadMsg, _countof(HeadMsg), "[sticker:%d]", stickerid);
size_t retLen = mir_strlen(HeadMsg);
if (retLen < mir_strlen(Msg)) {
CMStringA szMsg(Msg, int(mir_strlen(Msg) - mir_strlen(tmpMsg)));
@@ -834,7 +834,7 @@ CMString CVkProto::SpanVKNotificationType(CMString& tszType, VKObjType& vkFeedba
CMString tszRes;
vkFeedback = vkParent = vkNull;
- for (int i = 0; i < SIZEOF(vkNotification); i++)
+ for (int i = 0; i < _countof(vkNotification); i++)
if (tszType == vkNotification[i].ptszType) {
vkFeedback = vkNotification[i].vkFeedback;
vkParent = vkNotification[i].vkParent;
@@ -852,7 +852,7 @@ CMString CVkProto::GetVkPhotoItem(const JSONNode &jnPhoto, BBCSupport iBBC)
return tszRes;
CMString tszLink, tszPreviewLink;
- for (int i = 0; i < SIZEOF(szImageTypes); i++) {
+ for (int i = 0; i < _countof(szImageTypes); i++) {
const JSONNode &n = jnPhoto[szImageTypes[i]];
if (!n.isnull()) {
tszLink = n.as_mstring();
@@ -922,7 +922,7 @@ CMString CVkProto::SetBBCString(LPCTSTR ptszString, BBCSupport iBBC, VKBBCType b
return CMString();
TCHAR *ptszFormat = NULL;
- for (int i = 0; i < SIZEOF(bbcItem); i++)
+ for (int i = 0; i < _countof(bbcItem); i++)
if (bbcItem[i].vkBBCType == bbcType && bbcItem[i].vkBBCSettings == iBBC) {
ptszFormat = bbcItem[i].ptszTempate;
break;
@@ -1059,7 +1059,7 @@ CMString CVkProto::GetAttachmentDescr(const JSONNode &jnAttachments, BBCSupport
}
else {
CMString tszLink;
- for (int i = 0; i < SIZEOF(szImageTypes); i++) {
+ for (int i = 0; i < _countof(szImageTypes); i++) {
const JSONNode &n = jnSticker[szImageTypes[i]];
if (!n.isnull()) {
tszLink = n.as_mstring();
@@ -1097,7 +1097,7 @@ CMString CVkProto::GetAttachmentDescr(const JSONNode &jnAttachments, BBCSupport
continue;
CMString tszLink;
- for (int i = 0; i < SIZEOF(szGiftTypes); i++) {
+ for (int i = 0; i < _countof(szGiftTypes); i++) {
const JSONNode &n = jnGift[szGiftTypes[i]];
if (!n.isnull()) {
tszLink = n.as_mstring();
@@ -1146,7 +1146,7 @@ CMString CVkProto::GetFwdMessages(const JSONNode &jnMessages, BBCSupport iBBC)
time_t datetime = (time_t)jnMsg["date"].as_int();
TCHAR ttime[64];
_locale_t locale = _create_locale(LC_ALL, "");
- _tcsftime_l(ttime, SIZEOF(ttime), _T("%x %X"), localtime(&datetime), locale);
+ _tcsftime_l(ttime, _countof(ttime), _T("%x %X"), localtime(&datetime), locale);
_free_locale(locale);
CMString tszBody(jnMsg["body"].as_mstring());
diff --git a/protocols/VKontakte/src/vk_avatars.cpp b/protocols/VKontakte/src/vk_avatars.cpp
index ef54de209f..85e97f9906 100644
--- a/protocols/VKontakte/src/vk_avatars.cpp
+++ b/protocols/VKontakte/src/vk_avatars.cpp
@@ -23,7 +23,7 @@ void CVkProto::OnReceiveAvatar(NETLIBHTTPREQUEST *reply, AsyncHttpRequest* pReq)
return;
PROTO_AVATAR_INFORMATION ai = { 0 };
- GetAvatarFileName((MCONTACT)pReq->pUserInfo, ai.filename, SIZEOF(ai.filename));
+ GetAvatarFileName((MCONTACT)pReq->pUserInfo, ai.filename, _countof(ai.filename));
ai.format = ProtoGetBufferFormat(reply->pData);
FILE *out = _tfopen(ai.filename, _T("wb"));
@@ -80,8 +80,8 @@ INT_PTR CVkProto::SvcGetAvatarInfo(WPARAM, LPARAM lParam)
return GAIR_NOAVATAR;
TCHAR tszFileName[MAX_PATH];
- GetAvatarFileName(pai->hContact, tszFileName, SIZEOF(tszFileName));
- _tcsncpy(pai->filename, tszFileName, SIZEOF(pai->filename));
+ GetAvatarFileName(pai->hContact, tszFileName, _countof(tszFileName));
+ _tcsncpy(pai->filename, tszFileName, _countof(pai->filename));
pai->format = ProtoGetAvatarFormat(pai->filename);
@@ -160,7 +160,7 @@ void CVkProto::SetAvatarUrl(MCONTACT hContact, CMString &tszUrl)
setByte(hContact,"NeedNewAvatar", 1);
PROTO_AVATAR_INFORMATION ai = { 0 };
ai.hContact = hContact;
- GetAvatarFileName(ai.hContact, ai.filename, SIZEOF(ai.filename));
+ GetAvatarFileName(ai.hContact, ai.filename, _countof(ai.filename));
ai.format = ProtoGetAvatarFormat(ai.filename);
ProtoBroadcastAck(hContact, ACKTYPE_AVATAR, ACKRESULT_SUCCESS, (HANDLE)&ai, 0);
}
diff --git a/protocols/VKontakte/src/vk_captcha.cpp b/protocols/VKontakte/src/vk_captcha.cpp
index 0c0699900a..ede03c51e2 100644
--- a/protocols/VKontakte/src/vk_captcha.cpp
+++ b/protocols/VKontakte/src/vk_captcha.cpp
@@ -80,7 +80,7 @@ static INT_PTR CALLBACK CaptchaFormDlgProc(HWND hwndDlg, UINT msg, WPARAM wParam
return TRUE;
case IDOK:
- GetDlgItemTextA(hwndDlg, IDC_VALUE, params->Result, SIZEOF(params->Result));
+ GetDlgItemTextA(hwndDlg, IDC_VALUE, params->Result, _countof(params->Result));
EndDialog(hwndDlg, 1);
return TRUE;
}
diff --git a/protocols/VKontakte/src/vk_chats.cpp b/protocols/VKontakte/src/vk_chats.cpp
index 2021f0ee12..5b8b7f7b0f 100644
--- a/protocols/VKontakte/src/vk_chats.cpp
+++ b/protocols/VKontakte/src/vk_chats.cpp
@@ -73,7 +73,7 @@ CVkChatInfo* CVkProto::AppendChat(int id, const JSONNode &jnDlg)
GCDEST gcd = { m_szModuleName, sid, GC_EVENT_ADDGROUP };
GCEVENT gce = { sizeof(gce), &gcd };
- for (int i = SIZEOF(sttStatuses)-1; i >= 0; i--) {
+ for (int i = _countof(sttStatuses)-1; i >= 0; i--) {
gce.ptszStatus = TranslateTS(sttStatuses[i]);
CallServiceSync(MS_GC_EVENT, NULL, (LPARAM)&gce);
}
@@ -839,11 +839,11 @@ int CVkProto::OnGcMenuHook(WPARAM, LPARAM lParam)
return 0;
if (gcmi->Type == MENU_ON_LOG) {
- gcmi->nItems = SIZEOF(sttLogListItems);
+ gcmi->nItems = _countof(sttLogListItems);
gcmi->Item = sttLogListItems;
}
else if (gcmi->Type == MENU_ON_NICKLIST) {
- gcmi->nItems = SIZEOF(sttListItems);
+ gcmi->nItems = _countof(sttListItems);
gcmi->Item = sttListItems;
}
return 0;
@@ -922,7 +922,7 @@ static INT_PTR CALLBACK GcCreateDlgProc(HWND hwndDlg, UINT msg, WPARAM wParam, L
}
TCHAR tszTitle[1024];
- GetDlgItemText(hwndDlg, IDC_TITLE, tszTitle, SIZEOF(tszTitle));
+ GetDlgItemText(hwndDlg, IDC_TITLE, tszTitle, _countof(tszTitle));
ppro->CreateNewChat(uids, tszTitle);
EndDialog(hwndDlg, 0);
return TRUE;
diff --git a/protocols/VKontakte/src/vk_options.cpp b/protocols/VKontakte/src/vk_options.cpp
index 960dfe70d5..98a7e633aa 100644
--- a/protocols/VKontakte/src/vk_options.cpp
+++ b/protocols/VKontakte/src/vk_options.cpp
@@ -63,10 +63,10 @@ INT_PTR CALLBACK VKAccountProc(HWND hwndDlg, UINT uMsg, WPARAM wParam, LPARAM lP
switch (((LPNMHDR)lParam)->code) {
case PSN_APPLY:
TCHAR str[1025];
- GetDlgItemText(hwndDlg, IDC_LOGIN, str, SIZEOF(str));
+ GetDlgItemText(hwndDlg, IDC_LOGIN, str, _countof(str));
ppro->setTString("Login", str);
- GetDlgItemText(hwndDlg, IDC_PASSWORD, str, SIZEOF(str));
+ GetDlgItemText(hwndDlg, IDC_PASSWORD, str, _countof(str));
T2Utf szRawPasswd(str);
if (szRawPasswd != NULL)
ppro->setString("Password", szRawPasswd);
@@ -170,16 +170,16 @@ INT_PTR CALLBACK CVkProto::OptionsProc(HWND hwndDlg, UINT uMsg, WPARAM wParam, L
case WM_NOTIFY:
if (((LPNMHDR)lParam)->code == PSN_APPLY) {
TCHAR str[1025];
- GetDlgItemText(hwndDlg, IDC_LOGIN, str, SIZEOF(str));
+ GetDlgItemText(hwndDlg, IDC_LOGIN, str, _countof(str));
ppro->setTString("Login", str);
- GetDlgItemText(hwndDlg, IDC_GROUPNAME, str, SIZEOF(str));
+ GetDlgItemText(hwndDlg, IDC_GROUPNAME, str, _countof(str));
if (mir_tstrcmp(ppro->getGroup(), str)) {
ppro->setGroup(str);
ppro->setTString("ProtoGroup", str);
}
- GetDlgItemText(hwndDlg, IDC_PASSWORD, str, SIZEOF(str));
+ GetDlgItemText(hwndDlg, IDC_PASSWORD, str, _countof(str));
T2Utf szRawPasswd(str);
if (szRawPasswd != NULL)
ppro->setString("Password", szRawPasswd);
@@ -330,7 +330,7 @@ INT_PTR CALLBACK CVkProto::OptionsAdvProc(HWND hwndDlg, UINT uMsg, WPARAM wParam
db_set_b(NULL, "ListeningTo", szListeningTo, ppro->m_iMusicSendMetod == 0 ? 0 : 1);
TCHAR buffer[5] = { 0 };
- GetDlgItemText(hwndDlg, IDC_ED_INT_INVIS, buffer, SIZEOF(buffer));
+ GetDlgItemText(hwndDlg, IDC_ED_INT_INVIS, buffer, _countof(buffer));
ppro->setDword("InvisibleInterval", ppro->m_iInvisibleInterval = _ttoi(buffer));
}
break;
@@ -494,10 +494,10 @@ INT_PTR CALLBACK CVkProto::OptionsFeedsProc(HWND hwndDlg, UINT uMsg, WPARAM wPar
ppro->setByte("NotificationFilterInvites", ppro->m_bNotificationFilterInvites);
TCHAR buffer[5] = { 0 };
- GetDlgItemText(hwndDlg, IDC_ED_INT_NEWS, buffer, SIZEOF(buffer));
+ GetDlgItemText(hwndDlg, IDC_ED_INT_NEWS, buffer, _countof(buffer));
ppro->setDword("NewsInterval", ppro->m_iNewsInterval = _ttoi(buffer));
- GetDlgItemText(hwndDlg, IDC_ED_INT_NOTIF, buffer, SIZEOF(buffer));
+ GetDlgItemText(hwndDlg, IDC_ED_INT_NOTIF, buffer, _countof(buffer));
ppro->setDword("NotificationsInterval", ppro->m_iNotificationsInterval = _ttoi(buffer));
}
diff --git a/protocols/VKontakte/src/vk_proto.cpp b/protocols/VKontakte/src/vk_proto.cpp
index 45b1bc47cf..b0945d5525 100644
--- a/protocols/VKontakte/src/vk_proto.cpp
+++ b/protocols/VKontakte/src/vk_proto.cpp
@@ -148,7 +148,7 @@ int CVkProto::OnModulesLoaded(WPARAM, LPARAM)
GCREGISTER gcr = { sizeof(gcr) };
gcr.ptszDispName = m_tszUserName;
gcr.pszModule = m_szModuleName;
- gcr.nColors = SIZEOF(sttColors);
+ gcr.nColors = _countof(sttColors);
gcr.pColors = sttColors;
CallServiceSync(MS_GC_REGISTER, NULL, (LPARAM)&gcr);
CreateProtoService(PS_LEAVECHAT, &CVkProto::OnLeaveChat);
diff --git a/protocols/VKontakte/src/vk_search.cpp b/protocols/VKontakte/src/vk_search.cpp
index 82b806c287..957da57c42 100644
--- a/protocols/VKontakte/src/vk_search.cpp
+++ b/protocols/VKontakte/src/vk_search.cpp
@@ -71,7 +71,7 @@ void __cdecl CVkProto::SearchThread(void* p)
PROTOSEARCHBYNAME *pParam = (PROTOSEARCHBYNAME *)p;
TCHAR arg[200];
- mir_sntprintf(arg, SIZEOF(arg), _T("%s %s %s"), pParam->pszFirstName, pParam->pszNick, pParam->pszLastName);
+ mir_sntprintf(arg, _countof(arg), _T("%s %s %s"), pParam->pszFirstName, pParam->pszNick, pParam->pszLastName);
debugLog(_T("CVkProto::SearchThread %s"), arg);
if (!IsOnline())
return;
diff --git a/protocols/VKontakte/src/vk_wallpost.cpp b/protocols/VKontakte/src/vk_wallpost.cpp
index 585cf1738d..e46aec3d77 100644
--- a/protocols/VKontakte/src/vk_wallpost.cpp
+++ b/protocols/VKontakte/src/vk_wallpost.cpp
@@ -63,8 +63,8 @@ static INT_PTR CALLBACK WallPostFormDlgProc(HWND hwndDlg, UINT msg, WPARAM wPara
case IDOK:
TCHAR tszMsg[4096], tszUrl[4096];
- GetDlgItemText(hwndDlg, IDC_ED_MSG, tszMsg, SIZEOF(tszMsg));
- GetDlgItemText(hwndDlg, IDC_ED_URL, tszUrl, SIZEOF(tszUrl));
+ GetDlgItemText(hwndDlg, IDC_ED_MSG, tszMsg, _countof(tszMsg));
+ GetDlgItemText(hwndDlg, IDC_ED_URL, tszUrl, _countof(tszUrl));
if (IsEmpty(tszMsg) && IsEmpty(tszUrl)) {
SetDlgItemText(hwndDlg, IDC_ST_WARNING, TranslateT("Attention! Message body or url should not be empty!"));
diff --git a/protocols/WhatsApp/src/avatars.cpp b/protocols/WhatsApp/src/avatars.cpp
index 22266ae931..43016048ee 100644
--- a/protocols/WhatsApp/src/avatars.cpp
+++ b/protocols/WhatsApp/src/avatars.cpp
@@ -102,8 +102,8 @@ int WhatsAppProto::InternalSetAvatar(MCONTACT hContact, const char *szJid, const
TCHAR tszTempFile[MAX_PATH], tszMyFile[MAX_PATH];
if (hContact == NULL) {
- mir_sntprintf(tszMyFile, SIZEOF(tszMyFile), _T("%s\\myavatar.jpg"), m_tszAvatarFolder.c_str());
- mir_sntprintf(tszTempFile, SIZEOF(tszTempFile), _T("%s\\myavatar.preview.jpg"), m_tszAvatarFolder.c_str());
+ mir_sntprintf(tszMyFile, _countof(tszMyFile), _T("%s\\myavatar.jpg"), m_tszAvatarFolder.c_str());
+ mir_sntprintf(tszTempFile, _countof(tszTempFile), _T("%s\\myavatar.preview.jpg"), m_tszAvatarFolder.c_str());
}
else {
std::tstring tszContactAva = GetAvatarFileName(hContact);
diff --git a/protocols/WhatsApp/src/chat.cpp b/protocols/WhatsApp/src/chat.cpp
index 9a80485c3f..766bb63425 100644
--- a/protocols/WhatsApp/src/chat.cpp
+++ b/protocols/WhatsApp/src/chat.cpp
@@ -166,14 +166,14 @@ void WhatsAppProto::EditChatSubject(WAChatInfo *pInfo)
void WhatsAppProto::SetChatAvatar(WAChatInfo *pInfo)
{
TCHAR tszFileName[MAX_PATH], filter[256];
- Bitmap_GetFilter(filter, SIZEOF(filter));
+ Bitmap_GetFilter(filter, _countof(filter));
OPENFILENAME ofn = { 0 };
ofn.lStructSize = OPENFILENAME_SIZE_VERSION_400;
ofn.lpstrFilter = filter;
ofn.hwndOwner = 0;
ofn.lpstrFile = tszFileName;
- ofn.nMaxFile = ofn.nMaxFileTitle = SIZEOF(tszFileName);
+ ofn.nMaxFile = ofn.nMaxFileTitle = _countof(tszFileName);
ofn.Flags = OFN_HIDEREADONLY;
ofn.lpstrInitialDir = _T(".");
ofn.lpstrDefExt = _T("");
@@ -274,11 +274,11 @@ int WhatsAppProto::OnChatMenu(WPARAM wParam, LPARAM lParam)
return 0;
if (gcmi->Type == MENU_ON_LOG) {
- gcmi->nItems = SIZEOF(sttLogListItems);
+ gcmi->nItems = _countof(sttLogListItems);
gcmi->Item = sttLogListItems;
}
else if (gcmi->Type == MENU_ON_NICKLIST) {
- gcmi->nItems = SIZEOF(sttNickListItems);
+ gcmi->nItems = _countof(sttNickListItems);
gcmi->Item = sttNickListItems;
}
@@ -313,7 +313,7 @@ WAChatInfo* WhatsAppProto::InitChat(const std::string &jid, const std::string &n
GCDEST gcd = { m_szModuleName, ptszJid, GC_EVENT_ADDGROUP };
GCEVENT gce = { sizeof(gce), &gcd };
- for (int i = SIZEOF(sttStatuses) - 1; i >= 0; i--) {
+ for (int i = _countof(sttStatuses) - 1; i >= 0; i--) {
gce.ptszStatus = TranslateTS(sttStatuses[i]);
CallServiceSync(MS_GC_EVENT, NULL, (LPARAM)&gce);
}
diff --git a/protocols/WhatsApp/src/contacts.cpp b/protocols/WhatsApp/src/contacts.cpp
index 20c04040f0..2d94f0228b 100644
--- a/protocols/WhatsApp/src/contacts.cpp
+++ b/protocols/WhatsApp/src/contacts.cpp
@@ -136,7 +136,7 @@ void WhatsAppProto::UpdateStatusMsg(MCONTACT hContact)
if (lastSeen != -1) {
time_t ts = lastSeen;
TCHAR stzLastSeen[MAX_PATH];
- _tcsftime(stzLastSeen, SIZEOF(stzLastSeen), TranslateT("Last seen on %x at %X"), localtime(&ts));
+ _tcsftime(stzLastSeen, _countof(stzLastSeen), TranslateT("Last seen on %x at %X"), localtime(&ts));
ss << stzLastSeen;
}
diff --git a/protocols/WhatsApp/src/messages.cpp b/protocols/WhatsApp/src/messages.cpp
index 74bdc36b00..452215b90a 100644
--- a/protocols/WhatsApp/src/messages.cpp
+++ b/protocols/WhatsApp/src/messages.cpp
@@ -126,6 +126,6 @@ void WhatsAppProto::onMessageStatusUpdate(const FMessage &fmsg)
time_t ts = atol(fmsg.key.id.substr(0, delim).c_str());
TCHAR ttime[64];
- _tcsftime(ttime, SIZEOF(ttime), _T("%X"), localtime(&ts));
+ _tcsftime(ttime, _countof(ttime), _T("%X"), localtime(&ts));
utils::setStatusMessage(hContact, CMString(FORMAT, TranslateT("Message received: %s by %s"), ttime, ptszBy));
}
diff --git a/protocols/WhatsApp/src/proto.cpp b/protocols/WhatsApp/src/proto.cpp
index 13dc91d1d1..cfdea03d58 100644
--- a/protocols/WhatsApp/src/proto.cpp
+++ b/protocols/WhatsApp/src/proto.cpp
@@ -253,7 +253,7 @@ bool WhatsAppProto::Register(int state, const string &cc, const string &number,
nlhr.requestType = REQUEST_POST;
nlhr.szUrl = url.GetBuffer();
nlhr.headers = s_registerHeaders;
- nlhr.headersCount = SIZEOF(s_registerHeaders);
+ nlhr.headersCount = _countof(s_registerHeaders);
nlhr.flags = NLHRF_HTTP11 | NLHRF_GENERATEHOST | NLHRF_REMOVEHOST | NLHRF_SSL;
NETLIBHTTPREQUEST* pnlhr = (NETLIBHTTPREQUEST*)CallService(MS_NETLIB_HTTPTRANSACTION,
diff --git a/protocols/WhatsApp/src/theme.cpp b/protocols/WhatsApp/src/theme.cpp
index 1557f85fb4..6916acabf6 100644
--- a/protocols/WhatsApp/src/theme.cpp
+++ b/protocols/WhatsApp/src/theme.cpp
@@ -10,12 +10,12 @@ static IconItem icons[] =
void InitIcons(void)
{
- Icon_Register(g_hInstance, "Protocols/WhatsApp", icons, SIZEOF(icons), "WhatsApp");
+ Icon_Register(g_hInstance, "Protocols/WhatsApp", icons, _countof(icons), "WhatsApp");
}
HANDLE GetIconHandle(const char* name)
{
- for (size_t i = 0; i < SIZEOF(icons); i++)
+ for (size_t i = 0; i < _countof(icons); i++)
if (mir_strcmp(icons[i].szName, name) == 0)
return icons[i].hIcolib;
@@ -24,7 +24,7 @@ HANDLE GetIconHandle(const char* name)
char* GetIconDescription(const char* name)
{
- for (size_t i = 0; i < SIZEOF(icons); i++)
+ for (size_t i = 0; i < _countof(icons); i++)
if (mir_strcmp(icons[i].szName, name) == 0)
return icons[i].szDescr;
diff --git a/protocols/Xfire/src/Xfire_base.cpp b/protocols/Xfire/src/Xfire_base.cpp
index 17a24c2e0c..eecc1b6ac7 100644
--- a/protocols/Xfire/src/Xfire_base.cpp
+++ b/protocols/Xfire/src/Xfire_base.cpp
@@ -113,7 +113,7 @@ void Xfire_base::readStringfromDB(char*name, unsigned int dbid, char**to)
return;
//wert aus der dblesen
- mir_snprintf(temp, SIZEOF(temp), "%s_%i", name, dbid);
+ mir_snprintf(temp, _countof(temp), "%s_%i", name, dbid);
if (!db_get_s(NULL, protocolname, temp, &dbv))
{
//string setzen
@@ -131,7 +131,7 @@ void Xfire_base::readStringfromDB(char*name, unsigned int dbid, int id, char**to
return;
//wert aus der dblesen
- mir_snprintf(temp, SIZEOF(temp), "%s_%i_%i", name, dbid, id);
+ mir_snprintf(temp, _countof(temp), "%s_%i_%i", name, dbid, id);
if (!db_get_s(NULL, protocolname, temp, &dbv))
{
//string setzen
@@ -149,7 +149,7 @@ void Xfire_base::readUtf8StringfromDB(char*name, unsigned int dbid, char**to)
return;
//wert aus der dblesen
- mir_snprintf(temp, SIZEOF(temp), "%s_%i", name, dbid);
+ mir_snprintf(temp, _countof(temp), "%s_%i", name, dbid);
if (!db_get_utf(NULL, protocolname, temp, &dbv))
{
//string setzen
@@ -167,7 +167,7 @@ void Xfire_base::readUtf8StringfromDB(char*name, unsigned int dbid, int id, char
return;
//wert aus der dblesen
- mir_snprintf(temp, SIZEOF(temp), "%s_%i_%i", name, dbid, id);
+ mir_snprintf(temp, _countof(temp), "%s_%i_%i", name, dbid, id);
if (!db_get_utf(NULL, protocolname, temp, &dbv))
{
//string setzen
@@ -186,7 +186,7 @@ void Xfire_base::writeStringtoDB(char*name, unsigned int dbid, int id, char*val)
return;
//wert aus der dblesen
- mir_snprintf(temp, SIZEOF(temp), "%s_%i_%i", name, dbid, id);
+ mir_snprintf(temp, _countof(temp), "%s_%i_%i", name, dbid, id);
db_set_s(NULL, protocolname, temp, val);
}
@@ -198,7 +198,7 @@ void Xfire_base::writeStringtoDB(char*name, unsigned int dbid, char*val)
return;
//wert aus der dblesen
- mir_snprintf(temp, SIZEOF(temp), "%s_%i", name, dbid);
+ mir_snprintf(temp, _countof(temp), "%s_%i", name, dbid);
db_set_s(NULL, protocolname, temp, val);
}
@@ -210,7 +210,7 @@ void Xfire_base::writeUtf8StringtoDB(char*name, unsigned int dbid, int id, char*
return;
//wert aus der dblesen
- mir_snprintf(temp, SIZEOF(temp), "%s_%i_%i", name, dbid, id);
+ mir_snprintf(temp, _countof(temp), "%s_%i_%i", name, dbid, id);
db_set_utf(NULL, protocolname, temp, val);
}
@@ -222,7 +222,7 @@ void Xfire_base::writeUtf8StringtoDB(char*name, unsigned int dbid, char*val)
return;
//wert aus der dblesen
- mir_snprintf(temp, SIZEOF(temp), "%s_%i", name, dbid);
+ mir_snprintf(temp, _countof(temp), "%s_%i", name, dbid);
db_set_utf(NULL, protocolname, temp, val);
}
@@ -235,7 +235,7 @@ void Xfire_base::writeBytetoDB(char*name, unsigned int dbid, int val)
return;
//wert aus der dblesen
- mir_snprintf(temp, SIZEOF(temp), "%s_%i", name, dbid);
+ mir_snprintf(temp, _countof(temp), "%s_%i", name, dbid);
db_set_b(NULL, protocolname, temp, val);
}
@@ -247,7 +247,7 @@ void Xfire_base::writeWordtoDB(char*name, unsigned int dbid, int val)
return;
//wert aus der dblesen
- mir_snprintf(temp, SIZEOF(temp), "%s_%i", name, dbid);
+ mir_snprintf(temp, _countof(temp), "%s_%i", name, dbid);
db_set_w(NULL, protocolname, temp, val);
}
@@ -260,7 +260,7 @@ unsigned char Xfire_base::readBytefromDB(char*name, unsigned int dbid, int defau
return 0;
//wert aus der dblesen
- mir_snprintf(temp, SIZEOF(temp), "%s_%i", name, dbid);
+ mir_snprintf(temp, _countof(temp), "%s_%i", name, dbid);
return db_get_b(NULL, protocolname, temp, defaultval);
}
@@ -272,7 +272,7 @@ unsigned int Xfire_base::readWordfromDB(char*name, unsigned int dbid, int defaul
return 0;
//wert aus der dblesen
- mir_snprintf(temp, SIZEOF(temp), "%s_%i", name, dbid);
+ mir_snprintf(temp, _countof(temp), "%s_%i", name, dbid);
return db_get_w(NULL, protocolname, temp, defaultval);
}
@@ -284,7 +284,7 @@ BOOL Xfire_base::removeDBEntry(char*name, unsigned int dbid)
return 0;
//wert aus der dblesen
- mir_snprintf(temp, SIZEOF(temp), "%s_%i", name, dbid);
+ mir_snprintf(temp, _countof(temp), "%s_%i", name, dbid);
//eintrag entfernen
if (!db_get(NULL, protocolname, temp, &dbv))
@@ -305,7 +305,7 @@ BOOL Xfire_base::removeDBEntry(char*name, unsigned int dbid, int id)
return 0;
//wert aus der dblesen
- mir_snprintf(temp, SIZEOF(temp), "%s_%i_%i", name, dbid, id);
+ mir_snprintf(temp, _countof(temp), "%s_%i_%i", name, dbid, id);
//eintrag entfernen
if (!db_get(NULL, protocolname, temp, &dbv))
@@ -479,7 +479,7 @@ BOOL Xfire_base::getIniValue(unsigned int gameid, unsigned int subid, const char
return FALSE; //kein pfad bug?!?!
if (subid == 0) {
- mir_snprintf(idstring, SIZEOF(idstring), "%d", gameid);
+ mir_snprintf(idstring, _countof(idstring), "%d", gameid);
if (xfire_GetPrivateProfileString(idstring, valname, "", out, sizeofout, path))
return TRUE;
@@ -487,7 +487,7 @@ BOOL Xfire_base::getIniValue(unsigned int gameid, unsigned int subid, const char
subid++;
}
- mir_snprintf(idstring, SIZEOF(idstring), "%d_%d", gameid, subid);
+ mir_snprintf(idstring, _countof(idstring), "%d_%d", gameid, subid);
if (xfire_GetPrivateProfileString(idstring, valname, "", out, sizeofout, path))
return TRUE;
@@ -522,7 +522,7 @@ BOOL Xfire_base::getGamename(unsigned int gameid, char* out, int outsize){
//customnamen laden, wenn vorhanden
DBVARIANT dbv;
char dbstr[XFIRE_MAXSIZEOFGAMENAME];
- mir_snprintf(dbstr, SIZEOF(dbstr), "customgamename_%d", gameid);
+ mir_snprintf(dbstr, _countof(dbstr), "customgamename_%d", gameid);
if (!db_get(NULL, protocolname, dbstr, &dbv)) {
strncpy_s(out, outsize, dbv.pszVal, _TRUNCATE);
db_free(&dbv);
diff --git a/protocols/Xfire/src/Xfire_game.cpp b/protocols/Xfire/src/Xfire_game.cpp
index 87c0a4d2b9..02e16a955a 100644
--- a/protocols/Xfire/src/Xfire_game.cpp
+++ b/protocols/Xfire/src/Xfire_game.cpp
@@ -57,7 +57,7 @@ BOOL Xfire_game::start_game(char*ip, unsigned int port, char*pw) {
//port begrenzen
port = port % 65535;
//port in string wandeln
- mir_snprintf(portstr, SIZEOF(portstr), "%d", port);
+ mir_snprintf(portstr, _countof(portstr), "%d", port);
str_replace(mynetworkparams, "%UA_GAME_HOST_NAME%", ip);
str_replace(mynetworkparams, "%UA_GAME_HOST_PORT%", portstr);
@@ -192,11 +192,11 @@ BOOL Xfire_game::checkpath(PROCESSENTRY32* processInfo)
TCHAR fpath[MAX_PATH] = _T("");
//lese den pfad des spiels aus
- GetModuleFileNameEx(op, NULL, fpath, SIZEOF(fpath));
+ GetModuleFileNameEx(op, NULL, fpath, _countof(fpath));
//8.3 pfade umwandeln, nur wenn sich eine tilde im string befindet
if (_tcschr(fpath, '~'))
- GetLongPathName(fpath, fpath, SIZEOF(fpath));
+ GetLongPathName(fpath, fpath, _countof(fpath));
//alles in kelinbuchstaben umwandeln
this->strtolowerT(fpath);
@@ -440,7 +440,7 @@ void Xfire_game::createMenuitem(unsigned int pos, int dbid)
mi.pszPopupName = Translate("Start game");
mi.pszContactOwner = protocolname;
- mir_snprintf(temp, SIZEOF(temp), servicefunction, this->id);
+ mir_snprintf(temp, _countof(temp), servicefunction, this->id);
//wenn die servicefunktion schon exisitert vernichten, hehe
if (ServiceExists(temp))
DestroyServiceFunction(temp);
diff --git a/protocols/Xfire/src/Xfire_icon_mng.cpp b/protocols/Xfire/src/Xfire_icon_mng.cpp
index 90bf845253..d4dab1b547 100644
--- a/protocols/Xfire/src/Xfire_icon_mng.cpp
+++ b/protocols/Xfire/src/Xfire_icon_mng.cpp
@@ -137,7 +137,7 @@ Xfire_icon_cache Xfire_icon_mng::LoadGameIcon(unsigned int gameid) {
if (hIconDll) {
char resourcename[255];
//kurznamen des spiels uppercasen und .ICO anhängen
- mir_snprintf(resourcename, SIZEOF(resourcename), "XF_%s.ICO", shortname);
+ mir_snprintf(resourcename, _countof(resourcename), "XF_%s.ICO", shortname);
Xfire_base::strtoupper(resourcename);
//versuche die resource zufinden
diff --git a/protocols/Xfire/src/Xfire_voicechat.cpp b/protocols/Xfire/src/Xfire_voicechat.cpp
index 543d75de6a..3795196aa2 100644
--- a/protocols/Xfire/src/Xfire_voicechat.cpp
+++ b/protocols/Xfire/src/Xfire_voicechat.cpp
@@ -151,7 +151,7 @@ void Xfire_voicechat::writeToDatabase(SendGameStatus2Packet* packet) {
return;
}
//ip speichern
- mir_snprintf(temp, SIZEOF(temp), "%d.%d.%d.%d:%d", (unsigned char)packet->ip[3], (unsigned char)packet->ip[2], (unsigned char)packet->ip[1], (unsigned char)packet->ip[0], packet->port);
+ mir_snprintf(temp, _countof(temp), "%d.%d.%d.%d:%d", (unsigned char)packet->ip[3], (unsigned char)packet->ip[2], (unsigned char)packet->ip[1], (unsigned char)packet->ip[0], packet->port);
db_set_s(NULL, protocolname, "VServerIP", temp);
//namen jeh nach id schreiben
switch (packet->gameid) {
diff --git a/protocols/Xfire/src/addgamedialog.cpp b/protocols/Xfire/src/addgamedialog.cpp
index e729a80ab3..2783d38c13 100644
--- a/protocols/Xfire/src/addgamedialog.cpp
+++ b/protocols/Xfire/src/addgamedialog.cpp
@@ -144,12 +144,12 @@ static void FillGameList(LPVOID hwndDlg) {
if (z2 != zahlbuffer2)
{
listentry.gameid = MAKELONG(gameid, atoi(zahlbuffer2));
- mir_snprintf(gameidtemp, SIZEOF(gameidtemp), "%d_%d", gameid, atoi(zahlbuffer2));
+ mir_snprintf(gameidtemp, _countof(gameidtemp), "%d_%d", gameid, atoi(zahlbuffer2));
}
else
{
listentry.gameid = gameid;
- mir_snprintf(gameidtemp, SIZEOF(gameidtemp), "%d", gameid);
+ mir_snprintf(gameidtemp, _countof(gameidtemp), "%d", gameid);
}
@@ -265,7 +265,7 @@ BOOL OpenFileDialog(HWND hwndDlg, OPENFILENAMEA*ofn, char*exe) {
//kein backslash dann normal ret als exenamen verwenden
if ((int)exename == 1) exename = exe;
//filterstring aufbauen
- mir_snprintf(szFilter, SIZEOF(szFilter), "%s|%s|%s|*.*|", exename, exename, Translate("All Files"));
+ mir_snprintf(szFilter, _countof(szFilter), "%s|%s|%s|*.*|", exename, exename, Translate("All Files"));
//umbruch in 0 wandeln
unsigned int sizeFilter = mir_strlen(szFilter);
for (unsigned int i = 0; i < sizeFilter; i++)
@@ -275,7 +275,7 @@ BOOL OpenFileDialog(HWND hwndDlg, OPENFILENAMEA*ofn, char*exe) {
ofn->lStructSize = sizeof(OPENFILENAMEA);
ofn->hwndOwner = hwndDlg;
ofn->lpstrFile = szFile;
- ofn->nMaxFile = SIZEOF(szFile);
+ ofn->nMaxFile = _countof(szFile);
ofn->lpstrFilter = szFilter;
ofn->nFilterIndex = 1;
ofn->lpstrFileTitle = exe;
@@ -308,7 +308,7 @@ INT_PTR CALLBACK DlgAddGameProc(HWND hwndDlg,
{
char temp[256];
//eingabe bei der suche auslesen
- GetDlgItemTextA(hwndDlg, IDC_SEARCH, temp, SIZEOF(temp));
+ GetDlgItemTextA(hwndDlg, IDC_SEARCH, temp, _countof(temp));
//eingabe in der liste suchen
int idx = SendDlgItemMessageA(hwndDlg, IDC_GAMELIST, LB_FINDSTRING, 0, (LPARAM)temp);
//gefunden?
@@ -345,13 +345,13 @@ INT_PTR CALLBACK DlgAddGameProc(HWND hwndDlg,
int gameid2 = HIWORD(gameids);
if (gameid2 != 0)
- mir_snprintf(gameidtemp, SIZEOF(gameidtemp), "%d_%d", gameid1, gameid2);
+ mir_snprintf(gameidtemp, _countof(gameidtemp), "%d_%d", gameid1, gameid2);
else
- mir_snprintf(gameidtemp, SIZEOF(gameidtemp), "%d", gameid1);
+ mir_snprintf(gameidtemp, _countof(gameidtemp), "%d", gameid1);
//spielnamen holen
if (xfire_GetPrivateProfileString(gameidtemp, "LongName", "", ret, 512, inipath)) {
- mir_snprintf(gameidtemp, SIZEOF(gameidtemp), "%d", gameid1);
+ mir_snprintf(gameidtemp, _countof(gameidtemp), "%d", gameid1);
//einige felder vorbelegen
SetDlgItemTextA(hPage, IDC_ADD_NAME, ret);
@@ -389,9 +389,9 @@ INT_PTR CALLBACK DlgAddGameProc(HWND hwndDlg,
char ret[512];
if (gameid2 != 0)
- mir_snprintf(gameidtemp, SIZEOF(gameidtemp), "%d_%d", gameid1, gameid2);
+ mir_snprintf(gameidtemp, _countof(gameidtemp), "%d_%d", gameid1, gameid2);
else
- mir_snprintf(gameidtemp, SIZEOF(gameidtemp), "%d", gameid1);
+ mir_snprintf(gameidtemp, _countof(gameidtemp), "%d", gameid1);
//neuen gameeintrag anlegen
Xfire_game* newgame = new Xfire_game();
@@ -628,7 +628,7 @@ INT_PTR CALLBACK DlgAddGameProc2(HWND hwndDlg, UINT uMsg, WPARAM wParam, LPARAM
newgame = new Xfire_game();
//Spielname
- GetDlgItemTextA(hwndDlg, IDC_ADD_NAME, temp, SIZEOF(temp));
+ GetDlgItemTextA(hwndDlg, IDC_ADD_NAME, temp, _countof(temp));
if (!mir_strlen(temp))
{
if (!editgame) delete newgame;
@@ -643,7 +643,7 @@ INT_PTR CALLBACK DlgAddGameProc2(HWND hwndDlg, UINT uMsg, WPARAM wParam, LPARAM
}
//spielid nur setzen/prüfen, wenn kein editgame
if (!editgame) {
- GetDlgItemTextA(hwndDlg, IDC_ADD_ID, temp, SIZEOF(temp));
+ GetDlgItemTextA(hwndDlg, IDC_ADD_ID, temp, _countof(temp));
if (!mir_strlen(temp))
{
if (!editgame) delete newgame;
@@ -671,7 +671,7 @@ INT_PTR CALLBACK DlgAddGameProc2(HWND hwndDlg, UINT uMsg, WPARAM wParam, LPARAM
}
}
//zu sendene spielid
- GetDlgItemTextA(hwndDlg, IDC_ADD_SENDID, temp, SIZEOF(temp));
+ GetDlgItemTextA(hwndDlg, IDC_ADD_SENDID, temp, _countof(temp));
if (mir_strlen(temp))
{
//standardmäßig wird bei einem customeintrag keine id versendet
@@ -681,7 +681,7 @@ INT_PTR CALLBACK DlgAddGameProc2(HWND hwndDlg, UINT uMsg, WPARAM wParam, LPARAM
}
//launcher exe
- GetDlgItemTextA(hwndDlg, IDC_ADD_LAUNCHEREXE, temp, SIZEOF(temp));
+ GetDlgItemTextA(hwndDlg, IDC_ADD_LAUNCHEREXE, temp, _countof(temp));
if (mir_strlen(temp))
{
//lowercase pfad
@@ -690,7 +690,7 @@ INT_PTR CALLBACK DlgAddGameProc2(HWND hwndDlg, UINT uMsg, WPARAM wParam, LPARAM
newgame->setString(temp, &newgame->launchparams);
}
//detectexe
- GetDlgItemTextA(hwndDlg, IDC_ADD_DETECTEXE, temp, SIZEOF(temp));
+ GetDlgItemTextA(hwndDlg, IDC_ADD_DETECTEXE, temp, _countof(temp));
if (!mir_strlen(temp))
{
if (!editgame) delete newgame;
@@ -708,13 +708,13 @@ INT_PTR CALLBACK DlgAddGameProc2(HWND hwndDlg, UINT uMsg, WPARAM wParam, LPARAM
}
//mustcontain parameter
- GetDlgItemTextA(hwndDlg, IDC_ADD_CUSTOMPARAMS, temp, SIZEOF(temp));
+ GetDlgItemTextA(hwndDlg, IDC_ADD_CUSTOMPARAMS, temp, _countof(temp));
if (mir_strlen(temp))
{
newgame->setString(temp, &newgame->mustcontain);
}
//statusmsg speichern
- GetDlgItemTextA(hwndDlg, IDC_ADD_STATUSMSG, temp, SIZEOF(temp));
+ GetDlgItemTextA(hwndDlg, IDC_ADD_STATUSMSG, temp, _countof(temp));
if (mir_strlen(temp))
{
newgame->setString(temp, &newgame->statusmsg);
diff --git a/protocols/Xfire/src/buddylist.cpp b/protocols/Xfire/src/buddylist.cpp
index ac3bfbf608..e3a5dd7dff 100644
--- a/protocols/Xfire/src/buddylist.cpp
+++ b/protocols/Xfire/src/buddylist.cpp
@@ -146,7 +146,7 @@ namespace xfirelib {
/* ## buddies im miranda verarbietn */
char temp[255];
char * dummy;
- mir_snprintf(temp,SIZEOF(temp),"Clan_%d",entry->clanid);
+ mir_snprintf(temp,_countof(temp),"Clan_%d",entry->clanid);
DBVARIANT dbv;
if (!db_get(NULL,protocolname,temp,&dbv))
diff --git a/protocols/Xfire/src/iniupdater.cpp b/protocols/Xfire/src/iniupdater.cpp
index 072e0f692e..6d97588ad4 100644
--- a/protocols/Xfire/src/iniupdater.cpp
+++ b/protocols/Xfire/src/iniupdater.cpp
@@ -53,11 +53,11 @@ void UpdateMyXFireIni(LPVOID dummy) {
//ini pfad rausbekommen
char file[1024], file2[1024], file3[1024];
- mir_snprintf(file,SIZEOF(file), "%sxfire_games.new",inipath);
- mir_snprintf(file2,SIZEOF(file2), "%sxfire_games.ini",inipath);
- mir_snprintf(file3,SIZEOF(file3), "%sxfire_games.old",inipath);
+ mir_snprintf(file,_countof(file), "%sxfire_games.new",inipath);
+ mir_snprintf(file2,_countof(file2), "%sxfire_games.ini",inipath);
+ mir_snprintf(file3,_countof(file3), "%sxfire_games.old",inipath);
- mir_snprintf(request, SIZEOF(request), "%s%d", INI_URLREQUEST, getfilesize(file2));
+ mir_snprintf(request, _countof(request), "%s%d", INI_URLREQUEST, getfilesize(file2));
if (CheckWWWContent(request))
{
@@ -89,11 +89,11 @@ void UpdateMyIcons(LPVOID dummy) {
//ini pfad rausbekommen
char file[1024], file2[1024], file3[1024];
- mir_snprintf(file,SIZEOF(file), "%sicons.new",inipath);
- mir_snprintf(file2,SIZEOF(file2), "%sicons.dll",inipath);
- mir_snprintf(file3,SIZEOF(file3), "%sicons.old",inipath);
+ mir_snprintf(file,_countof(file), "%sicons.new",inipath);
+ mir_snprintf(file2,_countof(file2), "%sicons.dll",inipath);
+ mir_snprintf(file3,_countof(file3), "%sicons.old",inipath);
- mir_snprintf(request, SIZEOF(request), "%s%d", ICO_URLREQUEST, getfilesize(file2));
+ mir_snprintf(request, _countof(request), "%s%d", ICO_URLREQUEST, getfilesize(file2));
if (CheckWWWContent(request))
{
diff --git a/protocols/Xfire/src/main.cpp b/protocols/Xfire/src/main.cpp
index fd04b1f76e..968e3e6664 100644
--- a/protocols/Xfire/src/main.cpp
+++ b/protocols/Xfire/src/main.cpp
@@ -419,7 +419,7 @@ void XFireClient::receivedPacket(XFirePacket *packet) {
for (int i = 0; i < claninv->numberOfInv; i++)
{
char msg[XFIRE_MAX_STATIC_STRING_LEN];
- mir_snprintf(msg, SIZEOF(msg), Translate("%s (Nickname: %s) has invited you to join the %s clan. Message: %s%sPlease go to the XFire clan site to accept the Invitation."), claninv->invitefromusername[i].c_str(),
+ mir_snprintf(msg, _countof(msg), Translate("%s (Nickname: %s) has invited you to join the %s clan. Message: %s%sPlease go to the XFire clan site to accept the Invitation."), claninv->invitefromusername[i].c_str(),
claninv->invitefrom[i].c_str(),
claninv->clanname[i].c_str(),
claninv->invitemsg[i].c_str(), "\n");
@@ -482,7 +482,7 @@ void XFireClient::receivedPacket(XFirePacket *packet) {
char temp[255];
char * dummy;
ClanBuddyListNamesPacket *clan = (ClanBuddyListNamesPacket*)content;
- mir_snprintf(temp, SIZEOF(temp), "Clan_%d", clan->clanid);
+ mir_snprintf(temp, _countof(temp), "Clan_%d", clan->clanid);
DBVARIANT dbv;
if (!db_get(NULL,protocolname,temp,&dbv))
@@ -638,10 +638,10 @@ void XFireClient::receivedPacket(XFirePacket *packet) {
for (int i = 0; i < clan->count; i++)
{
- mir_snprintf(temp, SIZEOF(temp), "Clan_%d", clan->clanid[i]);
+ mir_snprintf(temp, _countof(temp), "Clan_%d", clan->clanid[i]);
db_set_s(NULL, protocolname, temp, (char*)clan->name[i].c_str());
- mir_snprintf(temp, SIZEOF(temp), "ClanUrl_%d", clan->clanid[i]);
+ mir_snprintf(temp, _countof(temp), "ClanUrl_%d", clan->clanid[i]);
db_set_s(NULL, protocolname, temp, (char*)clan->url[i].c_str());
if (!db_get_b(NULL, protocolname, "noclangroups", 0)) {
@@ -681,7 +681,7 @@ void XFireClient::receivedPacket(XFirePacket *packet) {
//recprotoverchg
if (db_get_w(NULL, protocolname, "recprotoverchg", 0) == 0)
{
- mir_snprintf(temp, SIZEOF(temp), Translate("The protocol version is too old. Changed current version from %d to %d. You can reconnect now."), client->protocolVersion, version->newversion);
+ mir_snprintf(temp, _countof(temp), Translate("The protocol version is too old. Changed current version from %d to %d. You can reconnect now."), client->protocolVersion, version->newversion);
MSGBOXE(temp);
}
else
@@ -692,7 +692,7 @@ void XFireClient::receivedPacket(XFirePacket *packet) {
}
else
{
- mir_snprintf(temp, SIZEOF(temp), Translate("The protocol version is too old. Cannot detect a new version number."));
+ mir_snprintf(temp, _countof(temp), Translate("The protocol version is too old. Cannot detect a new version number."));
MSGBOXE(temp);
SetStatus(ID_STATUS_OFFLINE, NULL);
}
@@ -847,7 +847,7 @@ INT_PTR UrlCall(WPARAM wparam, LPARAM lparam) {
if (mir_strlen(g) > 25) //zugroße abschneiden
*(g + 25) = 0;
- mir_snprintf(temp, SIZEOF(temp), Translate("Do you really want to add %s to your friend list?"), g);
+ mir_snprintf(temp, _countof(temp), Translate("Do you really want to add %s to your friend list?"), g);
//Nutzer vorher fragen, ob er wirklich user xyz adden möchte
if (MessageBoxA(NULL, temp, Translate(PLUGIN_TITLE), MB_YESNO | MB_ICONQUESTION) == IDYES)
{
@@ -1045,7 +1045,7 @@ extern "C" __declspec(dllexport) int Load(void)
//statusmessages setzen
mir_strcpy(statusmessage[0], "");
- mir_snprintf(statusmessage[1], SIZEOF(statusmessage[1]), "(AFK) %s", Translate("Away from Keyboard"));
+ mir_snprintf(statusmessage[1], _countof(statusmessage[1]), "(AFK) %s", Translate("Away from Keyboard"));
HookEvent(ME_OPT_INITIALISE, OptInit);
HookEvent(ME_SYSTEM_MODULESLOADED, OnSystemModulesLoaded);
@@ -1525,7 +1525,7 @@ INT_PTR SetStatus(WPARAM wParam, LPARAM lParam)
{
//setze bei aktivem nocustomaway die alte awaystatusmsg zurück, bugfix
if (db_get_b(NULL, protocolname, "nocustomaway", 0))
- mir_snprintf(statusmessage[1], SIZEOF(statusmessage[1]), "(AFK) %s", Translate("Away from Keyboard"));
+ mir_snprintf(statusmessage[1], _countof(statusmessage[1]), "(AFK) %s", Translate("Away from Keyboard"));
myClient->Status(statusmessage[1]);
}
@@ -1914,7 +1914,7 @@ static INT_PTR GetIPPort(WPARAM hContact, LPARAM lParam)
return 0;
char temp[XFIRE_MAX_STATIC_STRING_LEN];
- mir_snprintf(temp, SIZEOF(temp), "%s:%d", dbv.pszVal, db_get_w(hContact, protocolname, "Port", -1));
+ mir_snprintf(temp, _countof(temp), "%s:%d", dbv.pszVal, db_get_w(hContact, protocolname, "Port", -1));
db_free(&dbv);
if (OpenClipboard(NULL)) {
@@ -1942,7 +1942,7 @@ static INT_PTR GetVIPPort(WPARAM hContact, LPARAM lParam)
return 0;
char temp[XFIRE_MAX_STATIC_STRING_LEN];
- mir_snprintf(temp, SIZEOF(temp), "%s:%d", dbv.pszVal, db_get_w(hContact, protocolname, "VPort", -1));
+ mir_snprintf(temp, _countof(temp), "%s:%d", dbv.pszVal, db_get_w(hContact, protocolname, "VPort", -1));
db_free(&dbv);
if (OpenClipboard(NULL)) {
@@ -1982,7 +1982,7 @@ static INT_PTR GotoXFireClanSite(WPARAM hContact, LPARAM lParam)
char temp[64] = "";
int clanid = db_get_dw(hContact, protocolname, "Clan", -1);
- mir_snprintf(temp, SIZEOF(temp), "ClanUrl_%d", clanid);
+ mir_snprintf(temp, _countof(temp), "ClanUrl_%d", clanid);
if (db_get_s(NULL, protocolname, temp, &dbv))
return 0;
@@ -2210,7 +2210,7 @@ void gamedetectiont(LPVOID lparam)
if (packet->ip[3]!=0)
{
- mir_snprintf(temp, SIZEOF(temp), "%d.%d.%d.%d:%d", (unsigned char)packet->ip[3], (unsigned char)packet->ip[2], (unsigned char)packet->ip[1], (unsigned char)packet->ip[0],packet->port);
+ mir_snprintf(temp, _countof(temp), "%d.%d.%d.%d:%d", (unsigned char)packet->ip[3], (unsigned char)packet->ip[2], (unsigned char)packet->ip[1], (unsigned char)packet->ip[0],packet->port);
db_set_s(NULL, protocolname, "VServerIP", temp);
db_set_s(NULL, protocolname, "currentvoicename", "Teamspeak");
}
@@ -2250,7 +2250,7 @@ void gamedetectiont(LPVOID lparam)
db_set_w(NULL,protocolname,"currentvoice",vid);
- mir_snprintf(temp, SIZEOF(temp), "%d.%d.%d.%d:%d", (unsigned char)packet->ip[3], (unsigned char)packet->ip[2], (unsigned char)packet->ip[1],(unsigned char)packet->ip[0],packet->port);
+ mir_snprintf(temp, _countof(temp), "%d.%d.%d.%d:%d", (unsigned char)packet->ip[3], (unsigned char)packet->ip[2], (unsigned char)packet->ip[1],(unsigned char)packet->ip[0],packet->port);
db_set_s(NULL, protocolname, "VServerIP", temp);
if (myClient!=NULL)
@@ -2290,7 +2290,7 @@ void gamedetectiont(LPVOID lparam)
packet->gameid=vid;
db_set_w(NULL,protocolname,"currentvoice",vid);
- mir_snprintf(temp, SIZEOF(temp), "%d.%d.%d.%d:%d", (unsigned char)packet->ip[3], (unsigned char)packet->ip[2], (unsigned char)packet->ip[1],(unsigned char)packet->ip[0],packet->port);
+ mir_snprintf(temp, _countof(temp), "%d.%d.%d.%d:%d", (unsigned char)packet->ip[3], (unsigned char)packet->ip[2], (unsigned char)packet->ip[1],(unsigned char)packet->ip[0],packet->port);
db_set_s(NULL, protocolname, "VServerIP", temp);
if (myClient!=NULL)
@@ -2345,7 +2345,7 @@ void gamedetectiont(LPVOID lparam)
myClient->Status(statusmessage[1]);
}
- mir_snprintf(temp, SIZEOF(temp), Translate("Last game: %s playtime: %.2d:%.2d:%.2d"), currentgame->name, mytm->tm_hour, mytm->tm_min, mytm->tm_sec);
+ mir_snprintf(temp, _countof(temp), Translate("Last game: %s playtime: %.2d:%.2d:%.2d"), currentgame->name, mytm->tm_hour, mytm->tm_min, mytm->tm_sec);
db_set_s(NULL, protocolname, "LastGame", temp);
if (currentgame->noicqstatus != TRUE&&db_get_b(NULL, protocolname, "autosetstatusmsg", 0))
@@ -2399,7 +2399,7 @@ void gamedetectiont(LPVOID lparam)
if (packet->ip[3] != 0)
{
- mir_snprintf(temp, SIZEOF(temp), "%d.%d.%d.%d:%d", (unsigned char)packet->ip[3], (unsigned char)packet->ip[2], (unsigned char)packet->ip[1], (unsigned char)packet->ip[0], packet->port);
+ mir_snprintf(temp, _countof(temp), "%d.%d.%d.%d:%d", (unsigned char)packet->ip[3], (unsigned char)packet->ip[2], (unsigned char)packet->ip[1], (unsigned char)packet->ip[0], packet->port);
db_set_s(NULL, protocolname, "ServerIP", temp);
XFireLog("Got IPPort: %s", temp);
}
@@ -2714,7 +2714,7 @@ MCONTACT handlingBuddys(BuddyListEntry *entry, int clan, char*group, BOOL dontsc
{
if ((unsigned char)gameob->ip[3] != 0) // wenn ip, dann speichern
{
- mir_snprintf(temp, SIZEOF(temp), "%d.%d.%d.%d", (unsigned char)gameob->ip[3], (unsigned char)gameob->ip[2], (unsigned char)gameob->ip[1], (unsigned char)gameob->ip[0]);
+ mir_snprintf(temp, _countof(temp), "%d.%d.%d.%d", (unsigned char)gameob->ip[3], (unsigned char)gameob->ip[2], (unsigned char)gameob->ip[1], (unsigned char)gameob->ip[0]);
db_set_s(hContact, protocolname, "VServerIP", temp);
db_set_w(hContact, protocolname, "VPort", (unsigned long)gameob->port);
}
@@ -2754,7 +2754,7 @@ MCONTACT handlingBuddys(BuddyListEntry *entry, int clan, char*group, BOOL dontsc
if (db_get_b(NULL, protocolname, "gamepopup", 0) == 1) {
char temp[256] = "";
- mir_snprintf(temp, SIZEOF(temp), Translate("%s is playing %s."),
+ mir_snprintf(temp, _countof(temp), Translate("%s is playing %s."),
//ist ein nick gesetzt?
(entry->nick.length() == 0 ?
//nein dann username
@@ -2767,7 +2767,7 @@ MCONTACT handlingBuddys(BuddyListEntry *entry, int clan, char*group, BOOL dontsc
{
if ((unsigned char)gameob->ip[3] != 0)
{
- mir_snprintf(temp, SIZEOF(temp), Translate("%s is playing %s on server %d.%d.%d.%d:%d."),
+ mir_snprintf(temp, _countof(temp), Translate("%s is playing %s on server %d.%d.%d.%d:%d."),
//ist ein nick gesetzt?
(entry->nick.length() == 0 ?
//nein dann username
@@ -2817,7 +2817,7 @@ MCONTACT handlingBuddys(BuddyListEntry *entry, int clan, char*group, BOOL dontsc
if ((unsigned char)gameob->ip[3] != 0)
{
//ip und port in kontakt speichern
- mir_snprintf(temp, SIZEOF(temp), "%d.%d.%d.%d", (unsigned char)gameob->ip[3], (unsigned char)gameob->ip[2], (unsigned char)gameob->ip[1], (unsigned char)gameob->ip[0]);
+ mir_snprintf(temp, _countof(temp), "%d.%d.%d.%d", (unsigned char)gameob->ip[3], (unsigned char)gameob->ip[2], (unsigned char)gameob->ip[1], (unsigned char)gameob->ip[0]);
db_set_s(hContact, protocolname, "ServerIP", temp);
db_set_w(hContact, protocolname, "Port", (unsigned long)gameob->port);
@@ -2828,7 +2828,7 @@ MCONTACT handlingBuddys(BuddyListEntry *entry, int clan, char*group, BOOL dontsc
GameServerQuery_query gsqq = { 0 };
gsqq.port = gameob->port;
gsqq.xfiregameid = entry->game;
- strncpy(gsqq.ip, temp, SIZEOF(gsqq.ip)-1);
+ strncpy(gsqq.ip, temp, _countof(gsqq.ip)-1);
CallService("GameServerQuery/Query", (WPARAM)entry, (LPARAM)&gsqq);
}
}
@@ -2941,11 +2941,11 @@ MCONTACT handlingBuddys(BuddyListEntry *entry, int clan, char*group, BOOL dontsc
{
char temp[256];
DBVARIANT dbv;
- mir_snprintf(temp, SIZEOF(temp), "%d", val - 1);
+ mir_snprintf(temp, _countof(temp), "%d", val - 1);
db_get_s(NULL, "CListGroups", temp, &dbv);
if (dbv.pszVal != NULL)
{
- mir_snprintf(temp, SIZEOF(temp), "%s\\%s", &dbv.pszVal[1], group);
+ mir_snprintf(temp, _countof(temp), "%s\\%s", &dbv.pszVal[1], group);
db_set_s(entry->hcontact, "CList", "Group", temp);
db_free(&dbv);
}
@@ -2964,11 +2964,11 @@ MCONTACT handlingBuddys(BuddyListEntry *entry, int clan, char*group, BOOL dontsc
{
char temp[256];
DBVARIANT dbv;
- mir_snprintf(temp, SIZEOF(temp), "%d", val - 1);
+ mir_snprintf(temp, _countof(temp), "%d", val - 1);
db_get_s(NULL, "CListGroups", temp, &dbv);
if (dbv.pszVal != NULL)
{
- mir_snprintf(temp, SIZEOF(temp), "%s\\%s", &dbv.pszVal[1], group);
+ mir_snprintf(temp, _countof(temp), "%s\\%s", &dbv.pszVal[1], group);
db_set_s(entry->hcontact, "CList", "Group", temp);
db_free(&dbv);
}
@@ -3068,21 +3068,21 @@ void CreateGroup(char*grpn, char*field) {
if (val == 0)
{
- strcpy_s(grp, SIZEOF(grp), grpn);//((char*)clan->name[i].c_str());
+ strcpy_s(grp, _countof(grp), grpn);//((char*)clan->name[i].c_str());
}
else
{
char temp[255];
DBVARIANT dbv;
- mir_snprintf(temp, SIZEOF(temp), "%d", val - 1);
+ mir_snprintf(temp, _countof(temp), "%d", val - 1);
if (!db_get_s(NULL, "CListGroups", temp, &dbv))
{
- mir_snprintf(grp, SIZEOF(grp), "%s\\%s", &dbv.pszVal[1], grpn);
+ mir_snprintf(grp, _countof(grp), "%s\\%s", &dbv.pszVal[1], grpn);
db_free(&dbv);
}
else //gruppe existiert nciht mehr, auf root alles legen
{
- strcpy_s(grp, SIZEOF(grp), grpn);
+ strcpy_s(grp, _countof(grp), grpn);
db_set_b(NULL, protocolname, field, 0);
}
}
@@ -3093,7 +3093,7 @@ void CreateGroup(char*grpn, char*field) {
int i = 0;
for (i = 0;; i++)
{
- mir_snprintf(temp, SIZEOF(temp), "%d", i);
+ mir_snprintf(temp, _countof(temp), "%d", i);
if (db_get_s(NULL, "CListGroups", temp, &dbv))
{
i--;
@@ -3108,7 +3108,7 @@ void CreateGroup(char*grpn, char*field) {
strcpy_s(group, 255, "D");
strcat_s(group, 255, grp);
group[0] = 1 | GROUPF_EXPANDED;
- mir_snprintf(temp, SIZEOF(temp), "%d", i + 1);
+ mir_snprintf(temp, _countof(temp), "%d", i + 1);
db_set_s(NULL, "CListGroups", temp, group);
CallServiceSync(MS_CLUI_GROUPADDED, i + 1, 0);
}
@@ -3125,7 +3125,7 @@ INT_PTR SetAwayMsg(WPARAM wParam, LPARAM lParam)
}
else if (wParam != ID_STATUS_OFFLINE/*&&db_get_b(NULL,protocolname,"nocustomaway",0)==0*/)
{
- mir_snprintf(statusmessage[1], SIZEOF(statusmessage[1]), "(AFK) %s", Translate("Away from Keyboard"));
+ mir_snprintf(statusmessage[1], _countof(statusmessage[1]), "(AFK) %s", Translate("Away from Keyboard"));
}
}
else
@@ -3136,11 +3136,11 @@ INT_PTR SetAwayMsg(WPARAM wParam, LPARAM lParam)
}
else if (wParam != ID_STATUS_OFFLINE) {
if (db_get_b(NULL, protocolname, "nocustomaway", 0) == 0 && mir_strlen((char*)lParam) > 0) {
- mir_snprintf(statusmessage[1], SIZEOF(statusmessage[1]), "(AFK) %s", (char*)lParam);
+ mir_snprintf(statusmessage[1], _countof(statusmessage[1]), "(AFK) %s", (char*)lParam);
//mir_strcpy(statusmessage[1],( char* )lParam);
}
else
- mir_snprintf(statusmessage[1], SIZEOF(statusmessage[1]), "(AFK) %s", Translate("Away from Keyboard"));
+ mir_snprintf(statusmessage[1], _countof(statusmessage[1]), "(AFK) %s", Translate("Away from Keyboard"));
}
}
@@ -3239,7 +3239,7 @@ INT_PTR RemoveFriend(WPARAM hContact, LPARAM lParam)
if (!db_get_s(hContact, protocolname, "Username", &dbv))
{
- mir_snprintf(temp, SIZEOF(temp), Translate("Do you really want to delete your friend %s?"), dbv.pszVal);
+ mir_snprintf(temp, _countof(temp), Translate("Do you really want to delete your friend %s?"), dbv.pszVal);
if (MessageBoxA(NULL, temp, Translate("Confirm Delete"), MB_YESNO | MB_ICONQUESTION) == IDYES)
{
if (myClient != NULL)
@@ -3342,7 +3342,7 @@ int doneQuery(WPARAM wParam, LPARAM lParam) {
db_set_s(bud->hcontact, protocolname, "ServerName", gameinfo->name);
db_set_s(bud->hcontact, protocolname, "GameType", gameinfo->gametype);
db_set_s(bud->hcontact, protocolname, "Map", gameinfo->map);
- mir_snprintf(temp, SIZEOF(temp), "(%d/%d)", gameinfo->players, gameinfo->maxplayers);
+ mir_snprintf(temp, _countof(temp), "(%d/%d)", gameinfo->players, gameinfo->maxplayers);
db_set_s(bud->hcontact, protocolname, "Players", temp);
db_set_b(bud->hcontact, protocolname, "Passworded", gameinfo->password);
@@ -3367,7 +3367,7 @@ int IconLibChanged(WPARAM wParam, LPARAM lParam) {
//ImageList_ReplaceIcon(hAdvancedStatusIcon,(int)icocache[i].handle,icocache[i].hicon);
HANDLE before=icocache[i].handle;
icocache[i].handle=(HANDLE)CallService(MS_CLIST_EXTRA_ADD_ICON, (WPARAM)icocache[i].hicon, 0);
- mir_snprintf(temp, SIZEOF(temp), "before: %d after: %d", before, icocache[i].handle);
+ mir_snprintf(temp, _countof(temp), "before: %d after: %d", before, icocache[i].handle);
MessageBoxA(NULL,temp,temp,0);
DrawIcon(GetDC(NULL),x,0,(HICON)CallService(MS_SKIN2_GETICONBYHANDLE,0,(LPARAM)icocache[i].handle));
x+=32;
diff --git a/protocols/Xfire/src/options.cpp b/protocols/Xfire/src/options.cpp
index fd13a4688c..670564ea8f 100644
--- a/protocols/Xfire/src/options.cpp
+++ b/protocols/Xfire/src/options.cpp
@@ -181,7 +181,7 @@ static INT_PTR CALLBACK DlgProcOpts2(HWND hwndDlg, UINT msg, WPARAM wParam, LPAR
}
char temp[255] = "";
- mir_snprintf(temp, SIZEOF(temp), "%d", db_get_b(NULL, protocolname, "protover", 0x5b));
+ mir_snprintf(temp, _countof(temp), "%d", db_get_b(NULL, protocolname, "protover", 0x5b));
SetDlgItemTextA(hwndDlg, IDC_PVER, temp);
EnableWindow(GetDlgItem(hwndDlg, IDC_LASTGAME), FALSE);
@@ -253,7 +253,7 @@ static INT_PTR CALLBACK DlgProcOpts2(HWND hwndDlg, UINT msg, WPARAM wParam, LPAR
char str[128];
DBVARIANT dbv;
- GetDlgItemTextA(hwndDlg, IDC_LOGIN, login, SIZEOF(login));
+ GetDlgItemTextA(hwndDlg, IDC_LOGIN, login, _countof(login));
dbv.pszVal = NULL;
if (db_get(NULL, protocolname, "login", &dbv) || mir_strcmp(login, dbv.pszVal))
reconnectRequired = 1;
@@ -278,7 +278,7 @@ static INT_PTR CALLBACK DlgProcOpts2(HWND hwndDlg, UINT msg, WPARAM wParam, LPAR
db_set_s(NULL, protocolname, "Username", login);
//nur wenn der nick erfolgreich übertragen wurde
- GetDlgItemTextA(hwndDlg, IDC_NICK, login, SIZEOF(login));
+ GetDlgItemTextA(hwndDlg, IDC_NICK, login, _countof(login));
dbv.pszVal = NULL;
if (db_get(NULL, protocolname, "Nick", &dbv) || mir_strcmp(login, dbv.pszVal))
{
@@ -288,14 +288,14 @@ static INT_PTR CALLBACK DlgProcOpts2(HWND hwndDlg, UINT msg, WPARAM wParam, LPAR
if (dbv.pszVal != NULL)
db_free(&dbv);
- GetDlgItemTextA(hwndDlg, IDC_PASSWORD, str, SIZEOF(str));
+ GetDlgItemTextA(hwndDlg, IDC_PASSWORD, str, _countof(str));
dbv.pszVal = NULL;
if (db_get(NULL, protocolname, "password", &dbv) || mir_strcmp(str, dbv.pszVal))
reconnectRequired = 1;
if (dbv.pszVal != NULL)
db_free(&dbv);
db_set_s(NULL, protocolname, "password", str);
- GetDlgItemTextA(hwndDlg, IDC_SERVER, str, SIZEOF(str));
+ GetDlgItemTextA(hwndDlg, IDC_SERVER, str, _countof(str));
//neue preferencen sichern
if (bpStatus != ID_STATUS_OFFLINE&&bpStatus != ID_STATUS_CONNECTING)
@@ -322,7 +322,7 @@ static INT_PTR CALLBACK DlgProcOpts2(HWND hwndDlg, UINT msg, WPARAM wParam, LPAR
}
//protocolversion wird autoamtisch vergeben
- //GetDlgItemTextA(hwndDlg,IDC_PVER,str,SIZEOF(str));
+ //GetDlgItemTextA(hwndDlg,IDC_PVER,str,_countof(str));
//db_set_b(NULL,protocolname,"protover",(char)atoi(str));
if (reconnectRequired)
@@ -379,11 +379,11 @@ static INT_PTR CALLBACK DlgProcOpts3(HWND hwndDlg, UINT msg, WPARAM wParam, LPAR
SendDlgItemMessage(hwndDlg, IDC_CLANGROUP, CB_ADDSTRING, 0, (LPARAM)TranslateT("<Root Group>"));
SendDlgItemMessage(hwndDlg, IDC_FOFGROUP, CB_ADDSTRING, 0, (LPARAM)TranslateT("<Root Group>"));
- mir_snprintf(temp, SIZEOF(temp), "%d", gruppen_id);
+ mir_snprintf(temp, _countof(temp), "%d", gruppen_id);
while (!db_get_s(NULL, "CListGroups", temp, &dbv))
{
gruppen_id++;
- mir_snprintf(temp, SIZEOF(temp), "%d", gruppen_id);
+ mir_snprintf(temp, _countof(temp), "%d", gruppen_id);
if (dbv.pszVal != NULL) {
SendDlgItemMessageA(hwndDlg, IDC_CLANGROUP, CB_ADDSTRING, 0, (LPARAM)&dbv.pszVal[1]);
@@ -724,7 +724,7 @@ static INT_PTR CALLBACK DlgProcOpts5(HWND hwndDlg, UINT msg, WPARAM wParam, LPAR
int reconnectRequired = 0;
char str[512];
- GetDlgItemTextA(hwndDlg, IDC_STATUSMSG, str, SIZEOF(str));
+ GetDlgItemTextA(hwndDlg, IDC_STATUSMSG, str, _countof(str));
db_set_s(NULL, protocolname, "setstatusmsg", str);
db_set_b(NULL, protocolname, "autosetstatusmsg", (BYTE)IsDlgButtonChecked(hwndDlg, IDC_ENABLESTSMSG));
@@ -776,7 +776,7 @@ static INT_PTR CALLBACK DlgProcOpts6(HWND hwndDlg, UINT msg, WPARAM wParam, LPAR
for (int i = 0; i < found; i++)
{
//id auslesen
- mir_snprintf(temp, SIZEOF(temp), "gameid_%d", i);
+ mir_snprintf(temp, _countof(temp), "gameid_%d", i);
int gameid = db_get_w(NULL, protocolname, temp, 0);
//spielnamen auslesen
xgamelist.getGamename(gameid, temp, XFIRE_MAXSIZEOFGAMENAME);
@@ -983,18 +983,18 @@ static INT_PTR CALLBACK DlgProcOpts6(HWND hwndDlg, UINT msg, WPARAM wParam, LPAR
//gameskip wert setzen
char temp[64] = "";
- mir_snprintf(temp, SIZEOF(temp), "gameskip_%d", gameid);
+ mir_snprintf(temp, _countof(temp), "gameskip_%d", gameid);
CheckDlgButton(hwndDlg, IDC_DONTDETECT, db_get_b(NULL, protocolname, temp, 0) ? BST_CHECKED : BST_UNCHECKED);
- mir_snprintf(temp, SIZEOF(temp), "gamenostatus_%d", gameid);
+ mir_snprintf(temp, _countof(temp), "gamenostatus_%d", gameid);
CheckDlgButton(hwndDlg, IDC_NOSTATUSMSG, db_get_b(NULL, protocolname, temp, 0) ? BST_CHECKED : BST_UNCHECKED);
- mir_snprintf(temp, SIZEOF(temp), "notinstartmenu_%d", gameid);
+ mir_snprintf(temp, _countof(temp), "notinstartmenu_%d", gameid);
CheckDlgButton(hwndDlg, IDC_NOTINSTARTMENU, db_get_b(NULL, protocolname, temp, 0) ? BST_CHECKED : BST_UNCHECKED);
//extra parameter auslesen, aber nur, wenn das spiel auch sowas unterstützt
if (xgtemp && xgtemp->haveExtraGameArgs())
{
EnableDlgItem(hwndDlg, IDC_EXTRAPARAMS, TRUE);
- mir_snprintf(temp, SIZEOF(temp), "gameextraparams_%d", gameid);
+ mir_snprintf(temp, _countof(temp), "gameextraparams_%d", gameid);
DBVARIANT dbv;
if (!db_get(NULL, protocolname, temp, &dbv))
{
@@ -1035,7 +1035,7 @@ static INT_PTR CALLBACK DlgProcOpts6(HWND hwndDlg, UINT msg, WPARAM wParam, LPAR
//extra parameter auslesen und das gameobj schreiben
char str[128] = "";
- GetDlgItemTextA(hwndDlg, IDC_EXTRAPARAMS, str, SIZEOF(str));
+ GetDlgItemTextA(hwndDlg, IDC_EXTRAPARAMS, str, _countof(str));
if (str[0] != 0)
{
//extra parameter sind gesetzt, zuweisen
diff --git a/protocols/Xfire/src/passworddialog.cpp b/protocols/Xfire/src/passworddialog.cpp
index 4be5760eef..fac061f214 100644
--- a/protocols/Xfire/src/passworddialog.cpp
+++ b/protocols/Xfire/src/passworddialog.cpp
@@ -15,7 +15,7 @@ INT_PTR CALLBACK DlgPWProc(HWND hwndDlg, UINT msg, WPARAM wParam, LPARAM lParam)
{
GetDlgItemTextA(hwndDlg, IDC_PWSTRING, (LPSTR)pw, 254);
if (usenick)
- GetDlgItemTextA(hwndDlg, IDC_PWNICK, (LPSTR)nick, SIZEOF(nick));
+ GetDlgItemTextA(hwndDlg, IDC_PWNICK, (LPSTR)nick, _countof(nick));
EndDialog(hwndDlg, (INT_PTR)pw);
break;
}
diff --git a/protocols/Xfire/src/processbuddyinfo.cpp b/protocols/Xfire/src/processbuddyinfo.cpp
index 26b9697d71..788991c7db 100644
--- a/protocols/Xfire/src/processbuddyinfo.cpp
+++ b/protocols/Xfire/src/processbuddyinfo.cpp
@@ -58,7 +58,7 @@ void ProcessBuddyInfo(xfirelib::BuddyInfoPacket *buddyinfo, MCONTACT hcontact, c
mir_strcat(filename, ".gif");
type = PA_FORMAT_GIF;
- mir_snprintf(temp, SIZEOF(temp), "/xfire/xf/images/avatars/gallery/default/%03d.gif", buddyinfo->avatarid);
+ mir_snprintf(temp, _countof(temp), "/xfire/xf/images/avatars/gallery/default/%03d.gif", buddyinfo->avatarid);
dl = GetWWWContent("media.xfire.com", temp, filename, FALSE);
break;
@@ -67,7 +67,7 @@ void ProcessBuddyInfo(xfirelib::BuddyInfoPacket *buddyinfo, MCONTACT hcontact, c
mir_strcat(filename, ".jpg");
type = PA_FORMAT_JPEG;
- mir_snprintf(temp, SIZEOF(temp), "/avatar/100/%s.jpg?%d", username, buddyinfo->avatarid);
+ mir_snprintf(temp, _countof(temp), "/avatar/100/%s.jpg?%d", username, buddyinfo->avatarid);
dl = GetWWWContent("screenshot.xfire.com", temp, filename, FALSE);
break;
@@ -75,7 +75,7 @@ void ProcessBuddyInfo(xfirelib::BuddyInfoPacket *buddyinfo, MCONTACT hcontact, c
type = PA_FORMAT_GIF;
mir_strcat(filename, "xfire.gif");
- mir_snprintf(temp, SIZEOF(temp), "/xfire/xf/images/avatars/gallery/default/xfire.gif", buddyinfo->avatarid);
+ mir_snprintf(temp, _countof(temp), "/xfire/xf/images/avatars/gallery/default/xfire.gif", buddyinfo->avatarid);
dl = GetWWWContent("media.xfire.com", temp, filename, TRUE);
break;
diff --git a/protocols/Xfire/src/pwd_dlg.cpp b/protocols/Xfire/src/pwd_dlg.cpp
index 31108404a8..3703e6caa1 100644
--- a/protocols/Xfire/src/pwd_dlg.cpp
+++ b/protocols/Xfire/src/pwd_dlg.cpp
@@ -20,7 +20,7 @@ INT_PTR CALLBACK DlgPwProc(HWND hwndDlg, UINT msg, WPARAM wParam, LPARAM lParam)
{
if (LOWORD(wParam) == IDOK)
{
- GetDlgItemTextA(hwndDlg, IDC_NICKNAME, password, SIZEOF(password));
+ GetDlgItemTextA(hwndDlg, IDC_NICKNAME, password, _countof(password));
EndDialog(hwndDlg, TRUE);
return TRUE;
}
diff --git a/protocols/Xfire/src/searching4games.cpp b/protocols/Xfire/src/searching4games.cpp
index 01fb52f082..0be853b828 100644
--- a/protocols/Xfire/src/searching4games.cpp
+++ b/protocols/Xfire/src/searching4games.cpp
@@ -69,9 +69,9 @@ BOOL CheckPath(char*ppath, char*pathwildcard = NULL)
strncpy(temp, ppath,XFIRE_MAX_STATIC_STRING_LEN-1);
*(temp + mir_strlen(temp) - 1) = 0;
- mir_strncat(temp, wfd.cFileName, SIZEOF(temp) - mir_strlen(temp));
- mir_strncat(temp, "\\", SIZEOF(temp) - mir_strlen(temp));
- mir_strncat(temp, pos, SIZEOF(temp) - mir_strlen(temp));
+ mir_strncat(temp, wfd.cFileName, _countof(temp) - mir_strlen(temp));
+ mir_strncat(temp, "\\", _countof(temp) - mir_strlen(temp));
+ mir_strncat(temp, pos, _countof(temp) - mir_strlen(temp));
if (GetFileAttributesA(temp) != 0xFFFFFFFF) { //exe vorhanden???? unt hint?
//gefundenes in path kopieren
@@ -253,9 +253,9 @@ void Scan4Games(LPVOID lparam)
{
//2 gameids?
if (split)
- mir_snprintf(temp, SIZEOF(temp), "%i_%i", i, i2);
+ mir_snprintf(temp, _countof(temp), "%i_%i", i, i2);
else
- mir_snprintf(temp, SIZEOF(temp), "%i", i);
+ mir_snprintf(temp, _countof(temp), "%i", i);
//MessageBox(0,temp,temp,0);
@@ -467,7 +467,7 @@ void Scan4Games(LPVOID lparam)
multiexe = FALSE;
for (int i = 1; i < 9; i++)
{
- mir_snprintf(ret, SIZEOF(ret), "DetectExe[%d]", i);
+ mir_snprintf(ret, _countof(ret), "DetectExe[%d]", i);
if (xfire_GetPrivateProfileString(temp, ret, "", ret2, 512, inipath))
{
char* pos = strrchr(path, '\\');
@@ -550,7 +550,7 @@ void Scan4Games(LPVOID lparam)
newgame->setString(ret2, &newgame->launchparams);
//soll alle string, welche nicht in der commandline eines spiels sein soll in einen string pakcen semikolon getrennt
- mir_snprintf(ret, SIZEOF(ret), "CommandLineMustNotContain[0]");
+ mir_snprintf(ret, _countof(ret), "CommandLineMustNotContain[0]");
int i = 0;
while (xfire_GetPrivateProfileString(temp, ret, "", ret2, 512, inipath))
@@ -561,7 +561,7 @@ void Scan4Games(LPVOID lparam)
newgame->appendString(ret2, &newgame->notcontain);
i++;
- mir_snprintf(ret, SIZEOF(ret), "CommandLineMustNotContain[%d]", i);
+ mir_snprintf(ret, _countof(ret), "CommandLineMustNotContain[%d]", i);
}
newgame->setNameandIcon();
@@ -652,7 +652,7 @@ void Scan4Games(LPVOID lparam)
newgame->setstatusmsg = atoi(ret2);
//soll alle string, welche nicht in der commandline eines spiels sein soll in einen string pakcen semikolon getrennt
- mir_snprintf(ret, SIZEOF(ret), "CommandLineMustNotContain[0]");
+ mir_snprintf(ret, _countof(ret), "CommandLineMustNotContain[0]");
int i = 0;
while (xfire_GetPrivateProfileString(temp, ret, "", ret2, 512, inipath))
@@ -663,7 +663,7 @@ void Scan4Games(LPVOID lparam)
newgame->appendString(ret2, &newgame->notcontain);
i++;
- mir_snprintf(ret, SIZEOF(ret), "CommandLineMustNotContain[%d]", i);
+ mir_snprintf(ret, _countof(ret), "CommandLineMustNotContain[%d]", i);
}
newgame->setNameandIcon();
@@ -725,7 +725,7 @@ void Scan4Games(LPVOID lparam)
int p = mir_strlen(gamelist) - 2;
if (p > -1)
gamelist[p] = 0; //letztes koma killen
- mir_snprintf(ret, SIZEOF(ret), Translate("Games found:%s%s"), "\r\n\r\n", gamelist);
+ mir_snprintf(ret, _countof(ret), Translate("Games found:%s%s"), "\r\n\r\n", gamelist);
MSGBOX(ret);
}
diff --git a/protocols/Xfire/src/setnickname.cpp b/protocols/Xfire/src/setnickname.cpp
index bfd5d3465a..d4eecf58c3 100644
--- a/protocols/Xfire/src/setnickname.cpp
+++ b/protocols/Xfire/src/setnickname.cpp
@@ -24,7 +24,7 @@ INT_PTR CALLBACK DlgNickProc(HWND hwndDlg, UINT msg, WPARAM wParam, LPARAM lPara
if (LOWORD(wParam) == IDOK)
{
char nick[255];
- GetDlgItemTextA(hwndDlg, IDC_NICKNAME, nick, SIZEOF(nick));
+ GetDlgItemTextA(hwndDlg, IDC_NICKNAME, nick, _countof(nick));
CallService(XFIRE_SET_NICK, 0, (LPARAM)nick);
diff --git a/protocols/Xfire/src/tools.cpp b/protocols/Xfire/src/tools.cpp
index ebd202f4d7..a38a70fe82 100644
--- a/protocols/Xfire/src/tools.cpp
+++ b/protocols/Xfire/src/tools.cpp
@@ -100,8 +100,8 @@ int displayPopup(HWND hWnd, LPCSTR lpText, LPCSTR lpCaption, UINT uType, HICON h
bIconsNotLoaded = FALSE;
}
- mir_tstrncpy(ppd.lptzContactName, _A2T(lpCaption), SIZEOF(ppd.lptzContactName));
- mir_tstrncpy(ppd.lptzText, _A2T(lpText), SIZEOF(ppd.lptzText));
+ mir_tstrncpy(ppd.lptzContactName, _A2T(lpCaption), _countof(ppd.lptzContactName));
+ mir_tstrncpy(ppd.lptzText, _A2T(lpText), _countof(ppd.lptzText));
if ((uType & MB_ICONMASK) == MB_ICONSTOP) {
ppd.lchIcon = hicError;
diff --git a/protocols/Xfire/src/userdetails.cpp b/protocols/Xfire/src/userdetails.cpp
index 37840a72c1..49e2cd2875 100644
--- a/protocols/Xfire/src/userdetails.cpp
+++ b/protocols/Xfire/src/userdetails.cpp
@@ -45,7 +45,7 @@ void LoadProfilStatus(void *arg) {
//dl
char url[255];
- mir_snprintf(url, SIZEOF(url),"http://miniprofile.xfire.com/bg/sh/type/1/%s.png",fname);
+ mir_snprintf(url, _countof(url),"http://miniprofile.xfire.com/bg/sh/type/1/%s.png",fname);
char* buf = NULL;
unsigned int size = 0;
@@ -68,7 +68,7 @@ void SetItemTxt(HWND hwndDlg, int feldid, char*feld, MCONTACT hcontact, int type
if (type == 1)
{
char temp[255];
- mir_snprintf(temp, SIZEOF(temp), "%i", dbv.wVal);
+ mir_snprintf(temp, _countof(temp), "%i", dbv.wVal);
SetDlgItemTextA(hwndDlg, feldid, temp);
}
else
@@ -95,7 +95,7 @@ static int GetIPPortUDetails(MCONTACT hContact, char* feld1, char* feld2)
return 0;
char temp[255];
- mir_snprintf(temp, SIZEOF(temp), "%s:%d", dbv.pszVal, db_get_w(hContact, protocolname, feld2, -1));
+ mir_snprintf(temp, _countof(temp), "%s:%d", dbv.pszVal, db_get_w(hContact, protocolname, feld2, -1));
db_free(&dbv);
if (OpenClipboard(NULL)) {
@@ -380,30 +380,30 @@ char status[256]="";
char game[512]="";
if (!db_get(hContact,"ContactPhoto","File",&dbv))
{
-mir_snprintf(img,SIZEOF(img),"<img src=\"%s\">",dbv.pszVal);
+mir_snprintf(img,_countof(img),"<img src=\"%s\">",dbv.pszVal);
db_free(&dbv);
}
if (!db_get(hContact,protocolname,"Username",&dbv))
{
-mir_snprintf(username,SIZEOF(username),"<b>Username:</b> %s<br>",dbv.pszVal);
+mir_snprintf(username,_countof(username),"<b>Username:</b> %s<br>",dbv.pszVal);
db_free(&dbv);
}
if (!db_get(hContact,protocolname,"Nick",&dbv))
{
-mir_snprintf(nick,SIZEOF(nick),"<b>Nick:</b> %s<br>",dbv.pszVal);
+mir_snprintf(nick,_countof(nick),"<b>Nick:</b> %s<br>",dbv.pszVal);
db_free(&dbv);
}
if (!db_get(hContact,protocolname,"XStatusMsg",&dbv))
{
-mir_snprintf(status,SIZEOF(status),"<b>Status:</b> %s<br>",dbv.pszVal);
+mir_snprintf(status,_countof(status),"<b>Status:</b> %s<br>",dbv.pszVal);
db_free(&dbv);
}
if (!db_get(hContact,protocolname,"RGame",&dbv))
{
-mir_snprintf(game,SIZEOF(game),"<fieldset style='border:1px solid #0091d5;background-color:#0d2c3e;margin-bottom:8px;'><legend>Spiel</legend><table><tr><td valign=top style='font-family:Arial;font-size:11px;color:#fff;'><b><u>%s</u></b></td></tr></table></fieldset>",dbv.pszVal);
+mir_snprintf(game,_countof(game),"<fieldset style='border:1px solid #0091d5;background-color:#0d2c3e;margin-bottom:8px;'><legend>Spiel</legend><table><tr><td valign=top style='font-family:Arial;font-size:11px;color:#fff;'><b><u>%s</u></b></td></tr></table></fieldset>",dbv.pszVal);
db_free(&dbv);
}
-mir_snprintf(profil,SIZEOF(profil),"mshtml:<div style='position:absolute;top:0;left:0;border:1px solid #0091d5;background-color:#000;padding:6px;width:334px;height:249px'><table><tr><td valign=top>%s</td><td valign=top style='font-family:Arial;font-size:11px;color:#fff;'>%s%s%s</td></tr><tr><td valign=top colspan=\"2\" style='font-family:Arial;font-size:11px;color:#fff;'>%s%s</td></tr></table></div>",img,username,nick,status,game);
+mir_snprintf(profil,_countof(profil),"mshtml:<div style='position:absolute;top:0;left:0;border:1px solid #0091d5;background-color:#000;padding:6px;width:334px;height:249px'><table><tr><td valign=top>%s</td><td valign=top style='font-family:Arial;font-size:11px;color:#fff;'>%s%s%s</td></tr><tr><td valign=top colspan=\"2\" style='font-family:Arial;font-size:11px;color:#fff;'>%s%s</td></tr></table></div>",img,username,nick,status,game);
HWND hWnd = ::CreateWindow("AtlAxWin", profil,
WS_CHILD|WS_VISIBLE, 0, 0, 334, 249, hwndDlg, NULL,
::GetModuleHandle(NULL), NULL);
diff --git a/protocols/Xfire/src/variables.cpp b/protocols/Xfire/src/variables.cpp
index 86b5138bc9..e77c4e22b2 100644
--- a/protocols/Xfire/src/variables.cpp
+++ b/protocols/Xfire/src/variables.cpp
@@ -108,7 +108,7 @@ char* Varxfireserverip(ARGUMENTSINFO *ai) {
DBVARIANT dbv3;
if (!db_get(ai->fi->hContact, protocolname, "ServerIP", &dbv3))
{
- mir_snprintf(temp, SIZEOF(temp), "%s:%d", dbv3.pszVal, db_get_w(ai->fi->hContact, protocolname, "Port", 0));
+ mir_snprintf(temp, _countof(temp), "%s:%d", dbv3.pszVal, db_get_w(ai->fi->hContact, protocolname, "Port", 0));
db_free(&dbv3);
return mir_strdup(temp);
}
@@ -133,7 +133,7 @@ char* Varxfirevoiceip(ARGUMENTSINFO *ai) {
DBVARIANT dbv3;
if (!db_get(ai->fi->hContact, protocolname, "VServerIP", &dbv3))
{
- mir_snprintf(temp, SIZEOF(temp), "%s:%d", dbv3.pszVal, db_get_w(ai->fi->hContact, protocolname, "VPort", 0));
+ mir_snprintf(temp, _countof(temp), "%s:%d", dbv3.pszVal, db_get_w(ai->fi->hContact, protocolname, "VPort", 0));
db_free(&dbv3);
return mir_strdup(temp);
}
diff --git a/protocols/Yahoo/src/avatar.cpp b/protocols/Yahoo/src/avatar.cpp
index 35af086732..002764f165 100644
--- a/protocols/Yahoo/src/avatar.cpp
+++ b/protocols/Yahoo/src/avatar.cpp
@@ -126,8 +126,8 @@ void CYahooProto::SendAvatar(const TCHAR *szFile)
sf->filesize = statbuf.st_size;
wchar_t tszFilename[MAX_PATH];
- wcsncpy(tszFilename, szFile, SIZEOF(tszFilename) - 1);
- GetShortPathNameW(szFile, tszFilename, SIZEOF(tszFilename));
+ wcsncpy(tszFilename, szFile, _countof(tszFilename) - 1);
+ GetShortPathNameW(szFile, tszFilename, _countof(tszFilename));
char szFilename[MAX_PATH];
WideCharToMultiByte(CP_ACP, 0, tszFilename, -1, szFilename, MAX_PATH, 0, 0);
sf->filename = strdup(szFilename);
@@ -468,7 +468,7 @@ void CYahooProto::ext_got_picture_checksum(const char *me, const char *who, int
// Need to delete the Avatar File!!
TCHAR szFile[MAX_PATH];
- GetAvatarFileName(hContact, szFile, SIZEOF(szFile) - 1, 0);
+ GetAvatarFileName(hContact, szFile, _countof(szFile) - 1, 0);
DeleteFile(szFile);
// Reset the avatar and cleanup.
@@ -651,7 +651,7 @@ INT_PTR __cdecl CYahooProto::GetAvatarInfo(WPARAM wParam, LPARAM lParam)
if (getDword(pai->hContact, "PictCK", 0) == 0)
return GAIR_NOAVATAR;
- GetAvatarFileName(pai->hContact, pai->filename, SIZEOF(pai->filename), getByte(pai->hContact, "AvatarType", 0));
+ GetAvatarFileName(pai->hContact, pai->filename, _countof(pai->filename), getByte(pai->hContact, "AvatarType", 0));
pai->format = PA_FORMAT_PNG;
debugLogA("[YAHOO_GETAVATARINFO] filename: %s", pai->filename);
diff --git a/protocols/Yahoo/src/chat.cpp b/protocols/Yahoo/src/chat.cpp
index f29c2b99cb..f1a576055f 100644
--- a/protocols/Yahoo/src/chat.cpp
+++ b/protocols/Yahoo/src/chat.cpp
@@ -54,7 +54,7 @@ void CALLBACK ConferenceRequestCB(PVOID dwParam);
void ext_yahoo_got_conf_invite(int id, const char *me, const char *who, const char *room, const char *msg, YList *members)
{
char z[1024];
- mir_snprintf(z, SIZEOF(z), Translate("[miranda] Got conference invite to room: %s with msg: %s"), room ? room : "", msg ? msg : "");
+ mir_snprintf(z, _countof(z), Translate("[miranda] Got conference invite to room: %s with msg: %s"), room ? room : "", msg ? msg : "");
LOG(("[ext_yahoo_got_conf_invite] %s", z));
CYahooProto* ppro = getProtoById(id);
@@ -91,7 +91,7 @@ void ext_yahoo_conf_userdecline(int id, const char *me, const char *who, const c
TCHAR info[1024];
TCHAR *whot = mir_utf8decodeT(who);
TCHAR *msgt = mir_utf8decodeT(msg);
- mir_sntprintf(info, SIZEOF(info), TranslateT("%s denied invitation with message: %s"), whot, msgt ? msgt : _T(""));
+ mir_sntprintf(info, _countof(info), TranslateT("%s denied invitation with message: %s"), whot, msgt ? msgt : _T(""));
GETPROTOBYID(id)->ChatEvent(room, who, GC_EVENT_INFORMATION, info);
mir_free(msgt);
mir_free(whot);
@@ -342,7 +342,7 @@ int __cdecl CYahooProto::OnGCMenuHook(WPARAM, LPARAM lParam)
{ TranslateT("&Invite user..."), 10, MENU_ITEM, FALSE },
{ TranslateT("&Leave chat session"), 20, MENU_ITEM, FALSE }
};
- gcmi->nItems = SIZEOF(Items);
+ gcmi->nItems = _countof(Items);
gcmi->Item = (gc_item*)Items;
}
else if (gcmi->Type == MENU_ON_NICKLIST) {
@@ -355,7 +355,7 @@ int __cdecl CYahooProto::OnGCMenuHook(WPARAM, LPARAM lParam)
{ _T(""), 100, MENU_SEPARATOR, FALSE },
{ TranslateT("&Leave chat session"), 110, MENU_ITEM, FALSE }
};
- gcmi->nItems = SIZEOF(Items);
+ gcmi->nItems = _countof(Items);
gcmi->Item = (gc_item*)Items;
}
else {
@@ -364,7 +364,7 @@ int __cdecl CYahooProto::OnGCMenuHook(WPARAM, LPARAM lParam)
{ TranslateT("User &details"), 10, MENU_ITEM, FALSE },
{ TranslateT("User &history"), 20, MENU_ITEM, FALSE }
};
- gcmi->nItems = SIZEOF(Items);
+ gcmi->nItems = _countof(Items);
gcmi->Item = (gc_item*)Items;
}
mir_free(id);
@@ -501,7 +501,7 @@ INT_PTR CALLBACK InviteToChatDialog(HWND hwndDlg, UINT msg, WPARAM wParam, LPARA
case IDC_ADDSCR:
if (param->ppro->m_bLoggedIn) {
TCHAR sn[64];
- GetDlgItemText(hwndDlg, IDC_EDITSCR, sn, SIZEOF(sn));
+ GetDlgItemText(hwndDlg, IDC_EDITSCR, sn, _countof(sn));
CLCINFOITEM cii = { 0 };
cii.cbSize = sizeof(cii);
@@ -516,7 +516,7 @@ INT_PTR CALLBACK InviteToChatDialog(HWND hwndDlg, UINT msg, WPARAM wParam, LPARA
case IDOK:
{
TCHAR msg[1024];
- GetDlgItemText(hwndDlg, IDC_MSG, msg, SIZEOF(msg));
+ GetDlgItemText(hwndDlg, IDC_MSG, msg, _countof(msg));
HWND hwndList = GetDlgItem(hwndDlg, IDC_CCLIST);
YList *who = NULL;
@@ -589,7 +589,7 @@ INT_PTR CALLBACK ChatRequestDialog(HWND hwndDlg, UINT msg, WPARAM wParam, LPARAM
case IDCANCEL:
if (cm) {
TCHAR msg[1024];
- GetDlgItemText(hwndDlg, IDC_MSG2, msg, SIZEOF(msg));
+ GetDlgItemText(hwndDlg, IDC_MSG2, msg, _countof(msg));
yahoo_conference_decline(param->ppro->m_id, NULL, cm->members, param->room, T2Utf(msg));
param->ppro->m_chatrooms.remove((CYahooProto::ChatRoom*)&param->room);
@@ -612,7 +612,7 @@ static void CALLBACK ConferenceRequestCB(PVOID pParam)
INT_PTR __cdecl CYahooProto::CreateConference(WPARAM /*wParam*/, LPARAM /*lParam*/)
{
char room[128];
- mir_snprintf(room, SIZEOF(room), "%s-%u", m_yahoo_id, time(NULL));
+ mir_snprintf(room, _countof(room), "%s-%u", m_yahoo_id, time(NULL));
InviteChatParam* param = new InviteChatParam(room, this);
DialogBoxParam(hInstance, MAKEINTRESOURCE(IDD_CHATROOM_INVITE), NULL,
diff --git a/protocols/Yahoo/src/file_transfer.cpp b/protocols/Yahoo/src/file_transfer.cpp
index fc6a6ae290..91083d9568 100644
--- a/protocols/Yahoo/src/file_transfer.cpp
+++ b/protocols/Yahoo/src/file_transfer.cpp
@@ -299,7 +299,7 @@ static void dl_file(int id, INT_PTR fd, int error, const char *filename, unsigne
*
* Don't rely on workingDir to be right, since it's not used to check if file exists.
*/
- mir_sntprintf(filefull, SIZEOF(filefull), _T("%s\\%s"), sf->pfts.tszWorkingDir, sf->pfts.tszCurrentFile);
+ mir_sntprintf(filefull, _countof(filefull), _T("%s\\%s"), sf->pfts.tszWorkingDir, sf->pfts.tszCurrentFile);
FREE(sf->pfts.tszCurrentFile);
sf->pfts.tszCurrentFile = _tcsdup(filefull);
@@ -545,7 +545,7 @@ void CYahooProto::ext_got_files(const char *me, const char *who, const char *ft_
char z[1024];
struct yahoo_file_info *fi = (struct yahoo_file_info *) f->data;
- mir_snprintf(z, SIZEOF(z), "%s (%lu)\r\n", fi->filename, fi->filesize);
+ mir_snprintf(z, _countof(z), "%s (%lu)\r\n", fi->filename, fi->filesize);
mir_strcat(fn, z);
fc++;
}
diff --git a/protocols/Yahoo/src/icolib.cpp b/protocols/Yahoo/src/icolib.cpp
index 85ec6ec28e..74aca39d1a 100644
--- a/protocols/Yahoo/src/icolib.cpp
+++ b/protocols/Yahoo/src/icolib.cpp
@@ -30,19 +30,19 @@ static IconItem iconList[] =
void CYahooProto::IconsInit(void)
{
- Icon_Register(hInstance, "Protocols/YAHOO", iconList, SIZEOF(iconList), "YAHOO");
+ Icon_Register(hInstance, "Protocols/YAHOO", iconList, _countof(iconList), "YAHOO");
}
HICON CYahooProto::LoadIconEx(const char* name, bool big)
{
char szSettingName[100];
- mir_snprintf(szSettingName, SIZEOF(szSettingName), "YAHOO_%s", name);
+ mir_snprintf(szSettingName, _countof(szSettingName), "YAHOO_%s", name);
return IcoLib_GetIcon(szSettingName, big);
}
HANDLE CYahooProto::GetIconHandle(int iconId)
{
- for (unsigned i = 0; i < SIZEOF(iconList); i++)
+ for (unsigned i = 0; i < _countof(iconList); i++)
if (iconList[i].defIconID == iconId)
return iconList[i].hIcolib;
@@ -52,6 +52,6 @@ HANDLE CYahooProto::GetIconHandle(int iconId)
void CYahooProto::ReleaseIconEx(const char* name, bool big)
{
char szSettingName[100];
- mir_snprintf(szSettingName, SIZEOF(szSettingName), "YAHOO_%s", name);
+ mir_snprintf(szSettingName, _countof(szSettingName), "YAHOO_%s", name);
IcoLib_Release(szSettingName, big);
}
diff --git a/protocols/Yahoo/src/im.cpp b/protocols/Yahoo/src/im.cpp
index 5192666321..db6ead3956 100644
--- a/protocols/Yahoo/src/im.cpp
+++ b/protocols/Yahoo/src/im.cpp
@@ -40,7 +40,7 @@ void CYahooProto::ext_got_im(const char *me, const char *who, int protocol, cons
if (stat == 2) {
char z[1024];
- mir_snprintf(z, SIZEOF(z), "Error sending message to %s", who);
+ mir_snprintf(z, _countof(z), "Error sending message to %s", who);
LOG((z));
ShowError(TranslateT("Yahoo Error"), _A2T(z));
return;
diff --git a/protocols/Yahoo/src/options.cpp b/protocols/Yahoo/src/options.cpp
index f8eeab9976..085c488add 100644
--- a/protocols/Yahoo/src/options.cpp
+++ b/protocols/Yahoo/src/options.cpp
@@ -97,7 +97,7 @@ static INT_PTR CALLBACK DlgProcYahooOpts(HWND hwndDlg, UINT msg, WPARAM wParam,
bool reconnectRequired = false;
char str[128];
- GetDlgItemTextA(hwndDlg, IDC_HANDLE, str, SIZEOF(str));
+ GetDlgItemTextA(hwndDlg, IDC_HANDLE, str, _countof(str));
if (ppro->getString(YAHOO_LOGINID, &dbv)) {
reconnectRequired = true;
}
@@ -108,7 +108,7 @@ static INT_PTR CALLBACK DlgProcYahooOpts(HWND hwndDlg, UINT msg, WPARAM wParam,
}
ppro->setString(YAHOO_LOGINID, str);
- GetDlgItemTextA(hwndDlg, IDC_PASSWORD, str, SIZEOF(str));
+ GetDlgItemTextA(hwndDlg, IDC_PASSWORD, str, _countof(str));
if (ppro->getString(YAHOO_PASSWORD, &dbv)) {
reconnectRequired = true;
}
@@ -119,7 +119,7 @@ static INT_PTR CALLBACK DlgProcYahooOpts(HWND hwndDlg, UINT msg, WPARAM wParam,
}
ppro->setString(YAHOO_PASSWORD, str);
- GetDlgItemTextA(hwndDlg, IDC_NICK, str, SIZEOF(str));
+ GetDlgItemTextA(hwndDlg, IDC_NICK, str, _countof(str));
if (str[0] == '\0') {
@@ -213,7 +213,7 @@ YAHOO_DEFAULT_JAPAN_LOGIN_SERVER :
if (((LPNMHDR)lParam)->code == PSN_APPLY) {
bool reconnectRequired = false;
char str[128];
- GetDlgItemTextA(hwndDlg, IDC_LOGINSERVER, str, SIZEOF(str));
+ GetDlgItemTextA(hwndDlg, IDC_LOGINSERVER, str, _countof(str));
DBVARIANT dbv;
if (ppro->getString(YAHOO_LOGINSERVER, &dbv)) {
@@ -303,7 +303,7 @@ static INT_PTR CALLBACK DlgProcYahooOptsIgnore(HWND hwndDlg, UINT msg, WPARAM wP
MessageBox(hwndDlg, TranslateT("You need to be connected to Yahoo to add to Ignore List."), TranslateT("Yahoo Ignore"), MB_OK | MB_ICONINFORMATION);
else {
char id[128];
- int i = GetDlgItemTextA(hwndDlg, IDC_YIGN_EDIT, id, SIZEOF(id));
+ int i = GetDlgItemTextA(hwndDlg, IDC_YIGN_EDIT, id, _countof(id));
if (i < 3) {
MessageBox(hwndDlg, TranslateT("Please enter a valid buddy name to ignore."), TranslateT("Yahoo Ignore"), MB_OK | MB_ICONINFORMATION);
diff --git a/protocols/Yahoo/src/proto.cpp b/protocols/Yahoo/src/proto.cpp
index 0ebea61427..0689e010b3 100644
--- a/protocols/Yahoo/src/proto.cpp
+++ b/protocols/Yahoo/src/proto.cpp
@@ -68,7 +68,7 @@ int CYahooProto::OnModulesLoadedEx(WPARAM, LPARAM)
HookProtoEvent(ME_CLIST_PREBUILDCONTACTMENU, &CYahooProto::OnPrebuildContactMenu);
TCHAR tModuleDescr[100];
- mir_sntprintf(tModuleDescr, SIZEOF(tModuleDescr), TranslateT("%s plugin connections"), m_tszUserName);
+ mir_sntprintf(tModuleDescr, _countof(tModuleDescr), TranslateT("%s plugin connections"), m_tszUserName);
NETLIBUSER nlu = { 0 };
nlu.cbSize = sizeof(nlu);
@@ -707,7 +707,7 @@ INT_PTR CALLBACK first_run_dialog(HWND hwndDlg, UINT msg, WPARAM wParam, LPARAM
char str[128];
bool reconnectRequired = false;
- GetDlgItemTextA(hwndDlg, IDC_HANDLE, str, SIZEOF(str));
+ GetDlgItemTextA(hwndDlg, IDC_HANDLE, str, _countof(str));
if (ppro->getString(YAHOO_LOGINID, &dbv)) {
reconnectRequired = true;
@@ -719,7 +719,7 @@ INT_PTR CALLBACK first_run_dialog(HWND hwndDlg, UINT msg, WPARAM wParam, LPARAM
}
ppro->setString(YAHOO_LOGINID, str);
- GetDlgItemTextA(hwndDlg, IDC_PASSWORD, str, SIZEOF(str));
+ GetDlgItemTextA(hwndDlg, IDC_PASSWORD, str, _countof(str));
if (ppro->getString(YAHOO_PASSWORD, &dbv)) {
reconnectRequired = true;
diff --git a/protocols/Yahoo/src/search.cpp b/protocols/Yahoo/src/search.cpp
index b0ab4bae82..0e05230c5c 100644
--- a/protocols/Yahoo/src/search.cpp
+++ b/protocols/Yahoo/src/search.cpp
@@ -159,7 +159,7 @@ void __cdecl CYahooProto::searchadv_thread(void *pHWND)
HWND hwndDlg = (HWND)pHWND;
TCHAR searchid[128];
- GetDlgItemText(hwndDlg, IDC_SEARCH_ID, searchid, SIZEOF(searchid));
+ GetDlgItemText(hwndDlg, IDC_SEARCH_ID, searchid, _countof(searchid));
if (mir_tstrlen(searchid) == 0) {
ProtoBroadcastAck(NULL, ACKTYPE_SEARCH, ACKRESULT_SUCCESS, (HANDLE)1, 0);
diff --git a/protocols/Yahoo/src/services.cpp b/protocols/Yahoo/src/services.cpp
index 5900aea998..0155d8a3c6 100644
--- a/protocols/Yahoo/src/services.cpp
+++ b/protocols/Yahoo/src/services.cpp
@@ -146,7 +146,7 @@ static INT_PTR CALLBACK DlgProcSetCustStat(HWND hwndDlg, UINT msg, WPARAM wParam
CYahooProto* ppro = (CYahooProto*)GetWindowLongPtr(hwndDlg, GWLP_USERDATA);
/* Get String from dialog */
- GetDlgItemTextA(hwndDlg, IDC_CUSTSTAT, str, SIZEOF(str));
+ GetDlgItemTextA(hwndDlg, IDC_CUSTSTAT, str, _countof(str));
/* Save it for later use */
ppro->setString(YAHOO_CUSTSTATDB, str);
@@ -173,7 +173,7 @@ static INT_PTR CALLBACK DlgProcSetCustStat(HWND hwndDlg, UINT msg, WPARAM wParam
BOOL toSet;
- toSet = GetDlgItemTextA(hwndDlg, IDC_CUSTSTAT, str, SIZEOF(str)) != 0;
+ toSet = GetDlgItemTextA(hwndDlg, IDC_CUSTSTAT, str, _countof(str)) != 0;
EnableWindow(GetDlgItem(hwndDlg, IDOK), toSet);
}
@@ -224,7 +224,7 @@ void CYahooProto::OpenURL(const char *url, int autoLogin)
y = yahoo_urlencode(yahoo_get_cookie(m_id, "y"));
t = yahoo_urlencode(yahoo_get_cookie(m_id, "t"));
u = yahoo_urlencode(url);
- mir_snprintf(tUrl, SIZEOF(tUrl),
+ mir_snprintf(tUrl, _countof(tUrl),
"http://msg.edit.yahoo.com/config/reset_cookies?&.y=Y=%s&.t=T=%s&.ver=2&.done=http%%3a//us.rd.yahoo.com/messenger/client/%%3f%s",
y, t, u);
@@ -233,7 +233,7 @@ void CYahooProto::OpenURL(const char *url, int autoLogin)
FREE(u);
}
else {
- mir_snprintf(tUrl, SIZEOF(tUrl), url);
+ mir_snprintf(tUrl, _countof(tUrl), url);
}
debugLogA("[YahooOpenURL] url: %s Final URL: %s", url, tUrl);
@@ -259,7 +259,7 @@ INT_PTR __cdecl CYahooProto::OnShowProfileCommand(WPARAM wParam, LPARAM lParam)
if (getString(wParam, YAHOO_LOGINID, &dbv))
return 0;
- mir_snprintf(tUrl, SIZEOF(tUrl), "http://profiles.yahoo.com/%s", dbv.pszVal);
+ mir_snprintf(tUrl, _countof(tUrl), "http://profiles.yahoo.com/%s", dbv.pszVal);
db_free(&dbv);
OpenURL(tUrl, 0);
@@ -285,7 +285,7 @@ INT_PTR __cdecl CYahooProto::OnShowMyProfileCommand(WPARAM wParam, LPARAM lParam
}
char tUrl[4096];
- mir_snprintf(tUrl, SIZEOF(tUrl), "http://profiles.yahoo.com/%s", dbv.pszVal);
+ mir_snprintf(tUrl, _countof(tUrl), "http://profiles.yahoo.com/%s", dbv.pszVal);
db_free(&dbv);
OpenURL(tUrl, 0);
diff --git a/protocols/Yahoo/src/util.cpp b/protocols/Yahoo/src/util.cpp
index 098eae59e7..7a04f48e61 100644
--- a/protocols/Yahoo/src/util.cpp
+++ b/protocols/Yahoo/src/util.cpp
@@ -112,8 +112,8 @@ int CYahooProto::ShowPopup(const TCHAR* nickname, const TCHAR* msg, const char *
POPUPDATAT ppd = { 0 };
ppd.PluginWindowProc = PopupWindowProc;
- mir_tstrncpy(ppd.lptzContactName, nickname, SIZEOF(ppd.lptzContactName));
- mir_tstrncpy(ppd.lptzText, msg, SIZEOF(ppd.lptzText));
+ mir_tstrncpy(ppd.lptzContactName, nickname, _countof(ppd.lptzContactName));
+ mir_tstrncpy(ppd.lptzText, msg, _countof(ppd.lptzText));
if (szURL != NULL) {
ppd.lchIcon = LoadIconEx(!mir_strcmpi(szURL, "http://mail.yahoo.com") ? "mail" : "calendar");
diff --git a/protocols/Yahoo/src/yahoo.cpp b/protocols/Yahoo/src/yahoo.cpp
index 7e98c01909..1975b778be 100644
--- a/protocols/Yahoo/src/yahoo.cpp
+++ b/protocols/Yahoo/src/yahoo.cpp
@@ -519,7 +519,7 @@ void CYahooProto::ext_got_audible(const char *me, const char *who, const char *a
}
char z[1028];
- mir_snprintf(z, SIZEOF(z), "[miranda-audible] %s", msg ? msg : "");
+ mir_snprintf(z, _countof(z), "[miranda-audible] %s", msg ? msg : "");
ext_got_im((char*)me, (char*)who, 0, z, 0, 0, 1, -1, NULL, 0);
}
@@ -733,7 +733,7 @@ void CYahooProto::ext_contact_added(const char *myid, const char *who, const cha
nick[0] = '\0';
if (lname && fname)
- mir_snprintf(nick, SIZEOF(nick), "%s %s", fname, lname);
+ mir_snprintf(nick, _countof(nick), "%s %s", fname, lname);
else if (lname)
strncpy_s(nick, lname, _TRUNCATE);
else if (fname)
@@ -924,15 +924,15 @@ void CYahooProto::ext_mail_notify(const char *from, const char *subj, int cnt)
TCHAR z[MAX_SECONDLINE], title[MAX_CONTACTNAME];
if (from == NULL) {
- mir_sntprintf(title, SIZEOF(title), _T("%s: %s"), m_tszUserName, TranslateT("New Mail"));
- mir_sntprintf(z, SIZEOF(z), TranslateT("You have %i unread messages"), cnt);
+ mir_sntprintf(title, _countof(title), _T("%s: %s"), m_tszUserName, TranslateT("New Mail"));
+ mir_sntprintf(z, _countof(z), TranslateT("You have %i unread messages"), cnt);
}
else {
- mir_sntprintf(title, SIZEOF(title), TranslateT("New Mail (%i messages)"), cnt);
+ mir_sntprintf(title, _countof(title), TranslateT("New Mail (%i messages)"), cnt);
ptrT tszFrom(mir_utf8decodeT(from));
ptrT tszSubj(mir_utf8decodeT(subj));
- mir_sntprintf(z, SIZEOF(z), TranslateT("From: %s\nSubject: %s"), (TCHAR*)tszFrom, (TCHAR*)tszSubj);
+ mir_sntprintf(z, _countof(z), TranslateT("From: %s\nSubject: %s"), (TCHAR*)tszFrom, (TCHAR*)tszSubj);
}
if (!ShowPopup(title, z, "http://mail.yahoo.com"))
@@ -984,7 +984,7 @@ void ext_yahoo_got_cookies(int id)
//wsprintfA(z, "Cookie: %s; C=%s; Y=%s; T=%s", Bcookie, yahoo_get_cookie(id, "c"), yahoo_get_cookie(id, "y"), yahoo_get_cookie(id, "t"));
//wsprintfA(z, "Cookie: %s; Y=%s", Bcookie, yahoo_get_cookie(id, "y"), yahoo_get_cookie(id, "t"));
- mir_snprintf(z, SIZEOF(z), "Cookie: Y=%s; T=%s", yahoo_get_cookie(id, "y"), yahoo_get_cookie(id, "t"));
+ mir_snprintf(z, _countof(z), "Cookie: Y=%s; T=%s", yahoo_get_cookie(id, "y"), yahoo_get_cookie(id, "t"));
LOG(("Our Cookie: '%s'", z));
CallService(MS_NETLIB_SETSTICKYHEADERS, (WPARAM)hnuMain, (LPARAM)z);*/
@@ -993,7 +993,7 @@ void ext_yahoo_got_cookies(int id)
char z[1024];
// need to add Cookie header to our requests or we get booted w/ "Bad Cookie" message.
- mir_snprintf(z, SIZEOF(z), "Cookie: Y=%s; T=%s; C=%s", yahoo_get_cookie(id, "y"),
+ mir_snprintf(z, _countof(z), "Cookie: Y=%s; T=%s; C=%s", yahoo_get_cookie(id, "y"),
yahoo_get_cookie(id, "t"), yahoo_get_cookie(id, "c"));
LOG(("Our Cookie: '%s'", z));
CallService(MS_NETLIB_SETSTICKYHEADERS, (WPARAM)hNetlibUser, (LPARAM)z);
@@ -1235,7 +1235,7 @@ void CYahooProto::ext_send_http_request(enum yahoo_connection_type type, const c
if (nlhr.requestType == REQUEST_POST) {
httpHeaders[nlhr.headersCount].szName = "Content-Length";
- mir_snprintf(z, SIZEOF(z), "%d", content_length);
+ mir_snprintf(z, _countof(z), "%d", content_length);
httpHeaders[nlhr.headersCount].szValue = z;
nlhr.headersCount++;
@@ -1378,7 +1378,7 @@ char * CYahooProto::ext_send_https_request(struct yahoo_data *yd, const char *ho
char z[4096], *result = NULL;
int i;
- mir_snprintf(z, SIZEOF(z), "https://%s%s", host, path);
+ mir_snprintf(z, _countof(z), "https://%s%s", host, path);
nlhr.cbSize = sizeof(nlhr);
nlhr.requestType = REQUEST_GET;
nlhr.flags = NLHRF_HTTP11 | NLHRF_NODUMPSEND | NLHRF_DUMPASTEXT; /* Use HTTP/1.1 and don't dump the requests to the log */
@@ -1451,7 +1451,7 @@ void CYahooProto::ext_login(enum yahoo_status login_mode)
NETLIBHTTPREQUEST nlhr = { 0 }, *nlhrReply;
char z[4096];
- mir_snprintf(z, SIZEOF(z), "http://%s%s", getByte("YahooJapan", 0) != 0 ? "cs1.msg.vip.ogk.yahoo.co.jp" : "vcs.msg.yahoo.com", "/capacity");
+ mir_snprintf(z, _countof(z), "http://%s%s", getByte("YahooJapan", 0) != 0 ? "cs1.msg.vip.ogk.yahoo.co.jp" : "vcs.msg.yahoo.com", "/capacity");
nlhr.cbSize = sizeof(nlhr);
nlhr.requestType = REQUEST_GET;
nlhr.flags = NLHRF_HTTP11;
diff --git a/src/core/stdauth/src/auth.cpp b/src/core/stdauth/src/auth.cpp
index e2a4148e67..5d5d158d18 100644
--- a/src/core/stdauth/src/auth.cpp
+++ b/src/core/stdauth/src/auth.cpp
@@ -80,7 +80,7 @@ static int AuthEventAdded(WPARAM, LPARAM lParam)
break;
case CNFT_DWORD:
- mir_sntprintf(szUid, SIZEOF(szUid), _T("%u"), ci.dVal);
+ mir_sntprintf(szUid, _countof(szUid), _T("%u"), ci.dVal);
break;
}
}
@@ -88,9 +88,9 @@ static int AuthEventAdded(WPARAM, LPARAM lParam)
if (dbei.eventType == EVENTTYPE_AUTHREQUEST) {
SkinPlaySound("AuthRequest");
if (szUid[0])
- mir_sntprintf(szTooltip, SIZEOF(szTooltip), TranslateT("%s requests authorization"), szUid);
+ mir_sntprintf(szTooltip, _countof(szTooltip), TranslateT("%s requests authorization"), szUid);
else
- mir_sntprintf(szTooltip, SIZEOF(szTooltip), TranslateT("%u requests authorization"), *(PDWORD)dbei.pBlob);
+ mir_sntprintf(szTooltip, _countof(szTooltip), TranslateT("%u requests authorization"), *(PDWORD)dbei.pBlob);
cli.hIcon = Skin_LoadIcon(SKINICON_AUTH_REQUEST);
cli.pszService = MS_AUTH_SHOWREQUEST;
@@ -99,9 +99,9 @@ static int AuthEventAdded(WPARAM, LPARAM lParam)
else if (dbei.eventType == EVENTTYPE_ADDED) {
SkinPlaySound("AddedEvent");
if (szUid[0])
- mir_sntprintf(szTooltip, SIZEOF(szTooltip), TranslateT("%s added you to their contact list"), szUid);
+ mir_sntprintf(szTooltip, _countof(szTooltip), TranslateT("%s added you to their contact list"), szUid);
else
- mir_sntprintf(szTooltip, SIZEOF(szTooltip), TranslateT("%u added you to their contact list"), *(PDWORD)dbei.pBlob);
+ mir_sntprintf(szTooltip, _countof(szTooltip), TranslateT("%u added you to their contact list"), *(PDWORD)dbei.pBlob);
cli.hIcon = Skin_LoadIcon(SKINICON_AUTH_ADD);
cli.pszService = MS_AUTH_SHOWADDED;
diff --git a/src/core/stdauth/src/authdialogs.cpp b/src/core/stdauth/src/authdialogs.cpp
index 4d4674d81c..ddf2fdc738 100644
--- a/src/core/stdauth/src/authdialogs.cpp
+++ b/src/core/stdauth/src/authdialogs.cpp
@@ -63,14 +63,14 @@ INT_PTR CALLBACK DlgProcAdded(HWND hwndDlg, UINT msg, WPARAM wParam, LPARAM lPar
TCHAR name[128] = _T("");
int off = 0;
if (firstT[0] && lastT[0])
- off = mir_sntprintf(name, SIZEOF(name), _T("%s %s"), firstT, lastT);
+ off = mir_sntprintf(name, _countof(name), _T("%s %s"), firstT, lastT);
else if (firstT[0])
- off = mir_sntprintf(name, SIZEOF(name), _T("%s"), firstT);
+ off = mir_sntprintf(name, _countof(name), _T("%s"), firstT);
else if (lastT[0])
- off = mir_sntprintf(name, SIZEOF(name), _T("%s"), lastT);
+ off = mir_sntprintf(name, _countof(name), _T("%s"), lastT);
if (nickT[0]) {
if (off)
- mir_sntprintf(name + off, SIZEOF(name) - off, _T(" (%s)"), nickT);
+ mir_sntprintf(name + off, _countof(name) - off, _T(" (%s)"), nickT);
else
_tcsncpy_s(name, nickT, _TRUNCATE);
}
@@ -79,11 +79,11 @@ INT_PTR CALLBACK DlgProcAdded(HWND hwndDlg, UINT msg, WPARAM wParam, LPARAM lPar
TCHAR hdr[256];
if (uin && emailT[0])
- mir_sntprintf(hdr, SIZEOF(hdr), TranslateT("%s added you to the contact list\n%u (%s) on %s"), name, uin, emailT, acc->tszAccountName);
+ mir_sntprintf(hdr, _countof(hdr), TranslateT("%s added you to the contact list\n%u (%s) on %s"), name, uin, emailT, acc->tszAccountName);
else if (uin)
- mir_sntprintf(hdr, SIZEOF(hdr), TranslateT("%s added you to the contact list\n%u on %s"), name, uin, acc->tszAccountName);
+ mir_sntprintf(hdr, _countof(hdr), TranslateT("%s added you to the contact list\n%u on %s"), name, uin, acc->tszAccountName);
else
- mir_sntprintf(hdr, SIZEOF(hdr), TranslateT("%s added you to the contact list\n%s on %s"), name, emailT[0] ? emailT : TranslateT("(Unknown)"), acc->tszAccountName);
+ mir_sntprintf(hdr, _countof(hdr), TranslateT("%s added you to the contact list\n%s on %s"), name, emailT[0] ? emailT : TranslateT("(Unknown)"), acc->tszAccountName);
SetDlgItemText(hwndDlg, IDC_HEADERBAR, hdr);
@@ -188,14 +188,14 @@ INT_PTR CALLBACK DlgProcAuthReq(HWND hwndDlg, UINT msg, WPARAM wParam, LPARAM lP
TCHAR name[128] = _T("");
int off = 0;
if (firstT[0] && lastT[0])
- off = mir_sntprintf(name, SIZEOF(name), _T("%s %s"), (TCHAR*)firstT, (TCHAR*)lastT);
+ off = mir_sntprintf(name, _countof(name), _T("%s %s"), (TCHAR*)firstT, (TCHAR*)lastT);
else if (firstT[0])
- off = mir_sntprintf(name, SIZEOF(name), _T("%s"), (TCHAR*)firstT);
+ off = mir_sntprintf(name, _countof(name), _T("%s"), (TCHAR*)firstT);
else if (lastT[0])
- off = mir_sntprintf(name, SIZEOF(name), _T("%s"), (TCHAR*)lastT);
+ off = mir_sntprintf(name, _countof(name), _T("%s"), (TCHAR*)lastT);
if (mir_tstrlen(nickT)) {
if (off)
- mir_sntprintf(name + off, SIZEOF(name) - off, _T(" (%s)"), (TCHAR*)nickT);
+ mir_sntprintf(name + off, _countof(name) - off, _T(" (%s)"), (TCHAR*)nickT);
else
_tcsncpy_s(name, nickT, _TRUNCATE);
}
@@ -204,11 +204,11 @@ INT_PTR CALLBACK DlgProcAuthReq(HWND hwndDlg, UINT msg, WPARAM wParam, LPARAM lP
TCHAR hdr[256];
if (uin && emailT[0])
- mir_sntprintf(hdr, SIZEOF(hdr), TranslateT("%s requested authorization\n%u (%s) on %s"), name, uin, (TCHAR*)emailT, acc->tszAccountName);
+ mir_sntprintf(hdr, _countof(hdr), TranslateT("%s requested authorization\n%u (%s) on %s"), name, uin, (TCHAR*)emailT, acc->tszAccountName);
else if (uin)
- mir_sntprintf(hdr, SIZEOF(hdr), TranslateT("%s requested authorization\n%u on %s"), name, uin, acc->tszAccountName);
+ mir_sntprintf(hdr, _countof(hdr), TranslateT("%s requested authorization\n%u on %s"), name, uin, acc->tszAccountName);
else
- mir_sntprintf(hdr, SIZEOF(hdr), TranslateT("%s requested authorization\n%s on %s"), name, emailT[0] ? (TCHAR*)emailT : TranslateT("(Unknown)"), acc->tszAccountName);
+ mir_sntprintf(hdr, _countof(hdr), TranslateT("%s requested authorization\n%s on %s"), name, emailT[0] ? (TCHAR*)emailT : TranslateT("(Unknown)"), acc->tszAccountName);
SetDlgItemText(hwndDlg, IDC_HEADERBAR, hdr);
SetDlgItemText(hwndDlg, IDC_REASON, reasonT);
@@ -265,7 +265,7 @@ INT_PTR CALLBACK DlgProcAuthReq(HWND hwndDlg, UINT msg, WPARAM wParam, LPARAM lP
if (IsWindowEnabled(GetDlgItem(hwndDlg, IDC_DENYREASON))) {
TCHAR tszReason[256];
- GetDlgItemText(hwndDlg, IDC_DENYREASON, tszReason, SIZEOF(tszReason));
+ GetDlgItemText(hwndDlg, IDC_DENYREASON, tszReason, _countof(tszReason));
CallProtoService(dbei.szModule, PS_AUTHDENY, hDbEvent, (LPARAM)tszReason);
}
else CallProtoService(dbei.szModule, PS_AUTHDENY, hDbEvent, 0);
diff --git a/src/core/stdaway/src/awaymsg.cpp b/src/core/stdaway/src/awaymsg.cpp
index 7cee287dd1..caaed0f169 100644
--- a/src/core/stdaway/src/awaymsg.cpp
+++ b/src/core/stdaway/src/awaymsg.cpp
@@ -60,12 +60,12 @@ 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);
- 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);
SetDlgItemText(hwndDlg, IDC_RETRIEVING, str);
Window_SetProtoIcon_IcoLib(hwndDlg, szProto, dwStatus);
@@ -143,7 +143,7 @@ static int AwayMsgPreBuildMenu(WPARAM hContact, LPARAM)
int chatRoom = db_get_b(hContact, szProto, "ChatRoom", 0);
if (!chatRoom) {
int status = db_get_w(hContact, szProto, "Status", ID_STATUS_OFFLINE);
- mir_sntprintf(str, SIZEOF(str), TranslateT("Re&ad %s message"), pcli->pfnGetStatusModeDescription(status, 0));
+ mir_sntprintf(str, _countof(str), TranslateT("Re&ad %s message"), pcli->pfnGetStatusModeDescription(status, 0));
mi.ptszName = str;
if (CallProtoService(szProto, PS_GETCAPS, PFLAGNUM_1, 0) & PF1_MODEMSGRECV) {
if (CallProtoService(szProto, PS_GETCAPS, PFLAGNUM_3, 0) & Proto_Status2Flag(status)) {
diff --git a/src/core/stdaway/src/sendmsg.cpp b/src/core/stdaway/src/sendmsg.cpp
index 68db851844..dc36c8d8cc 100644
--- a/src/core/stdaway/src/sendmsg.cpp
+++ b/src/core/stdaway/src/sendmsg.cpp
@@ -113,12 +113,12 @@ static TCHAR* GetAwayMessage(int statusMode, char *szProto)
if (mm < 0) mm += 60 * 24;
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));
}
else if ( !_tcsnicmp(dbv.ptszVal + 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));
else continue;
if (mir_tstrlen(substituteStr) > 6)
@@ -225,11 +225,11 @@ static INT_PTR CALLBACK SetAwayMsgDlgProc(HWND hwndDlg, UINT message, WPARAM wPa
mir_subclassWindow(GetDlgItem(hwndDlg, IDC_MSG), MessageEditSubclassProc);
{
TCHAR str[256], format[128];
- GetWindowText(hwndDlg, format, SIZEOF(format));
- mir_sntprintf(str, SIZEOF(str), format, pcli->pfnGetStatusModeDescription(dat->statusMode, 0));
+ GetWindowText(hwndDlg, format, _countof(format));
+ mir_sntprintf(str, _countof(str), format, pcli->pfnGetStatusModeDescription(dat->statusMode, 0));
SetWindowText(hwndDlg, str);
}
- GetDlgItemText(hwndDlg, IDOK, dat->okButtonFormat, SIZEOF(dat->okButtonFormat));
+ GetDlgItemText(hwndDlg, IDOK, dat->okButtonFormat, _countof(dat->okButtonFormat));
{
TCHAR *msg = GetAwayMessage(dat->statusMode, dat->szProto);
SetDlgItemText(hwndDlg, IDC_MSG, msg);
@@ -247,7 +247,7 @@ static INT_PTR CALLBACK SetAwayMsgDlgProc(HWND hwndDlg, UINT message, WPARAM wPa
case WM_TIMER:
if (--dat->countdown >= 0) {
TCHAR str[64];
- mir_sntprintf(str, SIZEOF(str), dat->okButtonFormat, dat->countdown);
+ mir_sntprintf(str, _countof(str), dat->okButtonFormat, dat->countdown);
SetDlgItemText(hwndDlg, IDOK, str);
}
else {
@@ -270,7 +270,7 @@ static INT_PTR CALLBACK SetAwayMsgDlgProc(HWND hwndDlg, UINT message, WPARAM wPa
case IDOK:
if (dat->countdown < 0) {
TCHAR str[1024];
- GetDlgItemText(hwndDlg, IDC_MSG, str, SIZEOF(str));
+ GetDlgItemText(hwndDlg, IDC_MSG, str, _countof(str));
ChangeAllProtoMessages(dat->szProto, dat->statusMode, str);
db_set_ts(NULL, "SRAway", StatusModeToDbSetting(dat->statusMode, "Msg"), str);
DestroyWindow(hwndDlg);
@@ -360,7 +360,7 @@ struct AwayMsgInfo
struct AwayMsgDlgData
{
- struct AwayMsgInfo info[SIZEOF(statusModes)];
+ struct AwayMsgInfo info[_countof(statusModes)];
int oldPage;
};
@@ -376,7 +376,7 @@ static INT_PTR CALLBACK DlgProcAwayMsgOpts(HWND hwndDlg, UINT msg, WPARAM wParam
dat = (AwayMsgDlgData*)mir_alloc(sizeof(AwayMsgDlgData));
SetWindowLongPtr(hwndDlg, GWLP_USERDATA, (LONG_PTR)dat);
dat->oldPage = -1;
- for (int i = 0; i < SIZEOF(statusModes); i++) {
+ for (int i = 0; i < _countof(statusModes); i++) {
if (!(protoModeMsgFlags & Proto_Status2Flag(statusModes[i])))
continue;
@@ -454,7 +454,7 @@ static INT_PTR CALLBACK DlgProcAwayMsgOpts(HWND hwndDlg, UINT msg, WPARAM wParam
dat->info[dat->oldPage].ignore = IsDlgButtonChecked(hwndDlg, IDC_DONTREPLY);
dat->info[dat->oldPage].noDialog = IsDlgButtonChecked(hwndDlg, IDC_NODIALOG);
dat->info[dat->oldPage].usePrevious = IsDlgButtonChecked(hwndDlg, IDC_USEPREVIOUS);
- GetDlgItemText(hwndDlg, IDC_MSG, dat->info[dat->oldPage].msg, SIZEOF(dat->info[dat->oldPage].msg));
+ GetDlgItemText(hwndDlg, IDC_MSG, dat->info[dat->oldPage].msg, _countof(dat->info[dat->oldPage].msg));
}
CheckDlgButton(hwndDlg, IDC_DONTREPLY, (i < 0 ? 0 : dat->info[i].ignore) ? BST_CHECKED : BST_UNCHECKED);
CheckDlgButton(hwndDlg, IDC_NODIALOG, (i < 0 ? 0 : dat->info[i].noDialog) ? BST_CHECKED : BST_UNCHECKED);
diff --git a/src/core/stdchat/src/main.cpp b/src/core/stdchat/src/main.cpp
index 0528908ae0..f849446347 100644
--- a/src/core/stdchat/src/main.cpp
+++ b/src/core/stdchat/src/main.cpp
@@ -287,30 +287,30 @@ static void RegisterFonts()
{
ColourIDT colourid = { sizeof(colourid) };
strncpy(colourid.dbSettingsGroup, CHAT_MODULE, sizeof(colourid.dbSettingsGroup));
- _tcsncpy(colourid.group, LPGENT("Chat module"), SIZEOF(colourid.group));
+ _tcsncpy(colourid.group, LPGENT("Chat module"), _countof(colourid.group));
- strncpy(colourid.setting, "ColorLogBG", SIZEOF(colourid.setting));
- _tcsncpy(colourid.name, LPGENT("Group chat log background"), SIZEOF(colourid.name));
+ strncpy(colourid.setting, "ColorLogBG", _countof(colourid.setting));
+ _tcsncpy(colourid.name, LPGENT("Group chat log background"), _countof(colourid.name));
colourid.defcolour = GetSysColor(COLOR_WINDOW);
ColourRegisterT(&colourid);
- strncpy(colourid.setting, "ColorMessageBG", SIZEOF(colourid.setting));
- _tcsncpy(colourid.name, LPGENT("Message background"), SIZEOF(colourid.name));
+ strncpy(colourid.setting, "ColorMessageBG", _countof(colourid.setting));
+ _tcsncpy(colourid.name, LPGENT("Message background"), _countof(colourid.name));
colourid.defcolour = GetSysColor(COLOR_WINDOW);
ColourRegisterT(&colourid);
- strncpy(colourid.setting, "ColorNicklistBG", SIZEOF(colourid.setting));
- _tcsncpy(colourid.name, LPGENT("Nick list background"), SIZEOF(colourid.name));
+ strncpy(colourid.setting, "ColorNicklistBG", _countof(colourid.setting));
+ _tcsncpy(colourid.name, LPGENT("Nick list background"), _countof(colourid.name));
colourid.defcolour = GetSysColor(COLOR_WINDOW);
ColourRegisterT(&colourid);
- strncpy(colourid.setting, "ColorNicklistLines", SIZEOF(colourid.setting));
- _tcsncpy(colourid.name, LPGENT("Nick list lines"), SIZEOF(colourid.name));
+ strncpy(colourid.setting, "ColorNicklistLines", _countof(colourid.setting));
+ _tcsncpy(colourid.name, LPGENT("Nick list lines"), _countof(colourid.name));
colourid.defcolour = GetSysColor(COLOR_INACTIVEBORDER);
ColourRegisterT(&colourid);
- strncpy(colourid.setting, "ColorNicklistSelectedBG", SIZEOF(colourid.setting));
- _tcsncpy(colourid.name, LPGENT("Nick list background (selected)"), SIZEOF(colourid.name));
+ strncpy(colourid.setting, "ColorNicklistSelectedBG", _countof(colourid.setting));
+ _tcsncpy(colourid.name, LPGENT("Nick list background (selected)"), _countof(colourid.name));
colourid.defcolour = GetSysColor(COLOR_HIGHLIGHT);
ColourRegisterT(&colourid);
}
@@ -471,8 +471,8 @@ STDMETHODIMP CREOleCallback::GetNewStorage(LPSTORAGE * lplpstg)
{
WCHAR szwName[64];
char szName[64];
- mir_snprintf(szName, SIZEOF(szName), "s%u", nextStgId++);
- MultiByteToWideChar(CP_ACP, 0, szName, -1, szwName, SIZEOF(szwName));
+ mir_snprintf(szName, _countof(szName), "s%u", nextStgId++);
+ MultiByteToWideChar(CP_ACP, 0, szName, -1, szwName, _countof(szwName));
if (pictStg == NULL)
return STG_E_MEDIUMFULL;
return pictStg->CreateStorage(szwName, STGM_READWRITE | STGM_SHARE_EXCLUSIVE | STGM_CREATE, 0, 0, lplpstg);
diff --git a/src/core/stdchat/src/options.cpp b/src/core/stdchat/src/options.cpp
index eccfa9ac3f..e75482a151 100644
--- a/src/core/stdchat/src/options.cpp
+++ b/src/core/stdchat/src/options.cpp
@@ -128,13 +128,13 @@ static const struct branch_t branch6[] = {
{ LPGENT("Show popup for status changes"), "PopupFlags", GC_EVENT_ADDSTATUS, 0 },
};
-HTREEITEM hItemB0[SIZEOF(branch0)];
-HTREEITEM hItemB1[SIZEOF(branch1)];
-HTREEITEM hItemB2[SIZEOF(branch2)];
-HTREEITEM hItemB3[SIZEOF(branch3)];
-HTREEITEM hItemB4[SIZEOF(branch4)];
-HTREEITEM hItemB5[SIZEOF(branch5)];
-HTREEITEM hItemB6[SIZEOF(branch6)];
+HTREEITEM hItemB0[_countof(branch0)];
+HTREEITEM hItemB1[_countof(branch1)];
+HTREEITEM hItemB2[_countof(branch2)];
+HTREEITEM hItemB3[_countof(branch3)];
+HTREEITEM hItemB4[_countof(branch4)];
+HTREEITEM hItemB5[_countof(branch5)];
+HTREEITEM hItemB6[_countof(branch6)];
static HTREEITEM InsertBranch(HWND hwndTree, char* pszDescr, BOOL bExpanded)
{
@@ -344,13 +344,13 @@ static INT_PTR CALLBACK DlgProcOptions1(HWND hwndDlg, UINT uMsg, WPARAM wParam,
hListHeading5 = InsertBranch(GetDlgItem(hwndDlg, IDC_CHECKBOXES), LPGEN("Icons to display in the tray"), db_get_b(NULL, CHAT_MODULE, "Branch5Exp", 0) ? TRUE : FALSE);
if (PopupInstalled)
hListHeading6 = InsertBranch(GetDlgItem(hwndDlg, IDC_CHECKBOXES), LPGEN("Popups to display"), db_get_b(NULL, CHAT_MODULE, "Branch6Exp", 0) ? TRUE : FALSE);
- FillBranch(GetDlgItem(hwndDlg, IDC_CHECKBOXES), hListHeading0, branch0, hItemB0, SIZEOF(branch0), 0);
- FillBranch(GetDlgItem(hwndDlg, IDC_CHECKBOXES), hListHeading1, branch1, hItemB1, SIZEOF(branch1), 0);
- FillBranch(GetDlgItem(hwndDlg, IDC_CHECKBOXES), hListHeading2, branch2, hItemB2, SIZEOF(branch2), 0);
- FillBranch(GetDlgItem(hwndDlg, IDC_CHECKBOXES), hListHeading3, branch3, hItemB3, SIZEOF(branch3), 0x03E0);
- FillBranch(GetDlgItem(hwndDlg, IDC_CHECKBOXES), hListHeading4, branch4, hItemB4, SIZEOF(branch4), 0x0000);
- FillBranch(GetDlgItem(hwndDlg, IDC_CHECKBOXES), hListHeading5, branch5, hItemB5, SIZEOF(branch5), 0x1000);
- FillBranch(GetDlgItem(hwndDlg, IDC_CHECKBOXES), hListHeading6, branch6, hItemB6, SIZEOF(branch6), 0x0000);
+ FillBranch(GetDlgItem(hwndDlg, IDC_CHECKBOXES), hListHeading0, branch0, hItemB0, _countof(branch0), 0);
+ FillBranch(GetDlgItem(hwndDlg, IDC_CHECKBOXES), hListHeading1, branch1, hItemB1, _countof(branch1), 0);
+ FillBranch(GetDlgItem(hwndDlg, IDC_CHECKBOXES), hListHeading2, branch2, hItemB2, _countof(branch2), 0);
+ FillBranch(GetDlgItem(hwndDlg, IDC_CHECKBOXES), hListHeading3, branch3, hItemB3, _countof(branch3), 0x03E0);
+ FillBranch(GetDlgItem(hwndDlg, IDC_CHECKBOXES), hListHeading4, branch4, hItemB4, _countof(branch4), 0x0000);
+ FillBranch(GetDlgItem(hwndDlg, IDC_CHECKBOXES), hListHeading5, branch5, hItemB5, _countof(branch5), 0x1000);
+ FillBranch(GetDlgItem(hwndDlg, IDC_CHECKBOXES), hListHeading6, branch6, hItemB6, _countof(branch6), 0x0000);
SendMessage(hwndDlg, OPT_FIXHEADINGS, 0, 0);
break;
@@ -413,14 +413,14 @@ static INT_PTR CALLBACK DlgProcOptions1(HWND hwndDlg, UINT uMsg, WPARAM wParam,
switch (((LPNMHDR)lParam)->code) {
case PSN_APPLY:
BYTE b = db_get_b(NULL, CHAT_MODULE, "Tabs", 1);
- SaveBranch(GetDlgItem(hwndDlg, IDC_CHECKBOXES), branch0, hItemB0, SIZEOF(branch0));
- SaveBranch(GetDlgItem(hwndDlg, IDC_CHECKBOXES), branch1, hItemB1, SIZEOF(branch1));
- SaveBranch(GetDlgItem(hwndDlg, IDC_CHECKBOXES), branch2, hItemB2, SIZEOF(branch2));
- SaveBranch(GetDlgItem(hwndDlg, IDC_CHECKBOXES), branch3, hItemB3, SIZEOF(branch3));
- SaveBranch(GetDlgItem(hwndDlg, IDC_CHECKBOXES), branch4, hItemB4, SIZEOF(branch4));
- SaveBranch(GetDlgItem(hwndDlg, IDC_CHECKBOXES), branch5, hItemB5, SIZEOF(branch5));
+ SaveBranch(GetDlgItem(hwndDlg, IDC_CHECKBOXES), branch0, hItemB0, _countof(branch0));
+ SaveBranch(GetDlgItem(hwndDlg, IDC_CHECKBOXES), branch1, hItemB1, _countof(branch1));
+ SaveBranch(GetDlgItem(hwndDlg, IDC_CHECKBOXES), branch2, hItemB2, _countof(branch2));
+ SaveBranch(GetDlgItem(hwndDlg, IDC_CHECKBOXES), branch3, hItemB3, _countof(branch3));
+ SaveBranch(GetDlgItem(hwndDlg, IDC_CHECKBOXES), branch4, hItemB4, _countof(branch4));
+ SaveBranch(GetDlgItem(hwndDlg, IDC_CHECKBOXES), branch5, hItemB5, _countof(branch5));
if (PopupInstalled)
- SaveBranch(GetDlgItem(hwndDlg, IDC_CHECKBOXES), branch6, hItemB6, SIZEOF(branch6));
+ SaveBranch(GetDlgItem(hwndDlg, IDC_CHECKBOXES), branch6, hItemB6, _countof(branch6));
g_Settings.dwIconFlags = db_get_dw(NULL, CHAT_MODULE, "IconFlags", 0x0000);
g_Settings.dwTrayIconFlags = db_get_dw(NULL, CHAT_MODULE, "TrayIconFlags", 0x1000);
g_Settings.dwPopupFlags = db_get_dw(NULL, CHAT_MODULE, "PopupFlags", 0x0000);
diff --git a/src/core/stdchat/src/tools.cpp b/src/core/stdchat/src/tools.cpp
index 3537b61689..33f2988432 100644
--- a/src/core/stdchat/src/tools.cpp
+++ b/src/core/stdchat/src/tools.cpp
@@ -53,7 +53,7 @@ bool LoadMessageFont(LOGFONT *lf, COLORREF *colour)
if (db_get_ts(NULL, "SRMM", str, &dbv))
mir_tstrcpy(lf->lfFaceName, _T("Arial"));
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, "SRMFont%dSet", i);
@@ -135,7 +135,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"));
@@ -146,7 +146,7 @@ UINT CreateGCMenu(HWND hwndDlg, HMENU *hMenu, int iIndex, POINT pt, SESSION_INFO
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_tstrcpy(szTemp + 40, _T("..."));
diff --git a/src/core/stdchat/src/window.cpp b/src/core/stdchat/src/window.cpp
index 3e8edd8030..8bc99cbc52 100644
--- a/src/core/stdchat/src/window.cpp
+++ b/src/core/stdchat/src/window.cpp
@@ -997,7 +997,7 @@ static void ProcessNickListHovering(HWND hwnd, int hoveredItem, SESSION_INFO *si
}
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(si->pStatuses, ui->Status));
@@ -1149,13 +1149,13 @@ static int RestoreWindowPosition(HWND hwnd, MCONTACT hContact, char * szModule,
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 = (int)db_get_dw(hContact, szModule, szSettingName, -1);
- mir_snprintf(szSettingName, SIZEOF(szSettingName), "%swidth", szNamePrefix);
+ mir_snprintf(szSettingName, _countof(szSettingName), "%swidth", szNamePrefix);
int width = db_get_dw(hContact, szModule, szSettingName, -1);
- mir_snprintf(szSettingName, SIZEOF(szSettingName), "%sheight", szNamePrefix);
+ mir_snprintf(szSettingName, _countof(szSettingName), "%sheight", szNamePrefix);
int height = db_get_dw(hContact, szModule, szSettingName, -1);
if (x == -1)
@@ -2230,7 +2230,7 @@ LABEL_SHOWWINDOW:
case ID_SEARCH_WIKIPEDIA:
if (pszWord[0]) {
TCHAR szURL[1024];
- 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);
@@ -2316,7 +2316,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));
@@ -2435,11 +2435,11 @@ LABEL_SHOWWINDOW:
_tcsncpy_s(szName, (pInfo->ptszModDispName ? pInfo->ptszModDispName : _A2T(si->pszModule)), _TRUNCATE);
ValidateFilename(szName);
- mir_sntprintf(szFolder, SIZEOF(szFolder), _T("%s\\%s"), g_Settings.pszLogDir, szName);
+ mir_sntprintf(szFolder, _countof(szFolder), _T("%s\\%s"), g_Settings.pszLogDir, szName);
mir_sntprintf(szName, _T("%s.log"), si->ptszID);
ValidateFilename(szName);
- mir_sntprintf(szFile, SIZEOF(szFile), _T("%s\\%s"), szFolder, szName);
+ mir_sntprintf(szFile, _countof(szFile), _T("%s\\%s"), szFolder, szName);
ShellExecute(hwndDlg, _T("open"), szFile, NULL, NULL, SW_SHOW);
}
}
diff --git a/src/core/stdclist/src/clcfonts.cpp b/src/core/stdclist/src/clcfonts.cpp
index 873fb00d56..560a3a6363 100644
--- a/src/core/stdclist/src/clcfonts.cpp
+++ b/src/core/stdclist/src/clcfonts.cpp
@@ -54,10 +54,10 @@ void RegisterCListFonts()
FontIDT fontid = { sizeof(fontid) };
fontid.flags = FIDF_DEFAULTVALID | FIDF_ALLOWREREGISTER | FIDF_APPENDNAME | FIDF_NOAS | FIDF_SAVEPOINTSIZE | FIDF_ALLOWEFFECTS;
strncpy(fontid.dbSettingsGroup, "CLC", sizeof(fontid.dbSettingsGroup));
- _tcsncpy(fontid.group, LPGENT("Contact list"), SIZEOF(fontid.group));
+ _tcsncpy(fontid.group, LPGENT("Contact list"), _countof(fontid.group));
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, &fontid.deffontsettings.colour);
lf.lfHeight = -MulDiv(lf.lfHeight, GetDeviceCaps(hdc, LOGPIXELSY), 72);
@@ -70,11 +70,11 @@ void RegisterCListFonts()
fontid.flags &= ~FIDF_CLASSMASK;
fontid.flags |= clistFontDescr[i].iMask;
- _tcsncpy(fontid.name, clistFontDescr[i].tszName, SIZEOF(fontid.name));
+ _tcsncpy(fontid.name, clistFontDescr[i].tszName, _countof(fontid.name));
char idstr[10];
mir_snprintf(idstr, "Font%d", i);
- strncpy(fontid.prefix, idstr, SIZEOF(fontid.prefix));
+ strncpy(fontid.prefix, idstr, _countof(fontid.prefix));
fontid.order = i;
FontRegisterT(&fontid);
}
@@ -87,25 +87,25 @@ void RegisterCListFonts()
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);
diff --git a/src/core/stdclist/src/clcopts.cpp b/src/core/stdclist/src/clcopts.cpp
index 3312357c5b..f54350b67c 100644
--- a/src/core/stdclist/src/clcopts.cpp
+++ b/src/core/stdclist/src/clcopts.cpp
@@ -150,7 +150,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);
@@ -158,7 +158,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));
}
@@ -173,9 +173,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);
CheckDlgButton(hwndDlg, IDC_GAMMACORRECT, db_get_b(NULL, "CLC", "GammaCorrect", CLCDEFAULT_GAMMACORRECT) ? BST_CHECKED : BST_UNCHECKED);
@@ -239,7 +239,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;
@@ -335,17 +335,17 @@ 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));
+ GetDlgItemText(hwndDlg, IDC_FILENAME, str, _countof(str));
OPENFILENAME ofn = { 0 };
ofn.lStructSize = OPENFILENAME_SIZE_VERSION_400;
ofn.hwndOwner = hwndDlg;
ofn.hInstance = NULL;
- Bitmap_GetFilter(filter, SIZEOF(filter));
+ Bitmap_GetFilter(filter, _countof(filter));
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))
@@ -384,7 +384,7 @@ static INT_PTR CALLBACK DlgProcClcBkgOpts(HWND hwndDlg, UINT msg, WPARAM wParam,
}
{
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))
db_set_s(NULL, "CLC", "BkBitmap", strrel);
else
diff --git a/src/core/stdclist/src/clcpaint.cpp b/src/core/stdclist/src/clcpaint.cpp
index 36e5918a35..c81daf2932 100644
--- a/src/core/stdclist/src/clcpaint.cpp
+++ b/src/core/stdclist/src/clcpaint.cpp
@@ -513,7 +513,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 hRgn = CreatePolygonRgn(pts, SIZEOF(pts), ALTERNATE);
+ HRGN hRgn = CreatePolygonRgn(pts, _countof(pts), ALTERNATE);
HBRUSH hBrush = CreateSolidBrush(dat->fontInfo[FONTID_CONTACTS].colour);
FillRgn(hdcMem, hRgn, hBrush);
DeleteObject(hBrush);
@@ -543,7 +543,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 (i = 0; i < SIZEOF(divide3); i++)
+ for (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/src/core/stdclist/src/cluiopts.cpp b/src/core/stdclist/src/cluiopts.cpp
index af5fe02bee..76dacac9c2 100644
--- a/src/core/stdclist/src/cluiopts.cpp
+++ b/src/core/stdclist/src/cluiopts.cpp
@@ -172,7 +172,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/src/core/stdfile/src/file.cpp b/src/core/stdfile/src/file.cpp
index d6a28d2072..6be3bf587b 100644
--- a/src/core/stdfile/src/file.cpp
+++ b/src/core/stdfile/src/file.cpp
@@ -123,7 +123,7 @@ void PushFileEvent(MCONTACT hContact, MEVENT hdbe, LPARAM lParam)
SkinPlaySound("RecvFile");
TCHAR szTooltip[256];
- mir_sntprintf(szTooltip, SIZEOF(szTooltip), TranslateT("File from %s"), pcli->pfnGetContactDisplayName(hContact, 0));
+ mir_sntprintf(szTooltip, _countof(szTooltip), TranslateT("File from %s"), pcli->pfnGetContactDisplayName(hContact, 0));
cle.ptszTooltip = szTooltip;
cle.flags |= CLEF_TCHAR;
@@ -356,7 +356,7 @@ INT_PTR FtMgrShowCommand(WPARAM, LPARAM)
INT_PTR openContRecDir(WPARAM hContact, LPARAM)
{
TCHAR szContRecDir[MAX_PATH];
- GetContactReceivedFilesDir(hContact, szContRecDir, SIZEOF(szContRecDir), TRUE);
+ GetContactReceivedFilesDir(hContact, szContRecDir, _countof(szContRecDir), TRUE);
ShellExecute(0, _T("open"), szContRecDir, 0, 0, SW_SHOW);
return 0;
}
@@ -364,7 +364,7 @@ INT_PTR openContRecDir(WPARAM hContact, LPARAM)
INT_PTR openRecDir(WPARAM, LPARAM)
{
TCHAR szContRecDir[MAX_PATH];
- GetReceivedFilesDir(szContRecDir, SIZEOF(szContRecDir));
+ GetReceivedFilesDir(szContRecDir, _countof(szContRecDir));
ShellExecute(0, _T("open"), szContRecDir, 0, 0, SW_SHOW);
return 0;
}
diff --git a/src/core/stdfile/src/fileexistsdlg.cpp b/src/core/stdfile/src/fileexistsdlg.cpp
index 81b1a220ba..23c888da3f 100644
--- a/src/core/stdfile/src/fileexistsdlg.cpp
+++ b/src/core/stdfile/src/fileexistsdlg.cpp
@@ -35,9 +35,9 @@ static void SetControlToUnixTime(HWND hwndDlg, UINT idCtrl, time_t unixTime)
filetime.dwHighDateTime = liFiletime.HighPart;
filetime.dwLowDateTime = liFiletime.LowPart;
FileTimeToSystemTime(&filetime, &st);
- GetTimeFormatA(LOCALE_USER_DEFAULT, 0, &st, NULL, szTime, SIZEOF(szTime));
- GetDateFormatA(LOCALE_USER_DEFAULT, DATE_SHORTDATE, &st, NULL, szDate, SIZEOF(szDate));
- mir_snprintf(szOutput, SIZEOF(szOutput), "%s %s", szDate, szTime);
+ GetTimeFormatA(LOCALE_USER_DEFAULT, 0, &st, NULL, szTime, _countof(szTime));
+ GetDateFormatA(LOCALE_USER_DEFAULT, DATE_SHORTDATE, &st, NULL, szDate, _countof(szDate));
+ mir_snprintf(szOutput, _countof(szOutput), "%s %s", szDate, szTime);
SetDlgItemTextA(hwndDlg, idCtrl, szOutput);
}
@@ -149,27 +149,27 @@ void __cdecl LoadIconsAndTypesThread(void* param)
TCHAR *pszExtension = _tcsrchr(pszFilename, '.');
if (pszExtension)
- mir_tstrncpy(szExtension, pszExtension + 1, SIZEOF(szExtension));
+ mir_tstrncpy(szExtension, pszExtension + 1, _countof(szExtension));
else {
pszExtension = _T(".");
szExtension[0] = '\0';
}
CharUpper(szExtension);
if (fileInfo.szTypeName[0] == '\0')
- mir_sntprintf(fileInfo.szTypeName, SIZEOF(fileInfo.szTypeName), TranslateT("%s file"), szExtension);
+ mir_sntprintf(fileInfo.szTypeName, _countof(fileInfo.szTypeName), TranslateT("%s file"), szExtension);
SetDlgItemText(info->hwndDlg, IDC_EXISTINGTYPE, fileInfo.szTypeName);
SetDlgItemText(info->hwndDlg, IDC_NEWTYPE, fileInfo.szTypeName);
SendDlgItemMessage(info->hwndDlg, IDC_EXISTINGICON, STM_SETICON, (WPARAM)fileInfo.hIcon, 0);
szIconFile[0] = '\0';
if (!mir_tstrcmp(szExtension, _T("EXE")))
- SRFile_GetRegValue(HKEY_LOCAL_MACHINE, _T("Software\\Microsoft\\Windows\\CurrentVersion\\Explorer\\Shell Icons"), _T("2"), szIconFile, SIZEOF(szIconFile));
+ SRFile_GetRegValue(HKEY_LOCAL_MACHINE, _T("Software\\Microsoft\\Windows\\CurrentVersion\\Explorer\\Shell Icons"), _T("2"), szIconFile, _countof(szIconFile));
else {
TCHAR szTypeName[MAX_PATH];
- if (SRFile_GetRegValue(HKEY_CLASSES_ROOT, pszExtension, NULL, szTypeName, SIZEOF(szTypeName))) {
+ if (SRFile_GetRegValue(HKEY_CLASSES_ROOT, pszExtension, NULL, szTypeName, _countof(szTypeName))) {
mir_tstrcat(szTypeName, _T("\\DefaultIcon"));
- if (SRFile_GetRegValue(HKEY_CLASSES_ROOT, szTypeName, NULL, szIconFile, SIZEOF(szIconFile))) {
+ if (SRFile_GetRegValue(HKEY_CLASSES_ROOT, szTypeName, NULL, szIconFile, _countof(szIconFile))) {
if (_tcsstr(szIconFile, _T("%1")))
- SRFile_GetRegValue(HKEY_LOCAL_MACHINE, _T("Software\\Microsoft\\Windows\\CurrentVersion\\Explorer\\Shell Icons"), _T("0"), szIconFile, SIZEOF(szIconFile));
+ SRFile_GetRegValue(HKEY_LOCAL_MACHINE, _T("Software\\Microsoft\\Windows\\CurrentVersion\\Explorer\\Shell Icons"), _T("0"), szIconFile, _countof(szIconFile));
else szIconFile[0] = '\0';
}
}
@@ -213,7 +213,7 @@ INT_PTR CALLBACK DlgProcFileExists(HWND hwndDlg, UINT msg, WPARAM wParam, LPARAM
SetWindowLongPtr(hwndDlg, GWLP_USERDATA, (LONG_PTR)fts);
SetDlgItemText(hwndDlg, IDC_FILENAME, fts->tszCurrentFile);
SetControlToUnixTime(hwndDlg, IDC_NEWDATE, fts->currentFileTime);
- GetSensiblyFormattedSize(fts->currentFileSize, szSize, SIZEOF(szSize), 0, 1, NULL);
+ GetSensiblyFormattedSize(fts->currentFileSize, szSize, _countof(szSize), 0, 1, NULL);
SetDlgItemText(hwndDlg, IDC_NEWSIZE, szSize);
mir_subclassWindow(GetDlgItem(hwndDlg, IDC_EXISTINGICON), IconCtrlSubclassProc);
@@ -221,7 +221,7 @@ INT_PTR CALLBACK DlgProcFileExists(HWND hwndDlg, UINT msg, WPARAM wParam, LPARAM
HWND hwndFocus = GetDlgItem(hwndDlg, IDC_RESUME);
if (_tstati64(fts->tszCurrentFile, &statbuf) == 0) {
SetControlToUnixTime(hwndDlg, IDC_EXISTINGDATE, statbuf.st_mtime);
- GetSensiblyFormattedSize(statbuf.st_size, szSize, SIZEOF(szSize), 0, 1, NULL);
+ GetSensiblyFormattedSize(statbuf.st_size, szSize, _countof(szSize), 0, 1, NULL);
SetDlgItemText(hwndDlg, IDC_EXISTINGSIZE, szSize);
if (statbuf.st_size > (int)fts->currentFileSize) {
EnableWindow(GetDlgItem(hwndDlg, IDC_RESUME), FALSE);
@@ -250,7 +250,7 @@ INT_PTR CALLBACK DlgProcFileExists(HWND hwndDlg, UINT msg, WPARAM wParam, LPARAM
case IDC_OPENFOLDER:
{
TCHAR szFile[MAX_PATH];
- mir_tstrncpy(szFile, fts->tszCurrentFile, SIZEOF(szFile));
+ mir_tstrncpy(szFile, fts->tszCurrentFile, _countof(szFile));
TCHAR *pszLastBackslash = _tcsrchr(szFile, '\\');
if (pszLastBackslash)
*pszLastBackslash = '\0';
@@ -283,11 +283,11 @@ INT_PTR CALLBACK DlgProcFileExists(HWND hwndDlg, UINT msg, WPARAM wParam, LPARAM
TCHAR filter[512], *pfilter;
TCHAR str[MAX_PATH];
- mir_tstrncpy(str, fts->tszCurrentFile, SIZEOF(str));
+ mir_tstrncpy(str, fts->tszCurrentFile, _countof(str));
ofn.lStructSize = OPENFILENAME_SIZE_VERSION_400;
ofn.hwndOwner = hwndDlg;
ofn.Flags = OFN_PATHMUSTEXIST | OFN_OVERWRITEPROMPT | OFN_HIDEREADONLY;
- _tcsncpy(filter, TranslateT("All files"),SIZEOF(filter)-1);
+ _tcsncpy(filter, TranslateT("All files"),_countof(filter)-1);
mir_tstrcat(filter, _T(" (*)"));
pfilter = filter + mir_tstrlen(filter) + 1;
mir_tstrcpy(pfilter, _T("*"));
@@ -295,7 +295,7 @@ INT_PTR CALLBACK DlgProcFileExists(HWND hwndDlg, UINT msg, WPARAM wParam, LPARAM
*pfilter = '\0';
ofn.lpstrFilter = filter;
ofn.lpstrFile = str;
- ofn.nMaxFile = SIZEOF(str);
+ ofn.nMaxFile = _countof(str);
ofn.nMaxFileTitle = MAX_PATH;
if (!GetSaveFileName(&ofn))
return FALSE;
diff --git a/src/core/stdfile/src/fileopts.cpp b/src/core/stdfile/src/fileopts.cpp
index 7b56f2bdb9..11566c05c8 100644
--- a/src/core/stdfile/src/fileopts.cpp
+++ b/src/core/stdfile/src/fileopts.cpp
@@ -63,7 +63,7 @@ static INT_PTR CALLBACK DlgProcFileOpts(HWND hwndDlg, UINT msg, WPARAM wParam, L
SHAutoComplete(GetDlgItem(hwndDlg, IDC_FILEDIR), SHACF_FILESYS_DIRS);
TCHAR str[MAX_PATH];
- GetContactReceivedFilesDir(NULL, str, SIZEOF(str), FALSE);
+ GetContactReceivedFilesDir(NULL, str, _countof(str), FALSE);
SetDlgItemText(hwndDlg, IDC_FILEDIR, str);
CheckDlgButton(hwndDlg, IDC_AUTOACCEPT, db_get_b(NULL, "SRFile", "AutoAccept", 0) ? BST_CHECKED : BST_UNCHECKED);
@@ -77,9 +77,9 @@ static INT_PTR CALLBACK DlgProcFileOpts(HWND hwndDlg, UINT msg, WPARAM wParam, L
}
CheckDlgButton(hwndDlg, IDC_WARNBEFOREOPENING, db_get_b(NULL, "SRFile", "WarnBeforeOpening", 1) ? BST_CHECKED : BST_UNCHECKED);
- for (int i = 0; i < SIZEOF(virusScanners); i++) {
+ for (int i = 0; i < _countof(virusScanners); i++) {
TCHAR szScanExe[MAX_PATH];
- if (SRFile_GetRegValue(HKEY_LOCAL_MACHINE, virusScanners[i].szExeRegPath, virusScanners[i].szExeRegValue, szScanExe, SIZEOF(szScanExe))) {
+ if (SRFile_GetRegValue(HKEY_LOCAL_MACHINE, virusScanners[i].szExeRegPath, virusScanners[i].szExeRegValue, szScanExe, _countof(szScanExe))) {
int iItem = SendDlgItemMessage(hwndDlg, IDC_SCANCMDLINE, CB_ADDSTRING, 0, (LPARAM)virusScanners[i].szProductName);
SendDlgItemMessage(hwndDlg, IDC_SCANCMDLINE, CB_SETITEMDATA, iItem, i);
}
@@ -124,10 +124,10 @@ static INT_PTR CALLBACK DlgProcFileOpts(HWND hwndDlg, UINT msg, WPARAM wParam, L
TCHAR str[512];
TCHAR szScanExe[MAX_PATH];
int iScanner = SendDlgItemMessage(hwndDlg, IDC_SCANCMDLINE, CB_GETITEMDATA, SendDlgItemMessage(hwndDlg, IDC_SCANCMDLINE, CB_GETCURSEL, 0, 0), 0);
- if (iScanner >= SIZEOF(virusScanners) || iScanner < 0) break;
+ if (iScanner >= _countof(virusScanners) || iScanner < 0) break;
str[0] = '\0';
- if (SRFile_GetRegValue(HKEY_LOCAL_MACHINE, virusScanners[iScanner].szExeRegPath, virusScanners[iScanner].szExeRegValue, szScanExe, SIZEOF(szScanExe)))
- mir_sntprintf(str, SIZEOF(str), virusScanners[iScanner].szCommandLine, szScanExe);
+ if (SRFile_GetRegValue(HKEY_LOCAL_MACHINE, virusScanners[iScanner].szExeRegPath, virusScanners[iScanner].szExeRegValue, szScanExe, _countof(szScanExe)))
+ mir_sntprintf(str, _countof(str), virusScanners[iScanner].szCommandLine, szScanExe);
SetDlgItemText(hwndDlg, IDC_SCANCMDLINE, str);
}
break;
@@ -141,7 +141,7 @@ static INT_PTR CALLBACK DlgProcFileOpts(HWND hwndDlg, UINT msg, WPARAM wParam, L
case IDC_FILEDIRBROWSE:
{
TCHAR str[MAX_PATH];
- GetDlgItemText(hwndDlg, IDC_FILEDIR, str, SIZEOF(str));
+ GetDlgItemText(hwndDlg, IDC_FILEDIR, str, _countof(str));
if (BrowseForFolder(hwndDlg, str))
SetDlgItemText(hwndDlg, IDC_FILEDIR, str);
}
@@ -163,7 +163,7 @@ static INT_PTR CALLBACK DlgProcFileOpts(HWND hwndDlg, UINT msg, WPARAM wParam, L
case IDC_SCANCMDLINEBROWSE:
TCHAR str[MAX_PATH + 2];
- GetDlgItemText(hwndDlg, IDC_SCANCMDLINE, str, SIZEOF(str));
+ GetDlgItemText(hwndDlg, IDC_SCANCMDLINE, str, _countof(str));
CMString tszFilter;
tszFilter.AppendFormat(_T("%s (*.exe)%c*.exe%c"), TranslateT("Executable files"), 0, 0);
@@ -175,7 +175,7 @@ static INT_PTR CALLBACK DlgProcFileOpts(HWND hwndDlg, UINT msg, WPARAM wParam, L
ofn.Flags = OFN_FILEMUSTEXIST | OFN_HIDEREADONLY | OFN_DONTADDTORECENT;
ofn.lpstrFilter = tszFilter;
ofn.lpstrFile = str;
- ofn.nMaxFile = SIZEOF(str) - 2;
+ ofn.nMaxFile = _countof(str) - 2;
if (str[0] == '"') {
TCHAR *pszQuote = _tcschr(str + 1, '"');
if (pszQuote)
@@ -189,7 +189,7 @@ static INT_PTR CALLBACK DlgProcFileOpts(HWND hwndDlg, UINT msg, WPARAM wParam, L
ofn.nMaxFileTitle = MAX_PATH;
if (!GetOpenFileName(&ofn)) break;
if (_tcschr(str, ' ') != NULL) {
- memmove(str + 1, str, ((SIZEOF(str) - 2) * sizeof(TCHAR)));
+ memmove(str + 1, str, ((_countof(str) - 2) * sizeof(TCHAR)));
str[0] = '"';
mir_tstrcat(str, _T("\""));
}
@@ -203,7 +203,7 @@ static INT_PTR CALLBACK DlgProcFileOpts(HWND hwndDlg, UINT msg, WPARAM wParam, L
switch (((LPNMHDR)lParam)->code) {
case PSN_APPLY:
TCHAR str[512];
- GetDlgItemText(hwndDlg, IDC_FILEDIR, str, SIZEOF(str));
+ GetDlgItemText(hwndDlg, IDC_FILEDIR, str, _countof(str));
RemoveInvalidPathChars(str);
db_set_ts(NULL, "SRFile", "RecvFilesDirAdv", str);
db_set_b(NULL, "SRFile", "AutoAccept", (BYTE)IsDlgButtonChecked(hwndDlg, IDC_AUTOACCEPT));
@@ -211,7 +211,7 @@ static INT_PTR CALLBACK DlgProcFileOpts(HWND hwndDlg, UINT msg, WPARAM wParam, L
db_set_b(NULL, "SRFile", "AutoClose", (BYTE)IsDlgButtonChecked(hwndDlg, IDC_AUTOCLOSE));
db_set_b(NULL, "SRFile", "AutoClear", (BYTE)IsDlgButtonChecked(hwndDlg, IDC_AUTOCLEAR));
db_set_b(NULL, "SRFile", "UseScanner", (BYTE)(IsDlgButtonChecked(hwndDlg, IDC_SCANAFTERDL) ? VIRUSSCAN_AFTERDL : (IsDlgButtonChecked(hwndDlg, IDC_SCANDURINGDL) ? VIRUSSCAN_DURINGDL : VIRUSSCAN_DISABLE)));
- GetDlgItemText(hwndDlg, IDC_SCANCMDLINE, str, SIZEOF(str));
+ GetDlgItemText(hwndDlg, IDC_SCANCMDLINE, str, _countof(str));
db_set_ts(NULL, "SRFile", "ScanCmdLine", str);
db_set_b(NULL, "SRFile", "WarnBeforeOpening", (BYTE)IsDlgButtonChecked(hwndDlg, IDC_WARNBEFOREOPENING));
db_set_b(NULL, "SRFile", "IfExists", (BYTE)(IsDlgButtonChecked(hwndDlg, IDC_ASK) ? FILERESUME_ASK : (IsDlgButtonChecked(hwndDlg, IDC_RESUME) ? FILERESUME_RESUMEALL : (IsDlgButtonChecked(hwndDlg, IDC_OVERWRITE) ? FILERESUME_OVERWRITEALL : FILERESUME_RENAMEALL))));
diff --git a/src/core/stdfile/src/filerecvdlg.cpp b/src/core/stdfile/src/filerecvdlg.cpp
index 16edf1c4a0..0b7cd4325b 100644
--- a/src/core/stdfile/src/filerecvdlg.cpp
+++ b/src/core/stdfile/src/filerecvdlg.cpp
@@ -134,7 +134,7 @@ void GetContactReceivedFilesDir(MCONTACT hContact, TCHAR *szDir, int cchDir, BOO
if (tszRecvPath)
_tcsncpy_s(tszTemp, tszRecvPath, _TRUNCATE);
else
- mir_sntprintf(tszTemp, SIZEOF(tszTemp), _T("%%mydocuments%%\\%s\\%%userid%%"), TranslateT("My received files"));
+ mir_sntprintf(tszTemp, _countof(tszTemp), _T("%%mydocuments%%\\%s\\%%userid%%"), TranslateT("My received files"));
if (hContact) {
hContact = db_mc_tryMeta(hContact);
@@ -149,7 +149,7 @@ void GetContactReceivedFilesDir(MCONTACT hContact, TCHAR *szDir, int cchDir, BOO
rvaVarsToReplace[2].lptzValue = mir_a2t(GetContactProto(hContact));
rvaVarsToReplace[3].lptzKey = NULL;
rvaVarsToReplace[3].lptzValue = NULL;
- for (int i = 0; i < (SIZEOF(rvaVarsToReplace) - 1); i++)
+ for (int i = 0; i < (_countof(rvaVarsToReplace) - 1); i++)
RemoveInvalidFilenameChars(rvaVarsToReplace[i].lptzValue);
dat.cbSize = sizeof(dat);
@@ -158,15 +158,15 @@ void GetContactReceivedFilesDir(MCONTACT hContact, TCHAR *szDir, int cchDir, BOO
dat.hContact = hContact;
TCHAR *result = (TCHAR*)CallService(MS_UTILS_REPLACEVARS, (WPARAM)tszTemp, (LPARAM)&dat);
if (result) {
- _tcsncpy(tszTemp, result, SIZEOF(tszTemp));
+ _tcsncpy(tszTemp, result, _countof(tszTemp));
mir_free(result);
- for (int i = 0; i < (SIZEOF(rvaVarsToReplace) - 1); i++)
+ for (int i = 0; i < (_countof(rvaVarsToReplace) - 1); i++)
mir_free(rvaVarsToReplace[i].lptzValue);
}
}
if (patchVars)
- patchDir(tszTemp, SIZEOF(tszTemp));
+ patchDir(tszTemp, _countof(tszTemp));
RemoveInvalidPathChars(tszTemp);
mir_tstrncpy(szDir, tszTemp, cchDir);
}
@@ -179,9 +179,9 @@ void GetReceivedFilesDir(TCHAR *szDir, int cchDir)
if (tszRecvPath)
_tcsncpy_s(tszTemp, tszRecvPath, _TRUNCATE);
else
- mir_sntprintf(tszTemp, SIZEOF(tszTemp), _T("%%mydocuments%%\\%s\\%%userid%%"), TranslateT("My received files"));
+ mir_sntprintf(tszTemp, _countof(tszTemp), _T("%%mydocuments%%\\%s\\%%userid%%"), TranslateT("My received files"));
- patchDir(tszTemp, SIZEOF(tszTemp));
+ patchDir(tszTemp, _countof(tszTemp));
RemoveInvalidPathChars(tszTemp);
mir_tstrncpy(szDir, tszTemp, cchDir);
}
@@ -215,7 +215,7 @@ INT_PTR CALLBACK DlgProcRecvFile(HWND hwndDlg, UINT msg, WPARAM wParam, LPARAM l
TCHAR *contactName = pcli->pfnGetContactDisplayName(dat->hContact, 0);
SetDlgItemText(hwndDlg, IDC_FROM, contactName);
- GetContactReceivedFilesDir(dat->hContact, szPath, SIZEOF(szPath), TRUE);
+ GetContactReceivedFilesDir(dat->hContact, szPath, _countof(szPath), TRUE);
SetDlgItemText(hwndDlg, IDC_FILEDIR, szPath);
SHAutoComplete(GetWindow(GetDlgItem(hwndDlg, IDC_FILEDIR), GW_CHILD), 1);
@@ -254,7 +254,7 @@ INT_PTR CALLBACK DlgProcRecvFile(HWND hwndDlg, UINT msg, WPARAM wParam, LPARAM l
else DestroyWindow(hwndDlg);
TCHAR datetimestr[64];
- TimeZone_PrintTimeStamp(NULL, dbei.timestamp, _T("t d"), datetimestr, SIZEOF(datetimestr), 0);
+ TimeZone_PrintTimeStamp(NULL, dbei.timestamp, _T("t d"), datetimestr, _countof(datetimestr), 0);
SetDlgItemText(hwndDlg, IDC_DATE, datetimestr);
char* szProto = GetContactProto(dat->hContact);
@@ -330,8 +330,8 @@ INT_PTR CALLBACK DlgProcRecvFile(HWND hwndDlg, UINT msg, WPARAM wParam, LPARAM l
{
TCHAR szDirName[MAX_PATH], szExistingDirName[MAX_PATH];
- GetDlgItemText(hwndDlg, IDC_FILEDIR, szDirName, SIZEOF(szDirName));
- GetLowestExistingDirName(szDirName, szExistingDirName, SIZEOF(szExistingDirName));
+ GetDlgItemText(hwndDlg, IDC_FILEDIR, szDirName, _countof(szDirName));
+ GetLowestExistingDirName(szDirName, szExistingDirName, _countof(szExistingDirName));
if (BrowseForFolder(hwndDlg, szExistingDirName))
SetDlgItemText(hwndDlg, IDC_FILEDIR, szExistingDirName);
}
@@ -340,9 +340,9 @@ INT_PTR CALLBACK DlgProcRecvFile(HWND hwndDlg, UINT msg, WPARAM wParam, LPARAM l
case IDOK:
{ //most recently used directories
TCHAR szRecvDir[MAX_PATH], szDefaultRecvDir[MAX_PATH];
- GetDlgItemText(hwndDlg, IDC_FILEDIR, szRecvDir, SIZEOF(szRecvDir));
+ GetDlgItemText(hwndDlg, IDC_FILEDIR, szRecvDir, _countof(szRecvDir));
RemoveInvalidPathChars(szRecvDir);
- GetContactReceivedFilesDir(NULL, szDefaultRecvDir, SIZEOF(szDefaultRecvDir), TRUE);
+ GetContactReceivedFilesDir(NULL, szDefaultRecvDir, _countof(szDefaultRecvDir), TRUE);
if (_tcsnicmp(szRecvDir, szDefaultRecvDir, mir_tstrlen(szDefaultRecvDir))) {
char idstr[32];
int i;
@@ -362,9 +362,9 @@ INT_PTR CALLBACK DlgProcRecvFile(HWND hwndDlg, UINT msg, WPARAM wParam, LPARAM l
EnableWindow(GetDlgItem(hwndDlg, IDC_FILEDIR), FALSE);
EnableWindow(GetDlgItem(hwndDlg, IDC_FILEDIRBROWSE), FALSE);
- GetDlgItemText(hwndDlg, IDC_FILEDIR, dat->szSavePath, SIZEOF(dat->szSavePath));
- GetDlgItemText(hwndDlg, IDC_FILE, dat->szFilenames, SIZEOF(dat->szFilenames));
- GetDlgItemText(hwndDlg, IDC_MSG, dat->szMsg, SIZEOF(dat->szMsg));
+ GetDlgItemText(hwndDlg, IDC_FILEDIR, dat->szSavePath, _countof(dat->szSavePath));
+ GetDlgItemText(hwndDlg, IDC_FILE, dat->szFilenames, _countof(dat->szFilenames));
+ GetDlgItemText(hwndDlg, IDC_MSG, dat->szMsg, _countof(dat->szMsg));
dat->hwndTransfer = FtMgr_AddTransfer(dat);
SetWindowLongPtr(hwndDlg, GWLP_USERDATA, 0);
//check for auto-minimize here to fix BUG#647620
diff --git a/src/core/stdfile/src/filesenddlg.cpp b/src/core/stdfile/src/filesenddlg.cpp
index 5516373588..aa9cbee487 100644
--- a/src/core/stdfile/src/filesenddlg.cpp
+++ b/src/core/stdfile/src/filesenddlg.cpp
@@ -44,21 +44,21 @@ static void SetFileListAndSizeControls(HWND hwndDlg, FileDlgData *dat)
}
}
- GetSensiblyFormattedSize(totalSize, str, SIZEOF(str), 0, 1, NULL);
+ GetSensiblyFormattedSize(totalSize, str, _countof(str), 0, 1, NULL);
SetDlgItemText(hwndDlg, IDC_TOTALSIZE, str);
if (i > 1) {
TCHAR szFormat[32];
if (fileCount && dirCount) {
- mir_sntprintf(szFormat, SIZEOF(szFormat), _T("%s, %s"), TranslateTS(fileCount == 1 ? _T("%d file") : _T("%d files")), TranslateTS(dirCount == 1 ? _T("%d directory") : _T("%d directories")));
- mir_sntprintf(str, SIZEOF(str), szFormat, fileCount, dirCount);
+ mir_sntprintf(szFormat, _countof(szFormat), _T("%s, %s"), TranslateTS(fileCount == 1 ? _T("%d file") : _T("%d files")), TranslateTS(dirCount == 1 ? _T("%d directory") : _T("%d directories")));
+ mir_sntprintf(str, _countof(str), szFormat, fileCount, dirCount);
}
else if (fileCount) {
mir_tstrcpy(szFormat, TranslateT("%d files"));
- mir_sntprintf(str, SIZEOF(str), szFormat, fileCount);
+ mir_sntprintf(str, _countof(str), szFormat, fileCount);
}
else {
mir_tstrcpy(szFormat, TranslateT("%d directories"));
- mir_sntprintf(str, SIZEOF(str), szFormat, dirCount);
+ mir_sntprintf(str, _countof(str), szFormat, dirCount);
}
SetDlgItemText(hwndDlg, IDC_FILE, str);
}
@@ -323,9 +323,9 @@ INT_PTR CALLBACK DlgProcSendFile(HWND hwndDlg, UINT msg, WPARAM wParam, LPARAM l
EnableWindow(GetDlgItem(hwndDlg, IDC_MSG), FALSE);
EnableWindow(GetDlgItem(hwndDlg, IDC_CHOOSE), FALSE);
- GetDlgItemText(hwndDlg, IDC_FILEDIR, dat->szSavePath, SIZEOF(dat->szSavePath));
- GetDlgItemText(hwndDlg, IDC_FILE, dat->szFilenames, SIZEOF(dat->szFilenames));
- GetDlgItemText(hwndDlg, IDC_MSG, dat->szMsg, SIZEOF(dat->szMsg));
+ GetDlgItemText(hwndDlg, IDC_FILEDIR, dat->szSavePath, _countof(dat->szSavePath));
+ GetDlgItemText(hwndDlg, IDC_FILE, dat->szFilenames, _countof(dat->szFilenames));
+ GetDlgItemText(hwndDlg, IDC_MSG, dat->szMsg, _countof(dat->szMsg));
dat->hwndTransfer = FtMgr_AddTransfer(dat);
SetWindowLongPtr(hwndDlg, GWLP_USERDATA, 0);
DestroyWindow(hwndDlg);
diff --git a/src/core/stdfile/src/filexferdlg.cpp b/src/core/stdfile/src/filexferdlg.cpp
index ac01125118..3e5976e08a 100644
--- a/src/core/stdfile/src/filexferdlg.cpp
+++ b/src/core/stdfile/src/filexferdlg.cpp
@@ -105,7 +105,7 @@ static void __cdecl RunVirusScannerThread(struct virusscanthreadstartinfo *info)
if (info->szFile[mir_tstrlen(info->szFile) - 1] == '\\')
info->szFile[mir_tstrlen(info->szFile) - 1] = '\0';
*pszReplace = 0;
- mir_sntprintf(szCmdLine, SIZEOF(szCmdLine), _T("%s\"%s\"%s"), dbv.ptszVal, info->szFile, pszReplace + 2);
+ mir_sntprintf(szCmdLine, _countof(szCmdLine), _T("%s\"%s\"%s"), dbv.ptszVal, info->szFile, pszReplace + 2);
} else
_tcsncpy_s(szCmdLine, dbv.ptszVal, _TRUNCATE);
@@ -139,7 +139,7 @@ static void SetFilenameControls(HWND hwndDlg, FileDlgData *dat, PROTOFILETRANSFE
if (dat->hIcon) DestroyIcon(dat->hIcon); dat->hIcon = NULL;
if (fn && (fts->totalFiles > 1)) {
- mir_sntprintf(msg, SIZEOF(msg), _T("%s: %s (%d %s %d)"),
+ mir_sntprintf(msg, _countof(msg), _T("%s: %s (%d %s %d)"),
pcli->pfnGetContactDisplayName(fts->hContact, 0),
fn, fts->currentFileNumber + 1, TranslateT("of"), fts->totalFiles);
@@ -147,13 +147,13 @@ static void SetFilenameControls(HWND hwndDlg, FileDlgData *dat, PROTOFILETRANSFE
dat->hIcon = shfi.hIcon;
}
else if (fn) {
- mir_sntprintf(msg, SIZEOF(msg), _T("%s: %s"), pcli->pfnGetContactDisplayName(fts->hContact, 0), fn);
+ mir_sntprintf(msg, _countof(msg), _T("%s: %s"), pcli->pfnGetContactDisplayName(fts->hContact, 0), fn);
SHGetFileInfo(fn, FILE_ATTRIBUTE_NORMAL, &shfi, sizeof(shfi), SHGFI_USEFILEATTRIBUTES | SHGFI_ICON | SHGFI_SMALLICON);
dat->hIcon = shfi.hIcon;
}
else {
- mir_tstrncpy(msg, pcli->pfnGetContactDisplayName(fts->hContact, 0), SIZEOF(msg));
+ mir_tstrncpy(msg, pcli->pfnGetContactDisplayName(fts->hContact, 0), _countof(msg));
HICON hIcon = Skin_LoadIcon(SKINICON_OTHER_DOWNARROW);
dat->hIcon = CopyIcon(hIcon);
IcoLib_ReleaseIcon(hIcon, NULL);
@@ -297,7 +297,7 @@ INT_PTR CALLBACK DlgProcFileTransfer(HWND hwndDlg, UINT msg, WPARAM wParam, LPAR
case WM_TIMER:
memmove(dat->bytesRecvedHistory + 1, dat->bytesRecvedHistory, sizeof(dat->bytesRecvedHistory) - sizeof(dat->bytesRecvedHistory[0]));
dat->bytesRecvedHistory[0] = dat->transferStatus.totalProgress;
- if (dat->bytesRecvedHistorySize < SIZEOF(dat->bytesRecvedHistory))
+ if (dat->bytesRecvedHistorySize < _countof(dat->bytesRecvedHistory))
dat->bytesRecvedHistorySize++;
{
@@ -306,23 +306,23 @@ INT_PTR CALLBACK DlgProcFileTransfer(HWND hwndDlg, UINT msg, WPARAM wParam, LPAR
ULARGE_INTEGER li;
FILETIME ft;
- GetSensiblyFormattedSize((dat->bytesRecvedHistory[0] - dat->bytesRecvedHistory[dat->bytesRecvedHistorySize - 1]) / dat->bytesRecvedHistorySize, szSpeed, SIZEOF(szSpeed), 0, 1, NULL);
+ GetSensiblyFormattedSize((dat->bytesRecvedHistory[0] - dat->bytesRecvedHistory[dat->bytesRecvedHistorySize - 1]) / dat->bytesRecvedHistorySize, szSpeed, _countof(szSpeed), 0, 1, NULL);
if (dat->bytesRecvedHistory[0] == dat->bytesRecvedHistory[dat->bytesRecvedHistorySize - 1])
mir_tstrcpy(szTime, _T("??:??:??"));
else {
li.QuadPart = BIGI(10000000)*(dat->transferStatus.currentFileSize - dat->transferStatus.currentFileProgress)*dat->bytesRecvedHistorySize / (dat->bytesRecvedHistory[0] - dat->bytesRecvedHistory[dat->bytesRecvedHistorySize - 1]);
ft.dwHighDateTime = li.HighPart; ft.dwLowDateTime = li.LowPart;
FileTimeToSystemTime(&ft, &st);
- GetTimeFormat(LOCALE_USER_DEFAULT, TIME_FORCE24HOURFORMAT | TIME_NOTIMEMARKER, &st, NULL, szTime, SIZEOF(szTime));
+ GetTimeFormat(LOCALE_USER_DEFAULT, TIME_FORCE24HOURFORMAT | TIME_NOTIMEMARKER, &st, NULL, szTime, _countof(szTime));
}
if (dat->bytesRecvedHistory[0] != dat->bytesRecvedHistory[dat->bytesRecvedHistorySize - 1]) {
li.QuadPart = BIGI(10000000)*(dat->transferStatus.totalBytes - dat->transferStatus.totalProgress)*dat->bytesRecvedHistorySize / (dat->bytesRecvedHistory[0] - dat->bytesRecvedHistory[dat->bytesRecvedHistorySize - 1]);
ft.dwHighDateTime = li.HighPart; ft.dwLowDateTime = li.LowPart;
FileTimeToSystemTime(&ft, &st);
- GetTimeFormat(LOCALE_USER_DEFAULT, TIME_FORCE24HOURFORMAT | TIME_NOTIMEMARKER, &st, NULL, szTime, SIZEOF(szTime));
+ GetTimeFormat(LOCALE_USER_DEFAULT, TIME_FORCE24HOURFORMAT | TIME_NOTIMEMARKER, &st, NULL, szTime, _countof(szTime));
}
- mir_sntprintf(szDisplay, SIZEOF(szDisplay), _T("%s/%s (%s %s)"), szSpeed, TranslateT("sec"), szTime, TranslateT("remaining"));
+ mir_sntprintf(szDisplay, _countof(szDisplay), _T("%s/%s (%s %s)"), szSpeed, TranslateT("sec"), szTime, TranslateT("remaining"));
SetDlgItemText(hwndDlg, IDC_ALLSPEED, szDisplay);
}
break;
@@ -596,16 +596,16 @@ INT_PTR CALLBACK DlgProcFileTransfer(HWND hwndDlg, UINT msg, WPARAM wParam, LPAR
const unsigned long nextPos = fts->totalBytes ? (BIGI(100) * fts->totalProgress / fts->totalBytes) : 0;
if (lastPos != nextPos || firstTime) {
SendDlgItemMessage(hwndDlg, IDC_ALLFILESPROGRESS, PBM_SETPOS, nextPos, 0);
- mir_sntprintf(str, SIZEOF(str), _T("%u%%"), nextPos);
+ mir_sntprintf(str, _countof(str), _T("%u%%"), nextPos);
SetDlgItemText(hwndDlg, IDC_ALLPRECENTS, str);
}
int units;
- GetSensiblyFormattedSize(fts->totalBytes, szSizeTotal, SIZEOF(szSizeTotal), 0, 1, &units);
- GetSensiblyFormattedSize(fts->totalProgress, szSizeDone, SIZEOF(szSizeDone), units, 0, NULL);
- mir_sntprintf(str, SIZEOF(str), _T("%s/%s"), szSizeDone, szSizeTotal);
+ GetSensiblyFormattedSize(fts->totalBytes, szSizeTotal, _countof(szSizeTotal), 0, 1, &units);
+ GetSensiblyFormattedSize(fts->totalProgress, szSizeDone, _countof(szSizeDone), units, 0, NULL);
+ mir_sntprintf(str, _countof(str), _T("%s/%s"), szSizeDone, szSizeTotal);
str2[0] = 0;
- GetDlgItemText(hwndDlg, IDC_ALLTRANSFERRED, str2, SIZEOF(str2));
+ GetDlgItemText(hwndDlg, IDC_ALLTRANSFERRED, str2, _countof(str2));
if (mir_tstrcmp(str, str2))
SetDlgItemText(hwndDlg, IDC_ALLTRANSFERRED, str);
}
diff --git a/src/core/stdhelp/src/about.cpp b/src/core/stdhelp/src/about.cpp
index 362fb8f5f3..5b238c167b 100644
--- a/src/core/stdhelp/src/about.cpp
+++ b/src/core/stdhelp/src/about.cpp
@@ -38,7 +38,7 @@ INT_PTR CALLBACK DlgProcAbout(HWND hwndDlg, UINT msg, WPARAM wParam, LPARAM lPar
UINT blockSize;
PVOID pVerInfo;
- GetModuleFileName(NULL, filename, SIZEOF(filename));
+ GetModuleFileName(NULL, filename, _countof(filename));
verInfoSize = GetFileVersionInfoSize(filename, &unused);
pVerInfo = mir_alloc(verInfoSize);
GetFileVersionInfo(filename, 0, verInfoSize, pVerInfo);
@@ -48,10 +48,10 @@ INT_PTR CALLBACK DlgProcAbout(HWND hwndDlg, UINT msg, WPARAM wParam, LPARAM lPar
}
{
char productVersion[56];
- CallService(MS_SYSTEM_GETVERSIONTEXT, SIZEOF(productVersion), (LPARAM)productVersion);
+ CallService(MS_SYSTEM_GETVERSIONTEXT, _countof(productVersion), (LPARAM)productVersion);
TCHAR str[64];
- mir_sntprintf(str, SIZEOF(str), STR_VERSION_FORMAT, productVersion);
+ mir_sntprintf(str, _countof(str), STR_VERSION_FORMAT, productVersion);
SetDlgItemText(hwndDlg, IDC_HEADERBAR, str);
}
ShowWindow(GetDlgItem(hwndDlg, IDC_CREDITSFILE), SW_HIDE);
diff --git a/src/core/stdidle/src/idle.cpp b/src/core/stdidle/src/idle.cpp
index 169d95148c..5a536dabc9 100644
--- a/src/core/stdidle/src/idle.cpp
+++ b/src/core/stdidle/src/idle.cpp
@@ -236,7 +236,7 @@ void CALLBACK IdleTimer(HWND, UINT, UINT_PTR idEvent, DWORD)
int IdleGetStatusIndex(WORD status)
{
- for (int j = 0; j < SIZEOF(aa_Status); j++)
+ for (int j = 0; j < _countof(aa_Status); j++)
if (aa_Status[j] == status)
return j;
@@ -267,7 +267,7 @@ static INT_PTR CALLBACK IdleOptsDlgProc(HWND hwndDlg, UINT msg, WPARAM wParam, L
SendDlgItemMessage(hwndDlg, IDC_IDLE1STTIME, EM_LIMITTEXT, (WPARAM)2, 0);
CheckDlgButton(hwndDlg, IDC_AASHORTIDLE, db_get_b(NULL, IDLEMOD, IDL_AAENABLE, 0) ? BST_CHECKED : BST_UNCHECKED);
- for (j = 0; j < SIZEOF(aa_Status); j++)
+ for (j = 0; j < _countof(aa_Status); j++)
SendDlgItemMessage(hwndDlg, IDC_AASTATUS, CB_ADDSTRING, 0, (LPARAM)pcli->pfnGetStatusModeDescription(aa_Status[j], 0));
j = IdleGetStatusIndex((WORD)(db_get_w(NULL, IDLEMOD, IDL_AASTATUS, 0)));
diff --git a/src/core/stdmsg/src/globals.cpp b/src/core/stdmsg/src/globals.cpp
index 62fe7fa5e8..30576920cf 100644
--- a/src/core/stdmsg/src/globals.cpp
+++ b/src/core/stdmsg/src/globals.cpp
@@ -32,7 +32,7 @@ IconItem iconList[] =
static void InitIcons(void)
{
- Icon_Register(g_hInst, LPGEN("Messaging"), iconList, SIZEOF(iconList), "SRMM");
+ Icon_Register(g_hInst, LPGEN("Messaging"), iconList, _countof(iconList), "SRMM");
}
static int IconsChanged(WPARAM, LPARAM)
diff --git a/src/core/stdmsg/src/msgdialog.cpp b/src/core/stdmsg/src/msgdialog.cpp
index c4ca134216..eaa26e309d 100644
--- a/src/core/stdmsg/src/msgdialog.cpp
+++ b/src/core/stdmsg/src/msgdialog.cpp
@@ -136,7 +136,7 @@ static void ShowTime(SrmmWindowData *dat)
TCHAR buf[32];
unsigned i = (g_dat.flags & SMF_SHOWREADCHAR) ? 2 : 1;
- TimeZone_PrintDateTime(dat->hTimeZone, _T("t"), buf, SIZEOF(buf), 0);
+ TimeZone_PrintDateTime(dat->hTimeZone, _T("t"), buf, _countof(buf), 0);
SendMessage(dat->hwndStatus, SB_SETTEXT, i, (LPARAM)buf);
dat->wMinute = st.wMinute;
}
@@ -173,18 +173,18 @@ static void SetDialogToType(HWND hwndDlg)
{
SrmmWindowData *dat = (SrmmWindowData *)GetWindowLongPtr(hwndDlg, GWLP_USERDATA);
if (dat->hContact)
- ShowMultipleControls(hwndDlg, infoLineControls, SIZEOF(infoLineControls), (g_dat.flags&SMF_SHOWINFO) ? SW_SHOW : SW_HIDE);
+ ShowMultipleControls(hwndDlg, infoLineControls, _countof(infoLineControls), (g_dat.flags&SMF_SHOWINFO) ? SW_SHOW : SW_HIDE);
else
- ShowMultipleControls(hwndDlg, infoLineControls, SIZEOF(infoLineControls), SW_HIDE);
+ ShowMultipleControls(hwndDlg, infoLineControls, _countof(infoLineControls), SW_HIDE);
if (dat->hContact) {
- ShowMultipleControls(hwndDlg, buttonLineControls, SIZEOF(buttonLineControls), (g_dat.flags&SMF_SHOWBTNS) ? SW_SHOW : SW_HIDE);
+ ShowMultipleControls(hwndDlg, buttonLineControls, _countof(buttonLineControls), (g_dat.flags&SMF_SHOWBTNS) ? SW_SHOW : SW_HIDE);
if (!db_get_b(dat->hContact, "CList", "NotOnList", 0))
ShowWindow(GetDlgItem(hwndDlg, IDC_ADD), SW_HIDE);
}
- else ShowMultipleControls(hwndDlg, buttonLineControls, SIZEOF(buttonLineControls), SW_HIDE);
+ else ShowMultipleControls(hwndDlg, buttonLineControls, _countof(buttonLineControls), SW_HIDE);
- ShowMultipleControls(hwndDlg, sendControls, SIZEOF(sendControls), SW_SHOW);
+ ShowMultipleControls(hwndDlg, sendControls, _countof(sendControls), SW_SHOW);
if (!dat->hwndStatus) {
int grip = (GetWindowLongPtr(hwndDlg, GWL_STYLE) & WS_THICKFRAME) ? SBARS_SIZEGRIP : 0;
dat->hwndStatus = CreateWindowEx(0, STATUSCLASSNAME, NULL, WS_CHILD | WS_VISIBLE | grip, 0, 0, 0, 0, hwndDlg, NULL, g_hInst, NULL);
@@ -479,7 +479,7 @@ static int MessageDialogResize(HWND hwndDlg, LPARAM lParam, UTILRESIZECONTROL *
SrmmWindowData *dat = (SrmmWindowData *)lParam;
if (!(g_dat.flags & SMF_SHOWINFO) && !(g_dat.flags & SMF_SHOWBTNS)) {
- for (int i = 0; i < SIZEOF(buttonLineControls); i++)
+ for (int i = 0; i < _countof(buttonLineControls); i++)
if (buttonLineControls[i] == urc->wId)
OffsetRect(&urc->rcItem, 0, -dat->lineHeight);
}
@@ -491,7 +491,7 @@ static int MessageDialogResize(HWND hwndDlg, LPARAM lParam, UTILRESIZECONTROL *
int len = GetWindowTextLength(h);
if (len > 0) {
TCHAR buf[256];
- GetWindowText(h, buf, SIZEOF(buf));
+ GetWindowText(h, buf, _countof(buf));
HDC hdc = GetDC(h);
HFONT hFont = (HFONT)SelectObject(hdc, (HFONT)SendDlgItemMessage(hwndDlg, IDOK, WM_GETFONT, 0, 0));
@@ -836,7 +836,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, (WPARAM)dat->hContact, (LPARAM)ppFiles);
@@ -957,9 +957,9 @@ INT_PTR CALLBACK DlgProcMessage(HWND hwndDlg, UINT msg, WPARAM wParam, LPARAM lP
if (dat->lastMessage) {
TCHAR date[64], time[64], fmt[128];
- TimeZone_PrintTimeStamp(NULL, dat->lastMessage, _T("d"), date, SIZEOF(date), 0);
- TimeZone_PrintTimeStamp(NULL, dat->lastMessage, _T("t"), time, SIZEOF(time), 0);
- mir_sntprintf(fmt, SIZEOF(fmt), TranslateT("Last message received on %s at %s."), date, time);
+ TimeZone_PrintTimeStamp(NULL, dat->lastMessage, _T("d"), date, _countof(date), 0);
+ TimeZone_PrintTimeStamp(NULL, dat->lastMessage, _T("t"), time, _countof(time), 0);
+ mir_sntprintf(fmt, _countof(fmt), TranslateT("Last message received on %s at %s."), date, time);
SendMessage(dat->hwndStatus, SB_SETTEXT, 0, (LPARAM)fmt);
}
else SendMessage(dat->hwndStatus, SB_SETTEXT, 0, (LPARAM)_T(""));
@@ -1054,9 +1054,9 @@ INT_PTR CALLBACK DlgProcMessage(HWND hwndDlg, UINT msg, WPARAM wParam, LPARAM lP
TCHAR *szStatus = pcli->pfnGetStatusModeDescription(dat->szProto == NULL ? ID_STATUS_OFFLINE : db_get_w(dat->hContact, dat->szProto, "Status", ID_STATUS_OFFLINE), 0);
if (statusIcon)
- mir_sntprintf(newtitle, SIZEOF(newtitle), _T("%s - %s"), contactName, TranslateT("Message session"));
+ mir_sntprintf(newtitle, _countof(newtitle), _T("%s - %s"), contactName, TranslateT("Message session"));
else
- mir_sntprintf(newtitle, SIZEOF(newtitle), _T("%s (%s): %s"), contactName, szStatus, TranslateT("Message session"));
+ mir_sntprintf(newtitle, _countof(newtitle), _T("%s (%s): %s"), contactName, szStatus, TranslateT("Message session"));
DBCONTACTWRITESETTING *cws = (DBCONTACTWRITESETTING *)wParam;
if (!cws || (!mir_strcmp(cws->szModule, dat->szProto) && !mir_strcmp(cws->szSetting, "Status"))) {
@@ -1068,10 +1068,10 @@ INT_PTR CALLBACK DlgProcMessage(HWND hwndDlg, UINT msg, WPARAM wParam, LPARAM lP
dat->wOldStatus = dat->wStatus;
}
else
- mir_tstrncpy(newtitle, TranslateT("Message session"), SIZEOF(newtitle));
+ mir_tstrncpy(newtitle, TranslateT("Message session"), _countof(newtitle));
TCHAR oldtitle[256];
- GetWindowText(hwndDlg, oldtitle, SIZEOF(oldtitle));
+ GetWindowText(hwndDlg, oldtitle, _countof(oldtitle));
if (mir_tstrcmp(newtitle, oldtitle)) { //swt() flickers even if the title hasn't actually changed
SetWindowText(hwndDlg, newtitle);
SendMessage(hwndDlg, WM_SIZE, 0, 0);
@@ -1306,7 +1306,7 @@ INT_PTR CALLBACK DlgProcMessage(HWND hwndDlg, UINT msg, WPARAM wParam, LPARAM lP
TCHAR* szContactName = pcli->pfnGetContactDisplayName(dat->hContact, 0);
HICON hTyping = Skin_LoadIcon(SKINICON_OTHER_TYPING);
- mir_sntprintf(szBuf, SIZEOF(szBuf), TranslateT("%s is typing a message..."), szContactName);
+ mir_sntprintf(szBuf, _countof(szBuf), TranslateT("%s is typing a message..."), szContactName);
dat->nTypeSecs--;
SendMessage(dat->hwndStatus, SB_SETTEXT, 0, (LPARAM)szBuf);
diff --git a/src/core/stdmsg/src/msglog.cpp b/src/core/stdmsg/src/msglog.cpp
index aa214357fc..a56f85e5b9 100644
--- a/src/core/stdmsg/src/msglog.cpp
+++ b/src/core/stdmsg/src/msglog.cpp
@@ -28,7 +28,7 @@ extern IconItem iconList[];
#define LOGICON_MSG_NOTICE 2
static char *pLogIconBmpBits[3];
-static size_t logIconBmpSize[ SIZEOF(pLogIconBmpBits) ];
+static size_t logIconBmpSize[ _countof(pLogIconBmpBits) ];
#define STREAMSTAGE_HEADER 0
#define STREAMSTAGE_EVENTS 1
@@ -108,7 +108,7 @@ static int AppendToBufferWithRTF(char *&buffer, size_t &cbBufferEnd, size_t &cbB
}
else if (*line == '[' && (g_dat.flags & SMF_SHOWFORMAT)) {
int i, found = 0;
- for (i = 0; i < SIZEOF(bbcodes); ++i) {
+ for (i = 0; i < _countof(bbcodes); ++i) {
if (line[1] == bbcodes[i][1]) {
size_t lenb = mir_tstrlen(bbcodes[i]);
if (!_tcsnicmp(line, bbcodes[i], lenb)) {
@@ -212,7 +212,7 @@ static char *SetToStyle(int style)
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;
}
@@ -293,7 +293,7 @@ static char *CreateRTFFromDbEvent(SrmmWindowData *dat, MCONTACT hContact, MEVENT
else
szFormat = g_dat.flags & SMF_SHOWDATE ? _T("d t") : _T("t");
- TimeZone_PrintTimeStamp(NULL, dbei.timestamp, szFormat, str, SIZEOF(str), 0);
+ TimeZone_PrintTimeStamp(NULL, dbei.timestamp, szFormat, str, _countof(str), 0);
AppendToBuffer(buffer, bufferEnd, bufferAlloced, " %s ", SetToStyle(dbei.flags & DBEF_SENT ? MSGFONTID_MYTIME : MSGFONTID_YOURTIME));
AppendToBufferWithRTF(buffer, bufferEnd, bufferAlloced, str);
@@ -529,7 +529,7 @@ void LoadMsgLogIcons(void)
HDC hdcMem = CreateCompatibleDC(hdc);
PBYTE pBmpBits = (PBYTE)mir_alloc(widthBytes * bih.biHeight);
- for (int i = 0; i < SIZEOF(pLogIconBmpBits); i++) {
+ for (int i = 0; i < _countof(pLogIconBmpBits); i++) {
HICON hIcon = IcoLib_GetIconByHandle(iconList[i].hIcolib);
size_t size = RTFPICTHEADERMAXSIZE + (bih.biSize + widthBytes * bih.biHeight) * 2;
pLogIconBmpBits[i] = (char*)mir_alloc(size);
@@ -558,6 +558,6 @@ 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]);
}
diff --git a/src/core/stdmsg/src/msgoptions.cpp b/src/core/stdmsg/src/msgoptions.cpp
index a5d8c93c2a..a05d36fe1a 100644
--- a/src/core/stdmsg/src/msgoptions.cpp
+++ b/src/core/stdmsg/src/msgoptions.cpp
@@ -53,7 +53,7 @@ static BYTE MsgDlgGetFontDefaultCharset(const TCHAR* szFont)
bool LoadMsgDlgFont(int i, LOGFONT* lf, COLORREF * colour)
{
- if (i >= SIZEOF(fontOptionsList))
+ if (i >= _countof(fontOptionsList))
return false;
char str[32];
@@ -82,9 +82,9 @@ bool LoadMsgDlgFont(int i, LOGFONT* lf, COLORREF * colour)
DBVARIANT dbv;
if (db_get_ts(NULL, SRMMMOD, str, &dbv))
- _tcsncpy(lf->lfFaceName, fontOptionsList[i].szDefFace, SIZEOF(lf->lfFaceName)-1);
+ _tcsncpy(lf->lfFaceName, fontOptionsList[i].szDefFace, _countof(lf->lfFaceName)-1);
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, "SRMFont%dSet", i);
@@ -99,7 +99,7 @@ void RegisterSRMMFonts(void)
FontIDT fontid = { sizeof(fontid) };
fontid.flags = FIDF_ALLOWREREGISTER | FIDF_DEFAULTVALID;
- for (int i = 0; i < SIZEOF(fontOptionsList); i++) {
+ for (int i = 0; i < _countof(fontOptionsList); i++) {
strncpy_s(fontid.dbSettingsGroup, SRMMMOD, _TRUNCATE);
_tcsncpy_s(fontid.group, LPGENT("Message log"), _TRUNCATE);
_tcsncpy_s(fontid.name, fontOptionsList[i].szDescr, _TRUNCATE);
@@ -190,7 +190,7 @@ static INT_PTR CALLBACK DlgProcOptions(HWND hwndDlg, UINT msg, WPARAM wParam, LP
DWORD avatarHeight, msgTimeout;
SetWindowLongPtr(GetDlgItem(hwndDlg, IDC_POPLIST), GWL_STYLE, GetWindowLongPtr(GetDlgItem(hwndDlg, IDC_POPLIST), GWL_STYLE) | TVS_NOHSCROLL | TVS_CHECKBOXES);
- FillCheckBoxTree(GetDlgItem(hwndDlg, IDC_POPLIST), statusValues, SIZEOF(statusValues), db_get_dw(NULL, SRMMMOD, SRMSGSET_POPFLAGS, SRMSGDEFSET_POPFLAGS));
+ FillCheckBoxTree(GetDlgItem(hwndDlg, IDC_POPLIST), statusValues, _countof(statusValues), db_get_dw(NULL, SRMMMOD, SRMSGSET_POPFLAGS, SRMSGDEFSET_POPFLAGS));
CheckDlgButton(hwndDlg, IDC_DONOTSTEALFOCUS, db_get_b(NULL, SRMMMOD, SRMSGSET_DONOTSTEALFOCUS, SRMSGDEFSET_DONOTSTEALFOCUS) ? BST_CHECKED : BST_UNCHECKED);
SetDlgItemInt(hwndDlg, IDC_NFLASHES, db_get_b(NULL, SRMMMOD, SRMSGSET_FLASHCOUNT, SRMSGDEFSET_FLASHCOUNT), FALSE);
CheckDlgButton(hwndDlg, IDC_SHOWBUTTONLINE, g_dat.flags&SMF_SHOWBTNS ? BST_CHECKED : BST_UNCHECKED);
diff --git a/src/core/stdmsg/src/msgs.cpp b/src/core/stdmsg/src/msgs.cpp
index 9d8a6befd8..b11c854b13 100644
--- a/src/core/stdmsg/src/msgs.cpp
+++ b/src/core/stdmsg/src/msgs.cpp
@@ -94,7 +94,7 @@ static int MessageEventAdded(WPARAM hContact, LPARAM lParam)
cle.hIcon = Skin_LoadIcon(SKINICON_EVENT_MESSAGE);
cle.pszService = "SRMsg/ReadMessage";
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);
return 0;
@@ -165,7 +165,7 @@ static int TypingMessage(WPARAM hContact, LPARAM lParam)
SendMessage(hwnd, DM_TYPING, 0, lParam);
else if (lParam && (g_dat.flags & SMF_SHOWTYPINGTRAY)) {
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 (ServiceExists(MS_CLIST_SYSTRAY_NOTIFY) && !(g_dat.flags & SMF_SHOWTYPINGCLIST)) {
MIRANDASYSTRAYNOTIFY tn = { sizeof(tn) };
@@ -257,7 +257,7 @@ static void RestoreUnreadMessageAlerts(void)
else {
cle.hContact = hContact;
cle.hDbEvent = hDbEvent;
- 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));
CallService(MS_CLIST_ADDEVENT, 0, (LPARAM)&cle);
}
}
@@ -516,8 +516,8 @@ STDMETHODIMP CREOleCallback::GetNewStorage(LPSTORAGE * lplpstg)
{
WCHAR szwName[64];
char szName[64];
- mir_snprintf(szName, SIZEOF(szName), "s%u", nextStgId++);
- MultiByteToWideChar(CP_ACP, 0, szName, -1, szwName, SIZEOF(szwName));
+ mir_snprintf(szName, _countof(szName), "s%u", nextStgId++);
+ MultiByteToWideChar(CP_ACP, 0, szName, -1, szwName, _countof(szwName));
if (pictStg == NULL)
return STG_E_MEDIUMFULL;
return pictStg->CreateStorage(szwName, STGM_READWRITE | STGM_SHARE_EXCLUSIVE | STGM_CREATE, 0, 0, lplpstg);
diff --git a/src/core/stdssl/src/netlibssl.cpp b/src/core/stdssl/src/netlibssl.cpp
index 9da09b7b0b..1a4cdafa31 100644
--- a/src/core/stdssl/src/netlibssl.cpp
+++ b/src/core/stdssl/src/netlibssl.cpp
@@ -80,11 +80,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);
Netlib_Logf(NULL, szMsg);
@@ -189,7 +189,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 (!CertGetCertificateChain(NULL, pServerCert, NULL, pServerCert->hCertStore, &ChainPara, 0, NULL, &pChainContext)) {
@@ -300,7 +300,7 @@ static SECURITY_STATUS ClientHandshakeLoop(SslHandle *ssl, BOOL fDoInitialRead)
InBuffers[1].BufferType = SECBUFFER_EMPTY;
SecBufferDesc InBuffer;
- InBuffer.cBuffers = SIZEOF(InBuffers);
+ InBuffer.cBuffers = _countof(InBuffers);
InBuffer.pBuffers = InBuffers;
InBuffer.ulVersion = SECBUFFER_VERSION;
@@ -314,7 +314,7 @@ static SECURITY_STATUS ClientHandshakeLoop(SslHandle *ssl, BOOL fDoInitialRead)
OutBuffers[0].cbBuffer = 0;
SecBufferDesc OutBuffer;
- OutBuffer.cBuffers = SIZEOF(OutBuffers);
+ OutBuffer.cBuffers = _countof(OutBuffers);
OutBuffer.pBuffers = OutBuffers;
OutBuffer.ulVersion = SECBUFFER_VERSION;
@@ -412,7 +412,7 @@ static bool ClientConnect(SslHandle *ssl, const char *host)
OutBuffers[0].cbBuffer = 0;
SecBufferDesc OutBuffer;
- OutBuffer.cBuffers = SIZEOF(OutBuffers);
+ OutBuffer.cBuffers = _countof(OutBuffers);
OutBuffer.pBuffers = OutBuffers;
OutBuffer.ulVersion = SECBUFFER_VERSION;
@@ -479,7 +479,7 @@ void NetlibSslShutdown(SslHandle *ssl)
OutBuffers[0].cbBuffer = sizeof(dwType);
SecBufferDesc OutBuffer;
- OutBuffer.cBuffers = SIZEOF(OutBuffers);
+ OutBuffer.cBuffers = _countof(OutBuffers);
OutBuffer.pBuffers = OutBuffers;
OutBuffer.ulVersion = SECBUFFER_VERSION;
@@ -606,7 +606,7 @@ int NetlibSslRead(SslHandle *ssl, char *buf, int num, int peek)
SecBufferDesc Message;
Message.ulVersion = SECBUFFER_VERSION;
- Message.cBuffers = SIZEOF(Buffers);
+ Message.cBuffers = _countof(Buffers);
Message.pBuffers = Buffers;
if (g_pSSPI->DecryptMessage != NULL && g_pSSPI->DecryptMessage != PVOID(0x80000000))
@@ -629,7 +629,7 @@ int NetlibSslRead(SslHandle *ssl, char *buf, int num, int peek)
// Locate data and (optional) extra buffers.
SecBuffer *pDataBuffer = NULL;
SecBuffer *pExtraBuffer = NULL;
- for (int i = 1; i < SIZEOF(Buffers); i++) {
+ for (int i = 1; i < _countof(Buffers); i++) {
if (pDataBuffer == NULL && Buffers[i].BufferType == SECBUFFER_DATA)
pDataBuffer = &Buffers[i];
@@ -727,7 +727,7 @@ int NetlibSslWrite(SslHandle *ssl, const char *buf, int num)
SecBufferDesc Message;
Message.ulVersion = SECBUFFER_VERSION;
- Message.cBuffers = SIZEOF(Buffers);
+ Message.cBuffers = _countof(Buffers);
Message.pBuffers = Buffers;
if (g_pSSPI->EncryptMessage != NULL)
diff --git a/src/core/stduihist/src/history.cpp b/src/core/stduihist/src/history.cpp
index 0748d76e54..78ed1a68e8 100644
--- a/src/core/stduihist/src/history.cpp
+++ b/src/core/stduihist/src/history.cpp
@@ -162,10 +162,10 @@ static void FillHistoryThread(void* param)
db_event_get(hDbEvent, &dbei);
TCHAR str[200], eventText[256], strdatetime[64];
- GetObjectSummary(&dbei, str, SIZEOF(str));
+ GetObjectSummary(&dbei, str, _countof(str));
if (str[0]) {
- TimeZone_PrintTimeStamp(NULL, dbei.timestamp, _T("d t"), strdatetime, SIZEOF(strdatetime), 0);
- mir_sntprintf(eventText, SIZEOF(eventText), _T("%s: %s"), strdatetime, str);
+ TimeZone_PrintTimeStamp(NULL, dbei.timestamp, _T("d t"), strdatetime, _countof(strdatetime), 0);
+ mir_sntprintf(eventText, _countof(eventText), _T("%s: %s"), strdatetime, str);
i = SendMessage(hwndList, LB_ADDSTRING, 0, (LPARAM)eventText);
SendMessage(hwndList, LB_SETITEMDATA, i, (LPARAM)hDbEvent);
}
@@ -208,7 +208,7 @@ static INT_PTR CALLBACK DlgProcHistory(HWND hwndDlg, UINT msg, WPARAM wParam, LP
{
TCHAR* contactName, str[200];
contactName = pcli->pfnGetContactDisplayName(hContact, 0);
- mir_sntprintf(str, SIZEOF(str), TranslateT("History for %s"), contactName);
+ mir_sntprintf(str, _countof(str), TranslateT("History for %s"), contactName);
SetWindowText(hwndDlg, str);
}
Window_SetIcon_IcoLib(hwndDlg, SKINICON_OTHER_HISTORY);
@@ -289,7 +289,7 @@ static INT_PTR CALLBACK DlgProcHistory(HWND hwndDlg, UINT msg, WPARAM wParam, LP
dbei.pBlob = (PBYTE)mir_alloc(dbei.cbBlob);
if (db_event_get(hDbEvent, &dbei) == 0) {
TCHAR str[8192];
- GetObjectDescription(&dbei, str, SIZEOF(str));
+ GetObjectDescription(&dbei, str, _countof(str));
if (str[0])
SetDlgItemText(hwndDlg, IDC_EDIT, str);
}
@@ -327,7 +327,7 @@ static INT_PTR CALLBACK DlgProcHistory(HWND hwndDlg, UINT msg, WPARAM wParam, LP
db_event_get(hDbEvent, &dbei);
TCHAR str[1024];
- GetObjectDescription(&dbei, str, SIZEOF(str));
+ GetObjectDescription(&dbei, str, _countof(str));
if (str[0]) {
CharUpperBuff(str, (int)mir_tstrlen(str));
if (_tcsstr(str, (const TCHAR*)lParam) != NULL) {
@@ -361,7 +361,7 @@ static INT_PTR CALLBACK DlgProcHistoryFind(HWND hwndDlg, UINT msg, WPARAM wParam
case IDOK://find Next
TCHAR str[128];
HWND hwndParent = (HWND)GetWindowLongPtr(hwndDlg, GWLP_USERDATA);
- GetDlgItemText(hwndDlg, IDC_FINDWHAT, str, SIZEOF(str));
+ GetDlgItemText(hwndDlg, IDC_FINDWHAT, str, _countof(str));
CharUpperBuff(str, (int)mir_tstrlen(str));
SendMessage(hwndParent, DM_FINDNEXT, 0, (LPARAM)str);
return TRUE;
diff --git a/src/core/stdurl/url.cpp b/src/core/stdurl/url.cpp
index 1dfdfa894b..bd467f3d49 100644
--- a/src/core/stdurl/url.cpp
+++ b/src/core/stdurl/url.cpp
@@ -49,7 +49,7 @@ static int UrlEventAdded(WPARAM hContact, LPARAM lParam)
SkinPlaySound("RecvUrl");
TCHAR szTooltip[256];
- mir_sntprintf(szTooltip, SIZEOF(szTooltip), TranslateT("URL from %s"), pcli->pfnGetContactDisplayName(hContact, 0));
+ mir_sntprintf(szTooltip, _countof(szTooltip), TranslateT("URL from %s"), pcli->pfnGetContactDisplayName(hContact, 0));
CLISTEVENT cle = { sizeof(cle) };
cle.flags = CLEF_TCHAR;
@@ -82,7 +82,7 @@ static void RestoreUnreadUrlAlerts(void)
db_event_get(hDbEvent, &dbei);
if ( !(dbei.flags&(DBEF_SENT|DBEF_READ)) && dbei.eventType == EVENTTYPE_URL) {
TCHAR toolTip[256];
- mir_sntprintf(toolTip, SIZEOF(toolTip), TranslateT("URL from %s"), pcli->pfnGetContactDisplayName(hContact, 0));
+ mir_sntprintf(toolTip, _countof(toolTip), TranslateT("URL from %s"), pcli->pfnGetContactDisplayName(hContact, 0));
cle.hContact = hContact;
cle.hDbEvent = hDbEvent;
diff --git a/src/core/stdurl/urldialogs.cpp b/src/core/stdurl/urldialogs.cpp
index 157725362b..f654cae874 100644
--- a/src/core/stdurl/urldialogs.cpp
+++ b/src/core/stdurl/urldialogs.cpp
@@ -35,11 +35,10 @@ static void sttUpdateTitle(HWND hwndDlg, MCONTACT hContact)
if (hContact) {
szProto = GetContactProto(hContact);
if (szProto) {
- CONTACTINFO ci;
+ CONTACTINFO ci = { 0 };
int hasName = 0;
char buf[128];
memset(&ci, 0, sizeof(ci));
-
ci.cbSize = sizeof(ci);
ci.hContact = hContact;
ci.szProto = szProto;
@@ -53,7 +52,7 @@ static void sttUpdateTitle(HWND hwndDlg, MCONTACT hContact)
break;
case CNFT_DWORD:
hasName = 1;
- mir_snprintf(buf, SIZEOF(buf), "%u", ci.dVal);
+ mir_snprintf(buf, _countof(buf), "%u", ci.dVal);
break;
}
}
@@ -65,12 +64,12 @@ static void sttUpdateTitle(HWND hwndDlg, MCONTACT hContact)
SetDlgItemText(hwndDlg, IDC_NAME, contactName);
szStatus = pcli->pfnGetStatusModeDescription(db_get_w(hContact, szProto, "Status", ID_STATUS_OFFLINE), 0);
- mir_sntprintf(newtitle, SIZEOF(newtitle), _T("%s %s (%s)"), pszNewTitleStart, contactName, szStatus);
+ mir_sntprintf(newtitle, _countof(newtitle), _T("%s %s (%s)"), pszNewTitleStart, contactName, szStatus);
}
}
- else mir_tstrncpy(newtitle, pszNewTitleStart, SIZEOF(newtitle));
+ else mir_tstrncpy(newtitle, pszNewTitleStart, _countof(newtitle));
- GetWindowText(hwndDlg, oldtitle, SIZEOF(oldtitle));
+ GetWindowText(hwndDlg, oldtitle, _countof(oldtitle));
if (mir_tstrcmp(newtitle, oldtitle)) //swt() flickers even if the title hasn't actually changed
SetWindowText(hwndDlg, newtitle);
@@ -108,13 +107,13 @@ INT_PTR CALLBACK DlgProcUrlRecv(HWND hwndDlg, UINT msg, WPARAM wParam, LPARAM lP
db_event_markRead(dat->hContact, dat->hDbEvent);
TCHAR *contactName = pcli->pfnGetContactDisplayName(dat->hContact, 0), msg[128];
- mir_sntprintf(msg, SIZEOF(msg), TranslateT("URL from %s"), contactName);
+ mir_sntprintf(msg, _countof(msg), TranslateT("URL from %s"), contactName);
SetWindowText(hwndDlg, msg);
SetDlgItemText(hwndDlg, IDC_FROM, contactName);
SendDlgItemMessage(hwndDlg, IDOK, BUTTONSETARROW, 1, 0);
TCHAR str[128];
- TimeZone_PrintTimeStamp(NULL, dbei.timestamp, _T("t d"), str, SIZEOF(str), 0);
+ TimeZone_PrintTimeStamp(NULL, dbei.timestamp, _T("t d"), str, _countof(str), 0);
SetDlgItemText(hwndDlg, IDC_DATE, str);
}
@@ -166,7 +165,7 @@ INT_PTR CALLBACK DlgProcUrlRecv(HWND hwndDlg, UINT msg, WPARAM wParam, LPARAM lP
HMENU hSubMenu = GetSubMenu(hMenu, 6);
TranslateMenu(hSubMenu);
GetWindowRect((HWND)lParam, &rc);
- GetDlgItemTextA(hwndDlg, IDC_URL, url, SIZEOF(url));
+ GetDlgItemTextA(hwndDlg, IDC_URL, url, _countof(url));
switch(TrackPopupMenu(hSubMenu, TPM_RETURNCMD, rc.left, rc.bottom, 0, hwndDlg, NULL)) {
case IDM_OPENNEW:
CallService(MS_UTILS_OPENURL, OUF_NEWWINDOW, (LPARAM)url);
@@ -346,7 +345,7 @@ static void AddBrowserPageToCombo(char *url, HWND hwndCombo)
char szExistingUrl[1024];
for (i = SendMessage(hwndCombo, CB_GETCOUNT, 0, 0)-1;i>=0;i--) {
- if (SendMessage(hwndCombo, CB_GETLBTEXTLEN, i, 0) >= SIZEOF(szExistingUrl))
+ if (SendMessage(hwndCombo, CB_GETLBTEXTLEN, i, 0) >= _countof(szExistingUrl))
continue;
SendMessageA(hwndCombo, CB_GETLBTEXT, i, (LPARAM)szExistingUrl);
if ( !mir_strcmp(szExistingUrl, url)) return;
@@ -382,7 +381,7 @@ static void GetOpenBrowserUrlsForBrowser(const char *szBrowser, HWND hwndDlg, HW
}
int dataLength = GlobalSize(hData)-offsetof(DDEDATA, Value);
DDEDATA *data = (DDEDATA*)GlobalLock(hData);
- windowCount = dataLength/sizeof(DWORD);
+ windowCount = dataLength / sizeof(DWORD);
windowId = (PDWORD)mir_alloc(sizeof(DWORD)*windowCount);
memcpy(windowId, data->Value, windowCount*sizeof(DWORD));
GlobalUnlock(hData);
@@ -402,7 +401,7 @@ static void GetOpenBrowserUrlsForBrowser(const char *szBrowser, HWND hwndDlg, HW
for (i=0;i<windowCount;i++) {
if (windowId[i] == 0) break;
{ char str[16];
- mir_snprintf(str, SIZEOF(str), "%d", windowId[i]);
+ mir_snprintf(str, _countof(str), "%d", windowId[i]);
hData = DoDdeRequest(str, hwndDlg);
}
if (hData != NULL) {
@@ -619,7 +618,8 @@ INT_PTR CALLBACK DlgProcUrlSend(HWND hwndDlg, UINT msg, WPARAM wParam, LPARAM lP
if (ack->hContact != dat->hContact) break;
if (ack->type != ACKTYPE_URL || ack->result != ACKRESULT_SUCCESS) break;
- DBEVENTINFO dbei = { sizeof(dbei) };
+ DBEVENTINFO dbei = { 0 };
+ dbei.cbSize = sizeof(dbei);
dbei.eventType = EVENTTYPE_URL;
dbei.flags = DBEF_SENT;
dbei.szModule = GetContactProto(dat->hContact);
diff --git a/src/core/stduserinfo/src/contactinfo.cpp b/src/core/stduserinfo/src/contactinfo.cpp
index 7636f6b231..88e41465dd 100644
--- a/src/core/stduserinfo/src/contactinfo.cpp
+++ b/src/core/stduserinfo/src/contactinfo.cpp
@@ -112,9 +112,9 @@ static INT_PTR CALLBACK EditUserPhoneDlgProc(HWND hwndDlg, UINT msg, WPARAM wPar
EnableWindow(GetDlgItem(hwndDlg, IDOK), TRUE);
{
char szPhone[96], szArea[32], szNumber[64];
- GetDlgItemTextA(hwndDlg, IDC_AREA, szArea, SIZEOF(szArea));
- GetDlgItemTextA(hwndDlg, IDC_NUMBER, szNumber, SIZEOF(szNumber));
- mir_snprintf(szPhone, SIZEOF(szPhone), "+%u (%s) %s", SendDlgItemMessage(hwndDlg, IDC_COUNTRY, CB_GETITEMDATA, SendDlgItemMessage(hwndDlg, IDC_COUNTRY, CB_GETCURSEL, 0, 0), 0), szArea, szNumber);
+ GetDlgItemTextA(hwndDlg, IDC_AREA, szArea, _countof(szArea));
+ GetDlgItemTextA(hwndDlg, IDC_NUMBER, szNumber, _countof(szNumber));
+ mir_snprintf(szPhone, _countof(szPhone), "+%u (%s) %s", SendDlgItemMessage(hwndDlg, IDC_COUNTRY, CB_GETITEMDATA, SendDlgItemMessage(hwndDlg, IDC_COUNTRY, CB_GETCURSEL, 0, 0), 0), szArea, szNumber);
noRecursion = 1;
SetDlgItemTextA(hwndDlg, IDC_PHONE, szPhone);
noRecursion = 0;
@@ -127,7 +127,7 @@ static INT_PTR CALLBACK EditUserPhoneDlgProc(HWND hwndDlg, UINT msg, WPARAM wPar
{
char szText[256], *pText = NULL, *pArea, *pNumber;
int i, isValid = 1;
- GetDlgItemTextA(hwndDlg, IDC_PHONE, szText, SIZEOF(szText));
+ GetDlgItemTextA(hwndDlg, IDC_PHONE, szText, _countof(szText));
if (szText[0] != '+')
isValid = 0;
@@ -190,7 +190,7 @@ static int IsOverEmail(HWND hwndDlg, TCHAR* szEmail, int cchEmail)
ListView_GetSubItemRect(hwndEmails, hti.iItem, 1, LVIR_LABEL, &rc);
TCHAR szText[256]; szText[0] = 0;
- ListView_GetItemText(hwndEmails, hti.iItem, 1, szText, SIZEOF(szText));
+ ListView_GetItemText(hwndEmails, hti.iItem, 1, szText, _countof(szText));
HDC hdc = GetDC(hwndEmails);
SelectObject(hdc, hEmailFont);
@@ -282,7 +282,7 @@ INT_PTR CALLBACK ContactDlgProc(HWND hwndDlg, UINT msg, WPARAM wParam, LPARAM lP
break;
lvi.pszText = idstr2;
- mir_sntprintf(idstr2, SIZEOF(idstr2), _T("%d"), i+2);
+ mir_sntprintf(idstr2, _countof(idstr2), _T("%d"), i+2);
}
ListView_InsertItem(GetDlgItem(hwndDlg, IDC_EMAILS), &lvi);
ListView_SetItemText(GetDlgItem(hwndDlg, IDC_EMAILS), lvi.iItem, 1, dbv.ptszVal);
@@ -296,7 +296,7 @@ INT_PTR CALLBACK ContactDlgProc(HWND hwndDlg, UINT msg, WPARAM wParam, LPARAM lP
if (db_get_ts(hContact, "UserInfo", idstr, &dbv))
break;
lvi.pszText = idstr2;
- mir_sntprintf(idstr2, SIZEOF(idstr2), TranslateT("Custom %d"), i+1);
+ mir_sntprintf(idstr2, _countof(idstr2), TranslateT("Custom %d"), i+1);
ListView_InsertItem(GetDlgItem(hwndDlg, IDC_EMAILS), &lvi);
ListView_SetItemText(GetDlgItem(hwndDlg, IDC_EMAILS), lvi.iItem, 1, dbv.ptszVal);
db_free(&dbv);
@@ -357,7 +357,7 @@ INT_PTR CALLBACK ContactDlgProc(HWND hwndDlg, UINT msg, WPARAM wParam, LPARAM lP
if (db_get_ts(hContact, "UserInfo", idstr, &dbv))
break;
lvi.pszText = idstr2;
- mir_sntprintf(idstr2, SIZEOF(idstr2), TranslateT("Custom %d"), i+1);
+ mir_sntprintf(idstr2, _countof(idstr2), TranslateT("Custom %d"), i+1);
ListView_InsertItem(GetDlgItem(hwndDlg, IDC_PHONES), &lvi);
if (mir_tstrlen(dbv.ptszVal)>4 && !mir_tstrcmp(dbv.ptszVal+mir_tstrlen(dbv.ptszVal)-4, _T(" SMS"))) {
ListView_SetItemText(GetDlgItem(hwndDlg, IDC_PHONES), lvi.iItem, 2, _T("y"));
@@ -400,7 +400,7 @@ INT_PTR CALLBACK ContactDlgProc(HWND hwndDlg, UINT msg, WPARAM wParam, LPARAM lP
if (nm->iSubItem == 1 && nm->nmcd.hdr.idFrom == IDC_EMAILS) {
HFONT hoFont;
TCHAR szText[256] = {0};
- ListView_GetItemText(nm->nmcd.hdr.hwndFrom, nm->nmcd.dwItemSpec, nm->iSubItem, szText, SIZEOF(szText));
+ ListView_GetItemText(nm->nmcd.hdr.hwndFrom, nm->nmcd.dwItemSpec, nm->iSubItem, szText, _countof(szText));
hoFont = (HFONT)SelectObject(nm->nmcd.hdc, hEmailFont);
SetTextColor(nm->nmcd.hdc, RGB(0, 0, 255));
DrawText(nm->nmcd.hdc, szText, -1, &rc, DT_END_ELLIPSIS|DT_LEFT|DT_NOPREFIX|DT_SINGLELINE|DT_TOP);
@@ -416,7 +416,7 @@ INT_PTR CALLBACK ContactDlgProc(HWND hwndDlg, UINT msg, WPARAM wParam, LPARAM lP
static int iconResources[3] = {SKINICON_OTHER_RENAME, SKINICON_OTHER_DELETE};
if (nm->iSubItem == 2 && nm->nmcd.hdr.idFrom == IDC_PHONES) {
TCHAR szText[2];
- ListView_GetItemText(nm->nmcd.hdr.hwndFrom, nm->nmcd.dwItemSpec, nm->iSubItem, szText, SIZEOF(szText));
+ ListView_GetItemText(nm->nmcd.hdr.hwndFrom, nm->nmcd.dwItemSpec, nm->iSubItem, szText, _countof(szText));
if (szText[0]) hIcon = Skin_LoadIcon(SKINICON_OTHER_SMS);
}
else hIcon = Skin_LoadIcon(iconResources[nm->iSubItem-3+(nm->nmcd.hdr.idFrom == IDC_EMAILS)]);
@@ -440,9 +440,9 @@ INT_PTR CALLBACK ContactDlgProc(HWND hwndDlg, UINT msg, WPARAM wParam, LPARAM lP
char *szIdTemplate = (nm->hdr.idFrom == IDC_PHONES) ? "MyPhone%d" : "Mye-mail%d";
LVHITTESTINFO hti;
- if (IsOverEmail(hwndDlg, szEmail, SIZEOF(szEmail))) {
+ if (IsOverEmail(hwndDlg, szEmail, _countof(szEmail))) {
TCHAR szExec[264];
- mir_sntprintf(szExec, SIZEOF(szExec), _T("mailto:%s"), szEmail);
+ mir_sntprintf(szExec, _countof(szExec), _T("mailto:%s"), szEmail);
ShellExecute(hwndDlg, _T("open"), szExec, NULL, NULL, SW_SHOW);
break;
}
@@ -493,7 +493,7 @@ INT_PTR CALLBACK ContactDlgProc(HWND hwndDlg, UINT msg, WPARAM wParam, LPARAM lP
DBVARIANT dbv;
mir_snprintf(idstr, szIdTemplate, lvi.lParam);
if (db_get_s(hContact, "UserInfo", idstr, &dbv)) break;
- mir_strncpy(szText, dbv.pszVal, SIZEOF(szText));
+ mir_strncpy(szText, dbv.pszVal, _countof(szText));
db_free(&dbv);
if (IDOK != DialogBoxParam(hInst, MAKEINTRESOURCE(nm->hdr.idFrom == IDC_PHONES?IDD_ADDPHONE:IDD_ADDEMAIL), hwndDlg, nm->hdr.idFrom == IDC_PHONES?EditUserPhoneDlgProc:EditUserEmailDlgProc, (LPARAM)szText))
break;
diff --git a/src/core/stduserinfo/src/stdinfo.cpp b/src/core/stduserinfo/src/stdinfo.cpp
index 3ad3f9432c..0ac9910f84 100644
--- a/src/core/stduserinfo/src/stdinfo.cpp
+++ b/src/core/stduserinfo/src/stdinfo.cpp
@@ -89,7 +89,7 @@ static void SetValue(HWND hwndDlg, int idCtrl, MCONTACT hContact, char *szModule
else if (special == SVS_MONTH) {
if (dbv.bVal > 0 && dbv.bVal <= 12) {
pstr = str;
- GetLocaleInfoA(LOCALE_USER_DEFAULT, LOCALE_SABBREVMONTHNAME1-1 + dbv.bVal, str, SIZEOF(str));
+ GetLocaleInfoA(LOCALE_USER_DEFAULT, LOCALE_SABBREVMONTHNAME1-1 + dbv.bVal, str, _countof(str));
}
else unspecified = 1;
}
@@ -111,7 +111,7 @@ static void SetValue(HWND hwndDlg, int idCtrl, MCONTACT hContact, char *szModule
WORD wSave = dbv.wVal;
if (wSave == (WORD)-1) {
char szSettingName[100];
- mir_snprintf(szSettingName, SIZEOF(szSettingName), "%sName", szSetting);
+ mir_snprintf(szSettingName, _countof(szSettingName), "%sName", szSetting);
if (!db_get_ts(hContact, szModule, szSettingName, &dbv)) {
ptstr = dbv.ptszVal;
unspecified = false;
@@ -221,8 +221,8 @@ static INT_PTR CALLBACK SummaryDlgProc(HWND hwndDlg, UINT msg, WPARAM wParam, LP
case IDC_EMAIL:
if (IsWindowEnabled(GetDlgItem(hwndDlg, IDC_EMAIL))) {
TCHAR szExec[264], szEmail[256];
- GetDlgItemText(hwndDlg, IDC_EMAIL, szEmail, SIZEOF(szEmail));
- mir_sntprintf(szExec, SIZEOF(szExec), _T("mailto:%s"), szEmail);
+ GetDlgItemText(hwndDlg, IDC_EMAIL, szEmail, _countof(szEmail));
+ mir_sntprintf(szExec, _countof(szExec), _T("mailto:%s"), szEmail);
ShellExecute(hwndDlg, _T("open"), szExec, NULL, NULL, SW_SHOW);
}
break;
@@ -250,7 +250,7 @@ static INT_PTR CALLBACK LocationDlgProc(HWND hwndDlg, UINT msg, WPARAM wParam, L
MCONTACT hContact = (MCONTACT)GetWindowLongPtr(hwndDlg, GWLP_USERDATA);
if (hContact != NULL) {
TCHAR szTime[80];
- if (printDateTimeByContact(hContact, _T("s"), szTime, SIZEOF(szTime), TZF_KNOWNONLY)) {
+ if (printDateTimeByContact(hContact, _T("s"), szTime, _countof(szTime), TZF_KNOWNONLY)) {
EnableWindow(GetDlgItem(hwndDlg, IDC_LOCALTIME), FALSE);
SetDlgItemText(hwndDlg, IDC_LOCALTIME, TranslateT("<not specified>"));
}
@@ -344,7 +344,7 @@ static INT_PTR CALLBACK WorkDlgProc(HWND hwndDlg, UINT msg, WPARAM wParam, LPARA
case IDC_WEBPAGE:
if (IsWindowEnabled(GetDlgItem(hwndDlg, IDC_WEBPAGE))) {
char szPage[256];
- GetDlgItemTextA(hwndDlg, IDC_WEBPAGE, szPage, SIZEOF(szPage));
+ GetDlgItemTextA(hwndDlg, IDC_WEBPAGE, szPage, _countof(szPage));
CallService(MS_UTILS_OPENURL, OUF_NEWWINDOW, (LPARAM)szPage);
}
}
@@ -482,7 +482,7 @@ static INT_PTR CALLBACK BackgroundDlgProc(HWND hwndDlg, UINT msg, WPARAM wParam,
case IDC_WEBPAGE:
if (IsWindowEnabled(GetDlgItem(hwndDlg, IDC_WEBPAGE))) {
char szPage[256];
- GetDlgItemTextA(hwndDlg, IDC_WEBPAGE, szPage, SIZEOF(szPage));
+ GetDlgItemTextA(hwndDlg, IDC_WEBPAGE, szPage, _countof(szPage));
CallService(MS_UTILS_OPENURL, OUF_NEWWINDOW, (LPARAM)szPage);
}
break;
@@ -545,7 +545,7 @@ static INT_PTR CALLBACK NotesDlgProc(HWND hwndDlg, UINT msg, WPARAM wParam, LPAR
MCONTACT hContact = (MCONTACT)((LPPSHNOTIFY)lParam)->lParam;
if (GetWindowTextLength(GetDlgItem(hwndDlg, IDC_MYNOTES))) {
char text[2048];
- GetDlgItemTextA(hwndDlg, IDC_MYNOTES, text, SIZEOF(text));
+ GetDlgItemTextA(hwndDlg, IDC_MYNOTES, text, _countof(text));
db_set_s(hContact, "UserInfo", "MyNotes", text);
}
else db_unset(hContact, "UserInfo", "MyNotes");
diff --git a/src/core/stduserinfo/src/userinfo.cpp b/src/core/stduserinfo/src/userinfo.cpp
index b195b5bb05..872312f824 100644
--- a/src/core/stduserinfo/src/userinfo.cpp
+++ b/src/core/stduserinfo/src/userinfo.cpp
@@ -254,8 +254,8 @@ static INT_PTR CALLBACK DlgProcDetails(HWND hwndDlg, UINT msg, WPARAM wParam, LP
else
name = pcli->pfnGetContactDisplayName(dat->hContact, 0);
- GetWindowText(hwndDlg, oldTitle, SIZEOF(oldTitle));
- mir_sntprintf(newTitle, SIZEOF(newTitle), oldTitle, name);
+ GetWindowText(hwndDlg, oldTitle, _countof(oldTitle));
+ mir_sntprintf(newTitle, _countof(newTitle), oldTitle, name);
SetWindowText(hwndDlg, newTitle);
//////////////////////////////////////////////////////////////////////
@@ -341,7 +341,7 @@ static INT_PTR CALLBACK DlgProcDetails(HWND hwndDlg, UINT msg, WPARAM wParam, LP
//////////////////////////////////////////////////////////////////////
dat->updateAnimFrame = 0;
- GetDlgItemText(hwndDlg, IDC_UPDATING, dat->szUpdating, SIZEOF(dat->szUpdating));
+ GetDlgItemText(hwndDlg, IDC_UPDATING, dat->szUpdating, _countof(dat->szUpdating));
SendMessage(hwndDlg, M_CHECKONLINE, 0, 0);
if (!CallContactService(dat->hContact, PSS_GETINFO, SGIF_ONOPEN, 0)) {
EnableWindow(GetDlgItem(hwndDlg, IDC_UPDATE), FALSE);
@@ -355,7 +355,7 @@ static INT_PTR CALLBACK DlgProcDetails(HWND hwndDlg, UINT msg, WPARAM wParam, LP
case WM_TIMER:
TCHAR str[128];
- mir_sntprintf(str, SIZEOF(str), _T("%.*s%s%.*s"), dat->updateAnimFrame % 10, _T("........."), dat->szUpdating, dat->updateAnimFrame % 10, _T("........."));
+ mir_sntprintf(str, _countof(str), _T("%.*s%s%.*s"), dat->updateAnimFrame % 10, _T("........."), dat->szUpdating, dat->updateAnimFrame % 10, _T("........."));
SetDlgItemText(hwndDlg, IDC_UPDATING, str);
if (++dat->updateAnimFrame == UPDATEANIMFRAMES)
dat->updateAnimFrame = 0;
@@ -584,7 +584,7 @@ static INT_PTR CALLBACK DlgProcDetails(HWND hwndDlg, UINT msg, WPARAM wParam, LP
tvi.mask = TVIF_TEXT;
tvi.hItem = dat->opd[dat->currentPage].hItem;
tvi.pszText = name;
- tvi.cchTextMax = SIZEOF(name);
+ tvi.cchTextMax = _countof(name);
TreeView_GetItem(GetDlgItem(hwndDlg, IDC_PAGETREE), &tvi);
db_set_ts(NULL, "UserInfo", "LastTab", name);
diff --git a/src/core/stduseronline/src/useronline.cpp b/src/core/stduseronline/src/useronline.cpp
index 32e5bcb2b8..f9117bc809 100644
--- a/src/core/stduseronline/src/useronline.cpp
+++ b/src/core/stduseronline/src/useronline.cpp
@@ -67,7 +67,7 @@ static int UserOnlineSettingChanged(WPARAM hContact, LPARAM lParam)
cle.hDbEvent = uniqueEventId++;
cle.hIcon = Skin_LoadIcon(SKINICON_OTHER_USERONLINE, false);
cle.pszService = "UserOnline/Description";
- mir_sntprintf(tooltip, SIZEOF(tooltip), TranslateT("%s is online"), pcli->pfnGetContactDisplayName(hContact, 0));
+ mir_sntprintf(tooltip, _countof(tooltip), TranslateT("%s is online"), pcli->pfnGetContactDisplayName(hContact, 0));
cle.ptszTooltip = tooltip;
CallService(MS_CLIST_ADDEVENT, 0, (LPARAM)&cle);
IcoLib_ReleaseIcon(cle.hIcon, 0);
diff --git a/src/mir_app/src/DefaultExtraIcons.cpp b/src/mir_app/src/DefaultExtraIcons.cpp
index 09ff82aa72..e5fa87d324 100644
--- a/src/mir_app/src/DefaultExtraIcons.cpp
+++ b/src/mir_app/src/DefaultExtraIcons.cpp
@@ -112,7 +112,7 @@ struct Info
static void EmailOnClick(Info*, const char *text)
{
char cmd[1024];
- mir_snprintf(cmd, SIZEOF(cmd), "mailto:%s", text);
+ mir_snprintf(cmd, _countof(cmd), "mailto:%s", text);
ShellExecuteA(NULL, "open", cmd, NULL, NULL, SW_SHOW);
}
@@ -143,10 +143,10 @@ static void SetExtraIcons(MCONTACT hContact)
if ( IsEmpty(proto))
return;
- for (unsigned int i = 0; i < SIZEOF(infos); i++) {
+ for (unsigned int i = 0; i < _countof(infos); i++) {
Info &p = infos[i];
- for (unsigned int j = 0; j < SIZEOF(p.db); j += 2) {
+ for (unsigned int j = 0; j < _countof(p.db); j += 2) {
if (p.db[j + 1] == NULL)
break;
@@ -180,10 +180,10 @@ static int SettingChanged(WPARAM hContact, LPARAM lParam)
return 0;
}
- for (int i = 0; i < SIZEOF(infos); i++) {
+ for (int i = 0; i < _countof(infos); i++) {
Info &p = infos[i];
- for (int j = 0; j < SIZEOF(p.db); j += 2) {
+ for (int j = 0; j < _countof(p.db); j += 2) {
if (p.db[j + 1] == NULL)
break;
if (p.db[j] == NULL && !isProto)
@@ -216,7 +216,7 @@ static int DefaultOnClick(WPARAM hContact, LPARAM, LPARAM param)
return 0;
bool found = false;
- for (int j = 0; !found && j < SIZEOF(p->db); j += 2) {
+ for (int j = 0; !found && j < _countof(p->db); j += 2) {
if (p->db[j + 1] == NULL)
break;
@@ -307,7 +307,7 @@ void DefaultExtraIcons_Load()
hExtraProto = ExtraIcon_Register("protocol", "Account", Skin_GetIconName(SKINICON_OTHER_ACCMGR),
&ProtocolRebuildIcons, &ProtocolApplyIcon, &ProtocolOnClick);
- for (int i = 0; i < SIZEOF(infos); i++) {
+ for (int i = 0; i < _countof(infos); i++) {
Info &p = infos[i];
p.hIcolib = Skin_GetIconHandle(p.iSkinIcon);
if (p.OnClick)
diff --git a/src/mir_app/src/FontOptions.cpp b/src/mir_app/src/FontOptions.cpp
index 32d76d2db8..9bea94cc87 100644
--- a/src/mir_app/src/FontOptions.cpp
+++ b/src/mir_app/src/FontOptions.cpp
@@ -149,7 +149,7 @@ static BOOL ExportSettings(HWND hwndDlg, const TCHAR *filename, OBJLIST<FontInte
mir_snprintf(buff, "\n[%s]", F.dbSettingsGroup);
if (mir_strcmp(buff, header) != 0) {
- strncpy(header, buff, SIZEOF(header));
+ strncpy(header, buff, _countof(header));
WriteLine(out, buff);
}
@@ -311,7 +311,7 @@ static HTREEITEM sttFindNamedTreeItemAt(HWND hwndTree, HTREEITEM hItem, const TC
tvi.mask = TVIF_TEXT;
tvi.pszText = str;
- tvi.cchTextMax = SIZEOF(str);
+ tvi.cchTextMax = _countof(str);
while (tvi.hItem) {
TreeView_GetItem(hwndTree, &tvi);
@@ -450,7 +450,7 @@ static INT_PTR CALLBACK ChooseEffectDlgProc(HWND hwndDlg, UINT uMsg, WPARAM wPar
TranslateDialogDefault(hwndDlg);
pEffect = (FONTEFFECT*)lParam;
{
- for (int i = 0; i < SIZEOF(ModernEffectNames); i++) {
+ for (int i = 0; i < _countof(ModernEffectNames); i++) {
int itemid = SendDlgItemMessage(hwndDlg, IDC_EFFECT_COMBO, CB_ADDSTRING, 0, (LPARAM)TranslateTS(ModernEffectNames[i]));
SendDlgItemMessage(hwndDlg, IDC_EFFECT_COMBO, CB_SETITEMDATA, itemid, i);
SendDlgItemMessage(hwndDlg, IDC_EFFECT_COMBO, CB_SETCURSEL, 0, 0);
@@ -1078,7 +1078,7 @@ static INT_PTR CALLBACK DlgProcLogOptions(HWND hwndDlg, UINT msg, WPARAM wParam,
case IDC_BTN_EXPORT:
{
TCHAR fname_buff[MAX_PATH], filter[MAX_PATH];
- mir_sntprintf(filter, SIZEOF(filter), _T("%s (*.ini)%c*.ini%c%s (*.txt)%c*.TXT%c%s (*.*)%c*.*%c"), TranslateT("Configuration files"), 0, 0, TranslateT("Text files"), 0, 0, TranslateT("All files"), 0, 0);
+ mir_sntprintf(filter, _countof(filter), _T("%s (*.ini)%c*.ini%c%s (*.txt)%c*.TXT%c%s (*.*)%c*.*%c"), TranslateT("Configuration files"), 0, 0, TranslateT("Text files"), 0, 0, TranslateT("All files"), 0, 0);
OPENFILENAME ofn = { 0 };
ofn.lStructSize = sizeof(ofn);
diff --git a/src/mir_app/src/FontService.cpp b/src/mir_app/src/FontService.cpp
index 417597d8de..51ce2981c0 100644
--- a/src/mir_app/src/FontService.cpp
+++ b/src/mir_app/src/FontService.cpp
@@ -95,17 +95,17 @@ int LoadFontserviceModule(void)
_tcsncpy_s(fontid.name, LPGENT("Headers"), _TRUNCATE);
fontid.flags = FIDF_APPENDNAME | FIDF_NOAS | FIDF_SAVEPOINTSIZE | FIDF_ALLOWEFFECTS | FIDF_CLASSHEADER;
- strncpy(fontid.prefix, "Header", SIZEOF(fontid.prefix));
+ strncpy(fontid.prefix, "Header", _countof(fontid.prefix));
FontRegisterT(&fontid);
_tcsncpy_s(fontid.name, LPGENT("Generic text"), _TRUNCATE);
fontid.flags = FIDF_APPENDNAME | FIDF_NOAS | FIDF_SAVEPOINTSIZE | FIDF_ALLOWEFFECTS | FIDF_CLASSGENERAL;
- strncpy(fontid.prefix, "Generic", SIZEOF(fontid.prefix));
+ strncpy(fontid.prefix, "Generic", _countof(fontid.prefix));
FontRegisterT(&fontid);
_tcsncpy_s(fontid.name, LPGENT("Small text"), _TRUNCATE);
fontid.flags = FIDF_APPENDNAME | FIDF_NOAS | FIDF_SAVEPOINTSIZE | FIDF_ALLOWEFFECTS | FIDF_CLASSSMALL;
- strncpy(fontid.prefix, "Small", SIZEOF(fontid.prefix));
+ strncpy(fontid.prefix, "Small", _countof(fontid.prefix));
FontRegisterT(&fontid);
// do last for silly dyna plugin
diff --git a/src/mir_app/src/button.cpp b/src/mir_app/src/button.cpp
index b17e29d751..54a72c1c98 100644
--- a/src/mir_app/src/button.cpp
+++ b/src/mir_app/src/button.cpp
@@ -204,7 +204,7 @@ static void PaintWorker(MButtonCtrl *ctl, HDC hdcPaint)
SIZE sz;
TCHAR szText[MAX_PATH];
- GetWindowText(ctl->hwnd, szText, SIZEOF(szText));
+ GetWindowText(ctl->hwnd, szText, _countof(szText));
GetTextExtentPoint32(hdcMem, szText, (int)mir_tstrlen(szText), &sz);
int xOffset = (rcClient.right - rcClient.left - sz.cx)/2;
int yOffset = (rcClient.bottom - rcClient.top - sz.cy)/2;
diff --git a/src/mir_app/src/chat_clist.cpp b/src/mir_app/src/chat_clist.cpp
index cd633f600b..9a2c1991b8 100644
--- a/src/mir_app/src/chat_clist.cpp
+++ b/src/mir_app/src/chat_clist.cpp
@@ -212,7 +212,7 @@ BOOL AddEvent(MCONTACT hContact, HICON hIcon, MEVENT hEvent, int type, TCHAR* fm
va_list marker;
va_start(marker, fmt);
- mir_vsntprintf(szBuf, SIZEOF(szBuf), fmt, marker);
+ mir_vsntprintf(szBuf, _countof(szBuf), fmt, marker);
va_end(marker);
CLISTEVENT cle = { 0 };
diff --git a/src/mir_app/src/chat_log.cpp b/src/mir_app/src/chat_log.cpp
index 79b608953c..f3ac0e6a4b 100644
--- a/src/mir_app/src/chat_log.cpp
+++ b/src/mir_app/src/chat_log.cpp
@@ -26,7 +26,7 @@ Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
// the srmm module and then modified to fit the chat module.
char* pLogIconBmpBits[14];
-size_t logIconBmpSize[ SIZEOF(pLogIconBmpBits) ];
+size_t logIconBmpSize[ _countof(pLogIconBmpBits) ];
#define RTFCACHELINESIZE 128
static char CHAT_rtfFontsGlobal[OPTIONS_FONTCOUNT][RTFCACHELINESIZE];
@@ -315,7 +315,7 @@ static void AddEventToBuffer(char *&buffer, size_t &bufferEnd, size_t &bufferAll
TCHAR* MakeTimeStamp(TCHAR *pszStamp, time_t time)
{
static TCHAR szTime[30];
- if (!_tcsftime(szTime, SIZEOF(szTime)-1, pszStamp, localtime(&time)))
+ if (!_tcsftime(szTime, _countof(szTime)-1, pszStamp, localtime(&time)))
_tcsncpy_s(szTime, TranslateT("<invalid>"), _TRUNCATE);
return szTime;
}
@@ -364,12 +364,12 @@ char* Log_CreateRTF(LOGSTREAMDATA *streamData)
static char szStyle[256];
if (lin->ptszNick && lin->iType == GC_EVENT_MESSAGE) {
int iii = lin->bIsHighlighted ? 16 : (lin->bIsMe ? 2 : 1);
- mir_snprintf(szStyle, SIZEOF(szStyle), "\\f0\\cf%u\\ul0\\highlight0\\b%d\\i%d\\fs%u", iii + 1, lf.lfWeight >= FW_BOLD ? 1 : 0, lf.lfItalic, 2 * abs(lf.lfHeight) * 74 / ci.logPixelSY);
+ mir_snprintf(szStyle, _countof(szStyle), "\\f0\\cf%u\\ul0\\highlight0\\b%d\\i%d\\fs%u", iii + 1, lf.lfWeight >= FW_BOLD ? 1 : 0, lf.lfItalic, 2 * abs(lf.lfHeight) * 74 / ci.logPixelSY);
Log_Append(buffer, bufferEnd, bufferAlloced, "%s ", szStyle);
}
else {
int iii = lin->bIsHighlighted ? 16 : EventToIndex(lin);
- mir_snprintf(szStyle, SIZEOF(szStyle), "\\f0\\cf%u\\ul0\\highlight0\\b%d\\i%d\\fs%u", iii + 1, lf.lfWeight >= FW_BOLD ? 1 : 0, lf.lfItalic, 2 * abs(lf.lfHeight) * 74 / ci.logPixelSY);
+ mir_snprintf(szStyle, _countof(szStyle), "\\f0\\cf%u\\ul0\\highlight0\\b%d\\i%d\\fs%u", iii + 1, lf.lfWeight >= FW_BOLD ? 1 : 0, lf.lfItalic, 2 * abs(lf.lfHeight) * 74 / ci.logPixelSY);
Log_Append(buffer, bufferEnd, bufferAlloced, "%s ", szStyle);
}
}
@@ -494,7 +494,7 @@ void LoadMsgLogBitmaps(void)
HBITMAP hBmp = CreateCompatibleBitmap(hdc, bih.biWidth, bih.biHeight);
HDC hdcMem = CreateCompatibleDC(hdc);
PBYTE pBmpBits = (PBYTE)mir_alloc(widthBytes * bih.biHeight);
- for (int i = 0; i < SIZEOF(pLogIconBmpBits); i++) {
+ for (int i = 0; i < _countof(pLogIconBmpBits); i++) {
size_t size = RTFPICTHEADERMAXSIZE + (bih.biSize + widthBytes * bih.biHeight) * 2;
pLogIconBmpBits[i] = (char*)mir_alloc(size);
size_t rtfHeaderSize = mir_snprintf((char *)pLogIconBmpBits[i], size, "{\\pict\\dibitmap0\\wbmbitspixel%u\\wbmplanes1\\wbmwidthbytes%u\\picw%u\\pich%u ", bih.biBitCount, widthBytes, bih.biWidth, bih.biHeight);
@@ -537,6 +537,6 @@ void LoadMsgLogBitmaps(void)
void FreeMsgLogBitmaps(void)
{
- for (int i = 0; i < SIZEOF(pLogIconBmpBits); i++)
+ for (int i = 0; i < _countof(pLogIconBmpBits); i++)
mir_free(pLogIconBmpBits[i]);
}
diff --git a/src/mir_app/src/chat_opts.cpp b/src/mir_app/src/chat_opts.cpp
index 3a5252e959..ffb6e0d74e 100644
--- a/src/mir_app/src/chat_opts.cpp
+++ b/src/mir_app/src/chat_opts.cpp
@@ -139,12 +139,12 @@ void RegisterFonts(void)
_tcsncpy_s(fontid.backgroundGroup, g_szFontGroup, _TRUNCATE);
_tcsncpy_s(fontid.group, g_szFontGroup, _TRUNCATE);
- for (int i = 0; i < SIZEOF(fontOptionsList); i++, index++) {
+ for (int i = 0; i < _countof(fontOptionsList); i++, index++) {
FontOptionsList &FO = fontOptionsList[i];
strncpy_s(fontid.dbSettingsGroup, CHATFONT_MODULE, _TRUNCATE);
_tcsncpy_s(fontid.name, FO.szDescr, _TRUNCATE);
- mir_snprintf(fontid.prefix, SIZEOF(fontid.prefix), "Font%d", index);
+ mir_snprintf(fontid.prefix, _countof(fontid.prefix), "Font%d", index);
fontid.order = index;
switch (i) {
diff --git a/src/mir_app/src/chat_tools.cpp b/src/mir_app/src/chat_tools.cpp
index 00b3f90e5d..fd72ed1ea1 100644
--- a/src/mir_app/src/chat_tools.cpp
+++ b/src/mir_app/src/chat_tools.cpp
@@ -45,8 +45,8 @@ TCHAR* RemoveFormatting(const TCHAR *pszWord)
TCHAR *d = szTemp;
size_t cbLen = mir_tstrlen(pszWord);
- if (cbLen > SIZEOF(szTemp))
- cbLen = SIZEOF(szTemp)-1;
+ if (cbLen > _countof(szTemp))
+ cbLen = _countof(szTemp)-1;
for (size_t i = 0; i < cbLen;) {
if (pszWord[i] == '%') {
@@ -184,11 +184,11 @@ int ShowPopup(MCONTACT hContact, SESSION_INFO *si, HICON hIcon, char *pszProtoNa
pd.lchIcon = LoadIconEx("window", FALSE);
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,
cli.pfnGetContactDisplayName(hContact, 0));
- mir_tstrncpy(pd.lptzText, TranslateTS(szBuf), SIZEOF(pd.lptzText));
+ mir_tstrncpy(pd.lptzText, TranslateTS(szBuf), _countof(pd.lptzText));
pd.iSeconds = g_Settings->iPopupTimeout;
if (g_Settings->iPopupStyle == 2) {
@@ -563,9 +563,9 @@ BOOL LogToFile(SESSION_INFO *si, GCEVENT *gce)
// formatting strings don't need to be translatable - changing them via language pack would
// only screw up the log format.
if (p)
- mir_sntprintf(szLine, SIZEOF(szLine), _T("%s %c %s\r\n"), szTime, p, szBuffer);
+ mir_sntprintf(szLine, _countof(szLine), _T("%s %c %s\r\n"), szTime, p, szBuffer);
else
- mir_sntprintf(szLine, SIZEOF(szLine), _T("%s %s\r\n"), szTime, szBuffer);
+ mir_sntprintf(szLine, _countof(szLine), _T("%s %s\r\n"), szTime, szBuffer);
if (szLine[0]) {
_fputts(szLine, hFile);
@@ -590,11 +590,11 @@ BOOL LogToFile(SESSION_INFO *si, GCEVENT *gce)
_tsplitpath(si->pszLogFileName, tszDrive, tszDir, tszName, tszExt);
TCHAR tszNewPath[_MAX_DRIVE + _MAX_DIR + _MAX_FNAME + _MAX_EXT + 20];
- mir_sntprintf(tszNewPath, SIZEOF(tszNewPath), _T("%s%sarchived\\"), tszDrive, tszDir);
+ mir_sntprintf(tszNewPath, _countof(tszNewPath), _T("%s%sarchived\\"), tszDrive, tszDir);
CreateDirectoryTreeT(tszNewPath);
TCHAR tszNewName[_MAX_DRIVE + _MAX_DIR + _MAX_FNAME + _MAX_EXT + 20];
- mir_sntprintf(tszNewName, SIZEOF(tszNewName), _T("%s%s-%s%s"), tszNewPath, tszName, tszTimestamp, tszExt);
+ mir_sntprintf(tszNewName, _countof(tszNewName), _T("%s%s-%s%s"), tszNewPath, tszName, tszTimestamp, tszExt);
fclose(hFile);
hFile = 0;
if (!PathFileExists(tszNewName))
@@ -742,7 +742,7 @@ TCHAR* GetChatLogsFilename(SESSION_INFO *si, time_t tTime)
TCHAR tszTemp[MAX_PATH], *ptszVarPath;
if (g_Settings->pszLogDir[mir_tstrlen(g_Settings->pszLogDir) - 1] == '\\') {
- mir_sntprintf(tszTemp, SIZEOF(tszTemp), _T("%s%s"), g_Settings->pszLogDir, _T("%userid%.log"));
+ mir_sntprintf(tszTemp, _countof(tszTemp), _T("%s%s"), g_Settings->pszLogDir, _T("%userid%.log"));
ptszVarPath = tszTemp;
}
else ptszVarPath = g_Settings->pszLogDir;
@@ -758,7 +758,7 @@ TCHAR* GetChatLogsFilename(SESSION_INFO *si, time_t tTime)
PathToAbsoluteT(tszParsedName, si->pszLogFileName);
mir_free(tszParsedName);
- for (int i = 0; i < SIZEOF(rva); i++)
+ for (int i = 0; i < _countof(rva); i++)
mir_free(rva[i].lptzValue);
for (TCHAR *p = si->pszLogFileName + 2; *p; ++p)
diff --git a/src/mir_app/src/clc.cpp b/src/mir_app/src/clc.cpp
index 75e0496fce..517aaceac5 100644
--- a/src/mir_app/src/clc.cpp
+++ b/src/mir_app/src/clc.cpp
@@ -421,7 +421,7 @@ LRESULT CALLBACK fnContactListControlWndProc(HWND hwnd, UINT msg, WPARAM wParam,
}
group = group->parent;
size_t nameLen = mir_tstrlen(group->cl.items[i]->szText);
- if (mir_tstrlen(szFullName) + 1 + nameLen > SIZEOF(szFullName)) {
+ if (mir_tstrlen(szFullName) + 1 + nameLen > _countof(szFullName)) {
szFullName[0] = '\0';
break;
}
@@ -581,7 +581,7 @@ LRESULT CALLBACK fnContactListControlWndProc(HWND hwnd, UINT msg, WPARAM wParam,
if (!cli.pfnFindItem(hwnd, dat, wParam, &contact, NULL, NULL))
break;
- mir_tstrncpy(contact->szText, cli.pfnGetContactDisplayName(wParam, 0), SIZEOF(contact->szText));
+ mir_tstrncpy(contact->szText, cli.pfnGetContactDisplayName(wParam, 0), _countof(contact->szText));
dat->needsResort = 1;
SortClcByTimer(hwnd);
break;
@@ -592,7 +592,7 @@ LRESULT CALLBACK fnContactListControlWndProc(HWND hwnd, UINT msg, WPARAM wParam,
contact->proto = GetContactProto(wParam);
cli.pfnInvalidateDisplayNameCacheEntry(wParam);
- mir_tstrncpy(contact->szText, cli.pfnGetContactDisplayName(wParam, 0), SIZEOF(contact->szText));
+ mir_tstrncpy(contact->szText, cli.pfnGetContactDisplayName(wParam, 0), _countof(contact->szText));
SortClcByTimer(hwnd);
break;
@@ -828,7 +828,7 @@ LRESULT CALLBACK fnContactListControlWndProc(HWND hwnd, UINT msg, WPARAM wParam,
TCHAR szNew[2];
szNew[0] = (TCHAR) wParam;
szNew[1] = '\0';
- if (mir_tstrlen(dat->szQuickSearch) >= SIZEOF(dat->szQuickSearch) - 1) {
+ if (mir_tstrlen(dat->szQuickSearch) >= _countof(dat->szQuickSearch) - 1) {
MessageBeep(MB_OK);
break;
}
@@ -1150,7 +1150,7 @@ LRESULT CALLBACK fnContactListControlWndProc(HWND hwnd, UINT msg, WPARAM wParam,
CallService(MS_CLIST_CONTACTCHANGEGROUP, (WPARAM)contacto->hContact, contactn->groupId);
else if (contacto->type == CLCIT_GROUP) { //dropee is a group
TCHAR szNewName[120];
- mir_sntprintf(szNewName, SIZEOF(szNewName), _T("%s\\%s"), cli.pfnGetGroupName(contactn->groupId, NULL), contacto->szText);
+ mir_sntprintf(szNewName, _countof(szNewName), _T("%s\\%s"), cli.pfnGetGroupName(contactn->groupId, NULL), contacto->szText);
cli.pfnRenameGroup(contacto->groupId, szNewName);
}
}
@@ -1189,7 +1189,7 @@ LRESULT CALLBACK fnContactListControlWndProc(HWND hwnd, UINT msg, WPARAM wParam,
break;
if (contact->type == CLCIT_GROUP) { //dropee is a group
TCHAR szNewName[120];
- mir_tstrncpy(szNewName, contact->szText, SIZEOF(szNewName));
+ mir_tstrncpy(szNewName, contact->szText, _countof(szNewName));
cli.pfnRenameGroup(contact->groupId, szNewName);
}
else if (contact->type == CLCIT_CONTACT) //dropee is a contact
diff --git a/src/mir_app/src/clcfiledrop.cpp b/src/mir_app/src/clcfiledrop.cpp
index da3ab82e47..a7aca08f78 100644
--- a/src/mir_app/src/clcfiledrop.cpp
+++ b/src/mir_app/src/clcfiledrop.cpp
@@ -147,7 +147,7 @@ HRESULT CDropTarget::DragEnter(IDataObject *pDataObj, DWORD grfKeyState, POINTL
shortPt.x = pt.x;
shortPt.y = pt.y;
hwnd = WindowFromPoint(shortPt);
- GetClassName(hwnd, szWindowClass, SIZEOF(szWindowClass));
+ GetClassName(hwnd, szWindowClass, _countof(szWindowClass));
if (!mir_tstrcmp(szWindowClass, _T(CLISTCONTROL_CLASS))) {
struct ClcData *dat;
hwndCurrentDrag = hwnd;
@@ -229,7 +229,7 @@ HRESULT CDropTarget::Drop(IDataObject * pDataObj, DWORD /*fKeyState*/, POINTL pt
fileCount = DragQueryFile(hDrop, -1, NULL, 0);
ppFiles = NULL;
for (i=0; i < fileCount; i++) {
- DragQueryFile(hDrop, i, szFilename, SIZEOF(szFilename));
+ DragQueryFile(hDrop, i, szFilename, _countof(szFilename));
AddToFileList(&ppFiles, &totalCount, szFilename);
}
diff --git a/src/mir_app/src/clcitems.cpp b/src/mir_app/src/clcitems.cpp
index 533c45aa8b..bff9d4dc67 100644
--- a/src/mir_app/src/clcitems.cpp
+++ b/src/mir_app/src/clcitems.cpp
@@ -41,7 +41,7 @@ int fnAddItemToGroup(ClcGroup *group, int iAboveItem)
ClcGroup* fnAddGroup(HWND hwnd, struct ClcData *dat, const TCHAR *szName, DWORD flags, int groupId, int calcTotalMembers)
{
- TCHAR *pBackslash, *pNextField, szThisField[ SIZEOF(dat->list.cl.items[0]->szText) ];
+ TCHAR *pBackslash, *pNextField, szThisField[ _countof(dat->list.cl.items[0]->szText) ];
ClcGroup *group = &dat->list;
int i, compareResult;
@@ -53,11 +53,11 @@ ClcGroup* fnAddGroup(HWND hwnd, struct ClcData *dat, const TCHAR *szName, DWORD
do {
pBackslash = _tcschr(pNextField, '\\');
if (pBackslash == NULL) {
- mir_tstrncpy(szThisField, pNextField, SIZEOF(szThisField));
+ mir_tstrncpy(szThisField, pNextField, _countof(szThisField));
pNextField = NULL;
}
else {
- mir_tstrncpy(szThisField, pNextField, min(SIZEOF(szThisField), pBackslash - pNextField + 1));
+ mir_tstrncpy(szThisField, pNextField, min(_countof(szThisField), pBackslash - pNextField + 1));
pNextField = pBackslash + 1;
}
compareResult = 1;
@@ -89,7 +89,7 @@ ClcGroup* fnAddGroup(HWND hwnd, struct ClcData *dat, const TCHAR *szName, DWORD
return NULL;
i = cli.pfnAddItemToGroup(group, i);
group->cl.items[i]->type = CLCIT_GROUP;
- mir_tstrncpy(group->cl.items[i]->szText, szThisField, SIZEOF(group->cl.items[i]->szText));
+ mir_tstrncpy(group->cl.items[i]->szText, szThisField, _countof(group->cl.items[i]->szText));
group->cl.items[i]->groupId = (WORD) (pNextField ? 0 : groupId);
group->cl.items[i]->group = (ClcGroup *) mir_alloc(sizeof(ClcGroup));
group->cl.items[i]->group->parent = group;
@@ -167,7 +167,7 @@ int fnAddInfoItemToGroup(ClcGroup *group, int flags, const TCHAR *pszText)
group->cl.items[i]->type = CLCIT_INFO;
group->cl.items[i]->flags = (BYTE) flags;
group->cl.items[i]->hContact = (MCONTACT)++iInfoItemUniqueHandle;
- mir_tstrncpy(group->cl.items[i]->szText, pszText, SIZEOF(group->cl.items[i]->szText));
+ mir_tstrncpy(group->cl.items[i]->szText, pszText, _countof(group->cl.items[i]->szText));
return i;
}
@@ -205,7 +205,7 @@ int fnAddContactToGroup(struct ClcData *dat, ClcGroup *group, MCONTACT hContact)
DWORD idleMode = szProto != NULL ? db_get_dw(hContact, szProto, "IdleTS", 0) : 0;
if (idleMode)
group->cl.items[i]->flags |= CONTACTF_IDLE;
- mir_tstrncpy(group->cl.items[i]->szText, cli.pfnGetContactDisplayName(hContact, 0), SIZEOF(group->cl.items[i]->szText));
+ mir_tstrncpy(group->cl.items[i]->szText, cli.pfnGetContactDisplayName(hContact, 0), _countof(group->cl.items[i]->szText));
ClcCacheEntry *p = cli.pfnGetCacheEntry(hContact);
if (p != NULL)
diff --git a/src/mir_app/src/clcmsgs.cpp b/src/mir_app/src/clcmsgs.cpp
index 822644b6f6..785877cb73 100644
--- a/src/mir_app/src/clcmsgs.cpp
+++ b/src/mir_app/src/clcmsgs.cpp
@@ -399,7 +399,7 @@ LRESULT fnProcessExternalMessages(HWND hwnd, struct ClcData *dat, UINT msg, WPAR
case CLM_SETITEMTEXT:
if (!cli.pfnFindItem(hwnd, dat, wParam, &contact, NULL, NULL))
break;
- mir_tstrncpy(contact->szText, (TCHAR*)lParam, SIZEOF(contact->szText));
+ mir_tstrncpy(contact->szText, (TCHAR*)lParam, _countof(contact->szText));
cli.pfnSortCLC(hwnd, dat, 1);
cli.pfnInvalidateRect(hwnd, NULL, FALSE);
break;
diff --git a/src/mir_app/src/clcutils.cpp b/src/mir_app/src/clcutils.cpp
index fa0c1ad919..378fd7f809 100644
--- a/src/mir_app/src/clcutils.cpp
+++ b/src/mir_app/src/clcutils.cpp
@@ -403,7 +403,7 @@ void fnEndRename(HWND, struct ClcData *dat, int save)
dat->hwndRenameEdit = NULL;
if (save) {
TCHAR text[120]; text[0] = 0;
- GetWindowText(hwndEdit, text, SIZEOF(text));
+ GetWindowText(hwndEdit, text, _countof(text));
ClcContact *contact;
if (cli.pfnGetRowByIndex(dat, dat->selection, &contact, NULL) != -1) {
@@ -411,7 +411,7 @@ void fnEndRename(HWND, struct ClcData *dat, int save)
if (contact->type == CLCIT_GROUP) {
if (contact->group->parent && contact->group->parent->parent) {
TCHAR szFullName[256];
- mir_sntprintf(szFullName, SIZEOF(szFullName), _T("%s\\%s"),
+ mir_sntprintf(szFullName, _countof(szFullName), _T("%s\\%s"),
cli.pfnGetGroupName(contact->group->parent->groupId, NULL), text);
cli.pfnRenameGroup(contact->groupId, szFullName);
}
diff --git a/src/mir_app/src/clistmenus.cpp b/src/mir_app/src/clistmenus.cpp
index a69c594fdf..4cf60f4414 100644
--- a/src/mir_app/src/clistmenus.cpp
+++ b/src/mir_app/src/clistmenus.cpp
@@ -450,7 +450,7 @@ INT_PTR StatusMenuCheckService(WPARAM wParam, LPARAM)
if (FindMenuHandleByGlobalID(hStatusMenu, timiParent, &it)) {
MENUITEMINFO mi = { 0 };
TCHAR d[100];
- GetMenuString(it.OwnerMenu, it.position, d, SIZEOF(d), MF_BYPOSITION);
+ GetMenuString(it.OwnerMenu, it.position, d, _countof(d), MF_BYPOSITION);
mi.cbSize = sizeof(mi);
mi.fMask = MIIM_STRING | MIIM_STATE;
@@ -544,7 +544,7 @@ INT_PTR StatusMenuExecService(WPARAM wParam, LPARAM)
bool bIsLocked = !Proto_IsAccountLocked(acc);
db_set_b(NULL, prot, "LockMainStatus", bIsLocked);
- CallProtoServiceInt(NULL, smep->proto, PS_GETNAME, (WPARAM)SIZEOF(szHumanName), (LPARAM)szHumanName);
+ CallProtoServiceInt(NULL, smep->proto, PS_GETNAME, (WPARAM)_countof(szHumanName), (LPARAM)szHumanName);
PMO_IntMenuItem pimi = MO_GetIntMenuItem((HGENMENU)smep->protoindex);
if (pimi == NULL)
@@ -827,8 +827,8 @@ void RebuildMenuOrder(void)
hStatusMenuObject = MO_CreateMenuObject("StatusMenu", LPGEN("Status menu"), "StatusMenuCheckService", "StatusMenuExecService");
MO_SetOptionsMenuObject(hStatusMenuObject, OPT_MENUOBJECT_SET_FREE_SERVICE, (INT_PTR)"CLISTMENUS/FreeOwnerDataStatusMenu");
- hStatusMainMenuHandles = (PMO_IntMenuItem*)mir_calloc(SIZEOF(statusModeList) * sizeof(PMO_IntMenuItem));
- hStatusMainMenuHandlesCnt = SIZEOF(statusModeList);
+ hStatusMainMenuHandles = (PMO_IntMenuItem*)mir_calloc(_countof(statusModeList) * sizeof(PMO_IntMenuItem));
+ hStatusMainMenuHandlesCnt = _countof(statusModeList);
hStatusMenuHandles = (tStatusMenuHandles*)mir_calloc(sizeof(tStatusMenuHandles)*accounts.getCount());
hStatusMenuHandlesCnt = accounts.getCount();
@@ -857,7 +857,7 @@ void RebuildMenuOrder(void)
tmi.hIcon = ic = (HICON)CallProtoServiceInt(NULL, pa->szModuleName, PS_LOADICON, PLI_PROTOCOL | PLIF_SMALL, 0);
if (Proto_IsAccountLocked(pa) && cli.bDisplayLocked) {
- mir_sntprintf(tbuf, SIZEOF(tbuf), TranslateT("%s (locked)"), pa->tszAccountName);
+ mir_sntprintf(tbuf, _countof(tbuf), TranslateT("%s (locked)"), pa->tszAccountName);
tmi.ptszName = tbuf;
}
else tmi.ptszName = pa->tszAccountName;
@@ -885,7 +885,7 @@ void RebuildMenuOrder(void)
tmi.flags |= CMIF_CHECKED;
if ((tmi.flags & CMIF_CHECKED) && cli.bDisplayLocked) {
- mir_sntprintf(tbuf, SIZEOF(tbuf), TranslateT("%s (locked)"), pa->tszAccountName);
+ mir_sntprintf(tbuf, _countof(tbuf), TranslateT("%s (locked)"), pa->tszAccountName);
tmi.ptszName = tbuf;
}
else tmi.ptszName = pa->tszAccountName;
@@ -908,7 +908,7 @@ void RebuildMenuOrder(void)
DestroyIcon(ic);
pos += 500000;
- for (int j = 0; j < SIZEOF(statusModeList); j++) {
+ for (int j = 0; j < _countof(statusModeList); j++) {
if (!(flags & statusModePf2List[j]))
continue;
@@ -947,7 +947,7 @@ void RebuildMenuOrder(void)
int pos = 200000;
// add to root menu
- for (int j = 0; j < SIZEOF(statusModeList); j++) {
+ for (int j = 0; j < _countof(statusModeList); j++) {
for (int i = 0; i < accounts.getCount(); i++) {
PROTOACCOUNT *pa = accounts[i];
if (!bHideStatusMenu && !cli.pfnGetProtocolVisibility(pa->szModuleName))
@@ -973,7 +973,7 @@ void RebuildMenuOrder(void)
{
TCHAR buf[256], hotkeyName[100];
WORD hotKey = GetHotkeyValue(statusHotkeys[j]);
- HotkeyToName(hotkeyName, SIZEOF(hotkeyName), HIBYTE(hotKey), LOBYTE(hotKey));
+ HotkeyToName(hotkeyName, _countof(hotkeyName), HIBYTE(hotKey), LOBYTE(hotKey));
mir_sntprintf(buf, _T("%s\t%s"),
cli.pfnGetStatusModeDescription(statusModeList[j], 0), hotkeyName);
tmi.ptszName = buf;
@@ -1000,10 +1000,10 @@ static int sttRebuildHotkeys(WPARAM, LPARAM)
TMO_MenuItem tmi = { sizeof(tmi) };
tmi.flags = CMIM_HOTKEY | CMIM_NAME | CMIF_TCHAR;
- for (int j = 0; j < SIZEOF(statusModeList); j++) {
+ for (int j = 0; j < _countof(statusModeList); j++) {
TCHAR buf[256], hotkeyName[100];
WORD hotKey = GetHotkeyValue(statusHotkeys[j]);
- HotkeyToName(hotkeyName, SIZEOF(hotkeyName), HIBYTE(hotKey), LOBYTE(hotKey));
+ HotkeyToName(hotkeyName, _countof(hotkeyName), HIBYTE(hotKey), LOBYTE(hotKey));
mir_sntprintf(buf, _T("%s\t%s"), cli.pfnGetStatusModeDescription(statusModeList[j], 0), hotkeyName);
tmi.ptszName = buf;
tmi.hotKey = MAKELONG(HIBYTE(hotKey), LOBYTE(hotKey));
@@ -1017,7 +1017,7 @@ static int sttRebuildHotkeys(WPARAM, LPARAM)
int statustopos(int status)
{
- for (int j = 0; j < SIZEOF(statusModeList); j++)
+ for (int j = 0; j < _countof(statusModeList); j++)
if (status == statusModeList[j])
return j;
@@ -1070,19 +1070,19 @@ static int MenuProtoAck(WPARAM, LPARAM lParam)
for (int i = 0; i < accounts.getCount(); i++) {
if (!mir_strcmp(accounts[i]->szModuleName, ack->szModule)) {
- if (((int)ack->hProcess >= ID_STATUS_OFFLINE || (int)ack->hProcess == 0) && (int)ack->hProcess < ID_STATUS_OFFLINE + SIZEOF(statusModeList)) {
+ if (((int)ack->hProcess >= ID_STATUS_OFFLINE || (int)ack->hProcess == 0) && (int)ack->hProcess < ID_STATUS_OFFLINE + _countof(statusModeList)) {
int pos = statustopos((int)ack->hProcess);
if (pos == -1)
pos = 0;
- for (pos = 0; pos < SIZEOF(statusModeList); pos++) {
+ for (pos = 0; pos < _countof(statusModeList); pos++) {
tmi.flags = CMIM_FLAGS | CMIF_ROOTHANDLE;
MO_ModifyMenuItem(hStatusMenuHandles[i].menuhandle[pos], &tmi);
}
}
- if (ack->lParam >= ID_STATUS_OFFLINE && ack->lParam < ID_STATUS_OFFLINE + SIZEOF(statusModeList)) {
+ if (ack->lParam >= ID_STATUS_OFFLINE && ack->lParam < ID_STATUS_OFFLINE + _countof(statusModeList)) {
int pos = statustopos((int)ack->lParam);
- if (pos >= 0 && pos < SIZEOF(statusModeList)) {
+ if (pos >= 0 && pos < _countof(statusModeList)) {
tmi.flags = CMIM_FLAGS | CMIF_ROOTHANDLE | CMIF_CHECKED;
MO_ModifyMenuItem(hStatusMenuHandles[i].menuhandle[pos], &tmi);
}
@@ -1304,9 +1304,9 @@ void InitCustomMenus(void)
HOTKEYDESC hkd = { sizeof(hkd) };
hkd.ptszSection = _T("Status");
hkd.dwFlags = HKD_TCHAR;
- for (int i = 0; i < SIZEOF(statusHotkeys); i++) {
+ for (int i = 0; i < _countof(statusHotkeys); i++) {
char szName[30];
- mir_snprintf(szName, SIZEOF(szName), "StatusHotKey_%d", i);
+ mir_snprintf(szName, _countof(szName), "StatusHotKey_%d", i);
hkd.pszName = szName;
hkd.lParam = statusModeList[i];
hkd.ptszDescription = fnGetStatusModeDescription(hkd.lParam, 0);
diff --git a/src/mir_app/src/clistmod.cpp b/src/mir_app/src/clistmod.cpp
index 1b11108836..e1b20354f8 100644
--- a/src/mir_app/src/clistmod.cpp
+++ b/src/mir_app/src/clistmod.cpp
@@ -100,7 +100,7 @@ TCHAR* fnGetStatusModeDescription(int mode, int flags)
default:
if (IsStatusConnecting(mode)) {
const TCHAR* connFmt = LPGENT("Connecting (attempt %d)");
- mir_sntprintf(szMode, SIZEOF(szMode), (flags & GSMDF_UNTRANSLATED) ? connFmt : TranslateTS(connFmt), mode - ID_STATUS_CONNECTING + 1);
+ mir_sntprintf(szMode, _countof(szMode), (flags & GSMDF_UNTRANSLATED) ? connFmt : TranslateTS(connFmt), mode - ID_STATUS_CONNECTING + 1);
return szMode;
}
return NULL;
@@ -157,11 +157,11 @@ int fnIconFromStatusMode(const char *szProto, int status, MCONTACT)
{
int index, i;
- for (index = 0; index < SIZEOF(statusModeList); index++)
+ for (index = 0; index < _countof(statusModeList); index++)
if (status == statusModeList[index])
break;
- if (index == SIZEOF(statusModeList))
+ if (index == _countof(statusModeList))
index = 0;
if (szProto == NULL)
return index + 1;
@@ -188,7 +188,7 @@ static void AddProtoIconIndex(PROTOACCOUNT *pa)
{
ProtoIconIndex *pii = new ProtoIconIndex;
pii->szProto = pa->szModuleName;
- for (int i=0; i < SIZEOF(statusModeList); i++) {
+ for (int i=0; i < _countof(statusModeList); i++) {
int iImg = ImageList_AddIcon_ProtoIconLibLoaded(hCListImages, pa->szModuleName, statusModeList[i]);
if (i == 0)
pii->iIconBase = iImg;
@@ -268,12 +268,12 @@ static int CListIconsChanged(WPARAM, LPARAM)
{
int i, j;
- for (i=0; i < SIZEOF(statusModeList); i++)
+ for (i=0; i < _countof(statusModeList); i++)
ImageList_ReplaceIcon_IconLibLoaded(hCListImages, i + 1, Skin_LoadIcon(skinIconStatusList[i]));
ImageList_ReplaceIcon_IconLibLoaded(hCListImages, IMAGE_GROUPOPEN, Skin_LoadIcon(SKINICON_OTHER_GROUPOPEN));
ImageList_ReplaceIcon_IconLibLoaded(hCListImages, IMAGE_GROUPSHUT, Skin_LoadIcon(SKINICON_OTHER_GROUPSHUT));
for (i=0; i < protoIconIndex.getCount(); i++)
- for (j = 0; j < SIZEOF(statusModeList); j++)
+ for (j = 0; j < _countof(statusModeList); j++)
ImageList_ReplaceIcon_IconLibLoaded(hCListImages, protoIconIndex[i].iIconBase + j, Skin_LoadProtoIcon(protoIconIndex[i].szProto, statusModeList[j]));
cli.pfnTrayIconIconsChanged();
cli.pfnInvalidateRect(cli.hwndContactList, NULL, TRUE);
@@ -460,7 +460,7 @@ static INT_PTR CompareContacts(WPARAM wParam, LPARAM lParam)
nameb = cli.pfnGetContactDisplayName(a, 0);
_tcsncpy_s(namea, nameb, _TRUNCATE);
- namea[ SIZEOF(namea)-1 ] = 0;
+ namea[ _countof(namea)-1 ] = 0;
nameb = cli.pfnGetContactDisplayName(b, 0);
//otherwise just compare names
@@ -513,7 +513,7 @@ int LoadContactListModule2(void)
ImageList_AddIcon_NotShared(hCListImages, MAKEINTRESOURCE(IDI_BLANK));
//now all core skin icons are loaded via icon lib. so lets release them
- for (int i=0; i < SIZEOF(statusModeList); i++)
+ for (int i=0; i < _countof(statusModeList); i++)
ImageList_AddIcon_IconLibLoaded(hCListImages, skinIconStatusList[i]);
//see IMAGE_GROUP... in clist.h if you add more images above here
diff --git a/src/mir_app/src/clisttray.cpp b/src/mir_app/src/clisttray.cpp
index 93bde38516..556b4dc30d 100644
--- a/src/mir_app/src/clisttray.cpp
+++ b/src/mir_app/src/clisttray.cpp
@@ -186,7 +186,7 @@ int fnTrayIconAdd(HWND hwnd, const char *szProto, const char *szIconProto, int s
cli.pfnTrayIconMakeTooltip(NULL, p.szProto);
if (!hasTips())
- mir_tstrncpy(nid.szTip, cli.szTip, SIZEOF(nid.szTip));
+ mir_tstrncpy(nid.szTip, cli.szTip, _countof(nid.szTip));
replaceStrT(p.ptszToolTip, cli.szTip);
Shell_NotifyIcon(NIM_ADD, &nid);
@@ -343,7 +343,7 @@ int fnTrayIconUpdate(HICON hNewIcon, const TCHAR *szNewTip, const char *szPrefer
mir_free(cli.trayIcon[i].ptszToolTip);
cli.trayIcon[i].ptszToolTip = mir_tstrdup(cli.szTip);
if (!hasTips())
- mir_tstrncpy(nid.szTip, cli.szTip, SIZEOF(nid.szTip));
+ mir_tstrncpy(nid.szTip, cli.szTip, _countof(nid.szTip));
Shell_NotifyIcon(NIM_MODIFY, &nid);
if (cli.trayIconCount == 1)
@@ -365,7 +365,7 @@ int fnTrayIconUpdate(HICON hNewIcon, const TCHAR *szNewTip, const char *szPrefer
mir_free(cli.trayIcon[i].ptszToolTip);
cli.trayIcon[i].ptszToolTip = mir_tstrdup(cli.szTip);
if (!hasTips())
- mir_tstrncpy(nid.szTip, cli.szTip, SIZEOF(nid.szTip));
+ mir_tstrncpy(nid.szTip, cli.szTip, _countof(nid.szTip));
Shell_NotifyIcon(NIM_MODIFY, &nid);
if (cli.trayIconCount == 1)
@@ -819,10 +819,10 @@ int fnCListTrayNotify(MIRANDASYSTRAYNOTIFY* msn)
nid.hWnd = cli.hwndContactList;
nid.uID = iconId;
nid.uFlags = NIF_INFO;
- mir_wstrncpy(nid.szInfo, msn->tszInfo, SIZEOF(nid.szInfo));
- mir_wstrncpy(nid.szInfoTitle, msn->tszInfoTitle, SIZEOF(nid.szInfoTitle));
- nid.szInfo[SIZEOF(nid.szInfo) - 1] = 0;
- nid.szInfoTitle[SIZEOF(nid.szInfoTitle) - 1] = 0;
+ mir_wstrncpy(nid.szInfo, msn->tszInfo, _countof(nid.szInfo));
+ mir_wstrncpy(nid.szInfoTitle, msn->tszInfoTitle, _countof(nid.szInfoTitle));
+ nid.szInfo[_countof(nid.szInfo) - 1] = 0;
+ nid.szInfoTitle[_countof(nid.szInfoTitle) - 1] = 0;
nid.uTimeout = msn->uTimeout;
nid.dwInfoFlags = (msn->dwInfoFlags & ~NIIF_INTERN_UNICODE);
return Shell_NotifyIconW(NIM_MODIFY, &nid) == 0;
diff --git a/src/mir_app/src/clui.cpp b/src/mir_app/src/clui.cpp
index 773e68fb5b..fc8381b0e0 100644
--- a/src/mir_app/src/clui.cpp
+++ b/src/mir_app/src/clui.cpp
@@ -89,7 +89,7 @@ static int MenuItem_PreBuild(WPARAM, LPARAM)
{
TCHAR cls[128];
HWND hwndClist = GetFocus();
- GetClassName(hwndClist, cls, SIZEOF(cls));
+ GetClassName(hwndClist, cls, _countof(cls));
hwndClist = (!mir_tstrcmp( _T(CLISTCONTROL_CLASS), cls)) ? hwndClist : cli.hwndContactList;
HANDLE hItem = (HANDLE)SendMessage(hwndClist, CLM_GETSELECTION, 0, 0);
Menu_ShowItem(hRenameMenuItem, hItem != 0);
@@ -100,7 +100,7 @@ static INT_PTR MenuItem_RenameContact(WPARAM, LPARAM)
{
TCHAR cls[128];
HWND hwndClist = GetFocus();
- GetClassName(hwndClist, cls, SIZEOF(cls));
+ GetClassName(hwndClist, cls, _countof(cls));
// worst case scenario, the rename is sent to the main contact list
hwndClist = (!mir_tstrcmp( _T(CLISTCONTROL_CLASS), cls)) ? hwndClist : cli.hwndContactList;
HANDLE hItem = (HANDLE)SendMessage(hwndClist, CLM_GETSELECTION, 0, 0);
@@ -124,8 +124,8 @@ static INT_PTR CALLBACK AskForConfirmationDlgProc(HWND hWnd, UINT msg, WPARAM wP
SendDlgItemMessage(hWnd, IDC_TOPLINE, WM_SETFONT, (WPARAM) CreateFontIndirect(&lf), 0);
TCHAR szFormat[256], szFinal[256];
- GetDlgItemText(hWnd, IDC_TOPLINE, szFormat, SIZEOF(szFormat));
- mir_sntprintf(szFinal, SIZEOF(szFinal), szFormat, cli.pfnGetContactDisplayName(lParam, 0));
+ GetDlgItemText(hWnd, IDC_TOPLINE, szFormat, _countof(szFormat));
+ mir_sntprintf(szFinal, _countof(szFinal), szFormat, cli.pfnGetContactDisplayName(lParam, 0));
SetDlgItemText(hWnd, IDC_TOPLINE, szFinal);
}
SetFocus( GetDlgItem(hWnd, IDNO));
@@ -279,9 +279,9 @@ int LoadCLUIModule(void)
RegisterClassEx(&wndclass);
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);
}
@@ -412,7 +412,7 @@ LRESULT CALLBACK fnContactListWndProc(HWND hwnd, UINT msg, WPARAM wParam, LPARAM
TCHAR profile[MAX_PATH];
int rc;
// wParam = (ATOM)hProfileAtom, lParam = 0
- if (GlobalGetAtomName((ATOM) wParam, profile, SIZEOF(profile))) {
+ if (GlobalGetAtomName((ATOM) wParam, profile, _countof(profile))) {
rc = mir_tstrcmpi(profile, VARST(_T("%miranda_userdata%\\%miranda_profilename%.dat"))) == 0;
ReplyMessage(rc);
if (rc) {
@@ -1003,7 +1003,7 @@ LRESULT CALLBACK fnContactListWndProc(HWND hwnd, UINT msg, WPARAM wParam, LPARAM
PROTOACCOUNT *pa;
TCHAR tszName[64];
if ((pa = Proto_GetAccount(szProto)) != NULL)
- mir_sntprintf(tszName, SIZEOF(tszName), _T("%s "), pa->tszAccountName);
+ mir_sntprintf(tszName, _countof(tszName), _T("%s "), pa->tszAccountName);
else
tszName[0] = 0;
diff --git a/src/mir_app/src/cluiservices.cpp b/src/mir_app/src/cluiservices.cpp
index e5f08af088..cdb2577093 100644
--- a/src/mir_app/src/cluiservices.cpp
+++ b/src/mir_app/src/cluiservices.cpp
@@ -43,7 +43,7 @@ static INT_PTR GroupAdded(WPARAM wParam, LPARAM lParam)
TCHAR szFocusClass[64];
HWND hwndFocus = GetFocus();
- GetClassName(hwndFocus, szFocusClass, SIZEOF(szFocusClass));
+ GetClassName(hwndFocus, szFocusClass, _countof(szFocusClass));
if (!mir_tstrcmp(szFocusClass, _T(CLISTCONTROL_CLASS))) {
hItem = (HANDLE) SendMessage(hwndFocus, CLM_FINDGROUP, wParam, 0);
if (hItem)
@@ -179,11 +179,11 @@ void fnCluiProtocolStatusChanged(int, const char*)
TCHAR tszName[64];
PROTOACCOUNT *pa = Proto_GetAccount(cli.menuProtos[i].szProto);
if (pa)
- mir_sntprintf(tszName, SIZEOF(tszName), _T("%s "), pa->tszAccountName);
+ mir_sntprintf(tszName, _countof(tszName), _T("%s "), pa->tszAccountName);
else
tszName[0] = 0;
- if (showOpts & 4 && mir_tstrlen(tszName) < SIZEOF(tszName)-1)
+ if (showOpts & 4 && mir_tstrlen(tszName) < _countof(tszName)-1)
mir_tstrcat(tszName, _T(" "));
GetTextExtentPoint32(hdc, tszName, (int)mir_tstrlen(tszName), &textSize);
x += textSize.cx;
diff --git a/src/mir_app/src/contact.cpp b/src/mir_app/src/contact.cpp
index f4f9296c63..560eb60d5a 100644
--- a/src/mir_app/src/contact.cpp
+++ b/src/mir_app/src/contact.cpp
@@ -62,7 +62,7 @@ void fnChangeContactIcon(MCONTACT hContact, int iIcon, int add)
int GetStatusModeOrdering(int statusMode)
{
int i;
- for (i=0; i < SIZEOF(statusModeOrder); i++)
+ for (i=0; i < _countof(statusModeOrder); i++)
if (statusModeOrder[i].status == statusMode)
return statusModeOrder[i].order;
return 1000;
@@ -126,7 +126,7 @@ int fnCompareContacts(const ClcContact* c1, const ClcContact* c2)
nameb = cli.pfnGetContactDisplayName(a, 0);
_tcsncpy_s(namea, nameb, _TRUNCATE);
- namea[ SIZEOF(namea)-1 ] = 0;
+ namea[ _countof(namea)-1 ] = 0;
nameb = cli.pfnGetContactDisplayName(b, 0);
//otherwise just compare names
diff --git a/src/mir_app/src/contacts.cpp b/src/mir_app/src/contacts.cpp
index b20b201228..170ffdf9e4 100644
--- a/src/mir_app/src/contacts.cpp
+++ b/src/mir_app/src/contacts.cpp
@@ -393,7 +393,7 @@ public:
tvis.hParent = NULL;
tvis.hInsertAfter = TVI_LAST;
tvis.item.mask = TVIF_TEXT | TVIF_PARAM;
- for (int i = 0; i < SIZEOF(nameOrderDescr); i++) {
+ for (int i = 0; i < _countof(nameOrderDescr); i++) {
tvis.item.lParam = nameOrder[i];
tvis.item.pszText = TranslateTS(nameOrderDescr[nameOrder[i]]);
m_nameOrder.InsertItem(&tvis);
@@ -411,14 +411,14 @@ public:
nameOrder[i++] = (BYTE)tvi.lParam;
tvi.hItem = m_nameOrder.GetNextSibling(tvi.hItem);
}
- db_set_blob(NULL, "Contact", "NameOrder", nameOrder, SIZEOF(nameOrderDescr));
+ db_set_blob(NULL, "Contact", "NameOrder", nameOrder, _countof(nameOrderDescr));
CallService(MS_CLIST_INVALIDATEDISPLAYNAME, (WPARAM)INVALID_HANDLE_VALUE, 0);
}
void OnBeginDrag(CCtrlTreeView::TEventInfo *evt)
{
LPNMTREEVIEW pNotify = evt->nmtv;
- if (pNotify->itemNew.lParam == 0 || pNotify->itemNew.lParam == SIZEOF(nameOrderDescr) - 1)
+ if (pNotify->itemNew.lParam == 0 || pNotify->itemNew.lParam == _countof(nameOrderDescr) - 1)
pNotify->hdr.code = 0; // deny dragging
}
};
diff --git a/src/mir_app/src/database.cpp b/src/mir_app/src/database.cpp
index 802840cb5e..286a8f4793 100644
--- a/src/mir_app/src/database.cpp
+++ b/src/mir_app/src/database.cpp
@@ -73,7 +73,7 @@ bool IsInsideRootDir(TCHAR* profiledir, bool exact)
int getProfilePath(TCHAR *buf, size_t)
{
TCHAR profiledir[MAX_PATH];
- GetPrivateProfileString(_T("Database"), _T("ProfileDir"), _T(""), profiledir, SIZEOF(profiledir), mirandabootini);
+ GetPrivateProfileString(_T("Database"), _T("ProfileDir"), _T(""), profiledir, _countof(profiledir), mirandabootini);
if (profiledir[0] == 0)
mir_tstrcpy(profiledir, _T("%miranda_path%\\Profiles"));
@@ -102,7 +102,7 @@ static bool showProfileManager(void)
return 1;
// wanna show it?
- GetPrivateProfileString(_T("Database"), _T("ShowProfileMgr"), _T("never"), Mgr, SIZEOF(Mgr), mirandabootini);
+ GetPrivateProfileString(_T("Database"), _T("ShowProfileMgr"), _T("never"), Mgr, _countof(Mgr), mirandabootini);
return (mir_tstrcmpi(Mgr, _T("yes")) == 0);
}
@@ -112,14 +112,14 @@ bool shouldAutoCreate(TCHAR *szProfile)
return false;
TCHAR ac[32];
- GetPrivateProfileString(_T("Database"), _T("AutoCreate"), _T(""), ac, SIZEOF(ac), mirandabootini);
+ GetPrivateProfileString(_T("Database"), _T("AutoCreate"), _T(""), ac, _countof(ac), mirandabootini);
return mir_tstrcmpi(ac, _T("yes")) == 0;
}
static void getDefaultProfile(TCHAR *szProfile, size_t cch)
{
TCHAR defaultProfile[MAX_PATH];
- GetPrivateProfileString(_T("Database"), _T("DefaultProfile"), _T(""), defaultProfile, SIZEOF(defaultProfile), mirandabootini);
+ GetPrivateProfileString(_T("Database"), _T("DefaultProfile"), _T(""), defaultProfile, _countof(defaultProfile), mirandabootini);
if (defaultProfile[0] == 0)
return;
@@ -186,7 +186,7 @@ static void moveProfileDirProfiles(TCHAR *profiledir, BOOL isRootDir = TRUE)
if (isRootDir)
_tcsncpy_s(pfd, VARST(_T("%miranda_path%\\*.dat")), _TRUNCATE);
else
- mir_sntprintf(pfd, SIZEOF(pfd), _T("%s\\*.dat"), profiledir);
+ mir_sntprintf(pfd, _countof(pfd), _T("%s\\*.dat"), profiledir);
WIN32_FIND_DATA ffd;
HANDLE hFind = FindFirstFile(pfd, &ffd);
@@ -196,10 +196,10 @@ static void moveProfileDirProfiles(TCHAR *profiledir, BOOL isRootDir = TRUE)
TCHAR path[MAX_PATH], path2[MAX_PATH];
TCHAR* profile = mir_tstrdup(ffd.cFileName);
TCHAR *c = _tcsrchr(profile, '.'); if (c) *c = 0;
- mir_sntprintf(path, SIZEOF(path), _T("%s\\%s"), pfd, ffd.cFileName);
- mir_sntprintf(path2, SIZEOF(path2), _T("%s\\%s"), profiledir, profile);
+ mir_sntprintf(path, _countof(path), _T("%s\\%s"), pfd, ffd.cFileName);
+ mir_sntprintf(path2, _countof(path2), _T("%s\\%s"), profiledir, profile);
CreateDirectoryTreeT(path2);
- mir_sntprintf(path2, SIZEOF(path2), _T("%s\\%s\\%s"), profiledir, profile, ffd.cFileName);
+ mir_sntprintf(path2, _countof(path2), _T("%s\\%s\\%s"), profiledir, profile, ffd.cFileName);
if (_taccess(path2, 0) == 0) {
TCHAR buf[512];
mir_sntprintf(buf,
@@ -241,7 +241,7 @@ static int getProfile1(TCHAR *szProfile, size_t cch, TCHAR *profiledir, BOOL * n
if (bShowProfileManager || !reqfd) {
TCHAR searchspec[MAX_PATH];
- mir_sntprintf(searchspec, SIZEOF(searchspec), _T("%s\\*.*"), profiledir);
+ mir_sntprintf(searchspec, _countof(searchspec), _T("%s\\*.*"), profiledir);
WIN32_FIND_DATA ffd;
HANDLE hFind = FindFirstFile(searchspec, &ffd);
@@ -252,7 +252,7 @@ static int getProfile1(TCHAR *szProfile, size_t cch, TCHAR *profiledir, BOOL * n
continue;
TCHAR newProfile[MAX_PATH];
- mir_sntprintf(newProfile, SIZEOF(newProfile), _T("%s\\%s\\%s.dat"), profiledir, ffd.cFileName, ffd.cFileName);
+ mir_sntprintf(newProfile, _countof(newProfile), _T("%s\\%s\\%s.dat"), profiledir, ffd.cFileName, ffd.cFileName);
if (_taccess(newProfile, 0) != 0)
continue;
@@ -287,7 +287,7 @@ static int getProfileAutoRun(TCHAR *szProfile)
return false;
TCHAR Mgr[32];
- GetPrivateProfileString(_T("Database"), _T("ShowProfileMgr"), _T(""), Mgr, SIZEOF(Mgr), mirandabootini);
+ GetPrivateProfileString(_T("Database"), _T("ShowProfileMgr"), _T(""), Mgr, _countof(Mgr), mirandabootini);
if (mir_tstrcmpi(Mgr, _T("never")))
return 0;
@@ -297,10 +297,10 @@ static int getProfileAutoRun(TCHAR *szProfile)
// returns 1 if a profile was selected
static int getProfile(TCHAR *szProfile, size_t cch)
{
- getProfilePath(g_profileDir, SIZEOF(g_profileDir));
+ getProfilePath(g_profileDir, _countof(g_profileDir));
if (IsInsideRootDir(g_profileDir, true))
if (WritePrivateProfileString(_T("Database"), _T("ProfileDir"), _T(""), mirandabootini))
- getProfilePath(g_profileDir, SIZEOF(g_profileDir));
+ getProfilePath(g_profileDir, _countof(g_profileDir));
getDefaultProfile(szProfile, cch);
getProfileCmdLine(szProfile, cch);
@@ -458,7 +458,7 @@ static BOOL CALLBACK EnumMirandaWindows(HWND hwnd, LPARAM lParam)
TCHAR classname[256];
ENUMMIRANDAWINDOW *x = (ENUMMIRANDAWINDOW *)lParam;
DWORD_PTR res = 0;
- if (GetClassName(hwnd, classname, SIZEOF(classname)) && mir_tstrcmp(_T("Miranda"), classname) == 0) {
+ if (GetClassName(hwnd, classname, _countof(classname)) && mir_tstrcmp(_T("Miranda"), classname) == 0) {
if (SendMessageTimeout(hwnd, x->msg, (WPARAM)x->aPath, 0, SMTO_ABORTIFHUNG, 100, &res) && res) {
x->found++;
return FALSE;
@@ -488,7 +488,7 @@ int LoadDatabaseModule(void)
LoadDatabaseServices();
// find out which profile to load
- if (!getProfile(szProfile, SIZEOF(szProfile)))
+ if (!getProfile(szProfile, _countof(szProfile)))
return 1;
if (arDbPlugins.getCount() == 0) {
diff --git a/src/mir_app/src/dbini.cpp b/src/mir_app/src/dbini.cpp
index 50f10dfee6..b876f89c16 100644
--- a/src/mir_app/src/dbini.cpp
+++ b/src/mir_app/src/dbini.cpp
@@ -38,7 +38,7 @@ static INT_PTR CALLBACK InstallIniDlgProc(HWND hwndDlg, UINT message, WPARAM wPa
TCHAR szSecurity[11];
const TCHAR *pszSecurityInfo;
- GetPrivateProfileString(_T("AutoExec"), _T("Warn"), _T("notsafe"), szSecurity, SIZEOF(szSecurity), mirandabootini);
+ GetPrivateProfileString(_T("AutoExec"), _T("Warn"), _T("notsafe"), szSecurity, _countof(szSecurity), mirandabootini);
if (!mir_tstrcmpi(szSecurity, _T("all")))
pszSecurityInfo = LPGENT("Security systems to prevent malicious changes are in place and you will be warned before every change that is made.");
else if (!mir_tstrcmpi(szSecurity, _T("onlyunsafe")))
@@ -55,7 +55,7 @@ static INT_PTR CALLBACK InstallIniDlgProc(HWND hwndDlg, UINT message, WPARAM wPa
case IDC_VIEWINI:
{
TCHAR szPath[MAX_PATH];
- GetDlgItemText(hwndDlg, IDC_ININAME, szPath, SIZEOF(szPath));
+ GetDlgItemText(hwndDlg, IDC_ININAME, szPath, _countof(szPath));
ShellExecute(hwndDlg, _T("open"), szPath, NULL, NULL, SW_SHOW);
}
break;
@@ -154,7 +154,7 @@ static INT_PTR CALLBACK IniImportDoneDlgProc(HWND hwndDlg, UINT message, WPARAM
return TRUE;
case WM_COMMAND:
- GetDlgItemText(hwndDlg, IDC_ININAME, szIniPath, SIZEOF(szIniPath));
+ GetDlgItemText(hwndDlg, IDC_ININAME, szIniPath, _countof(szIniPath));
switch (LOWORD(wParam)) {
case IDC_DELETE:
DeleteFile(szIniPath);
@@ -174,7 +174,7 @@ static INT_PTR CALLBACK IniImportDoneDlgProc(HWND hwndDlg, UINT message, WPARAM
break;
case IDC_MOVE:
TCHAR szNewPath[MAX_PATH];
- GetDlgItemText(hwndDlg, IDC_NEWNAME, szNewPath, SIZEOF(szNewPath));
+ GetDlgItemText(hwndDlg, IDC_NEWNAME, szNewPath, _countof(szNewPath));
MoveFile(szIniPath, szNewPath);
EndDialog(hwndDlg, LOWORD(wParam));
break;
@@ -409,22 +409,22 @@ static void DoAutoExec(void)
TCHAR szUse[7], szIniPath[MAX_PATH], szFindPath[MAX_PATH];
TCHAR buf[2048], szSecurity[11], szOverrideSecurityFilename[MAX_PATH], szOnCreateFilename[MAX_PATH];
- GetPrivateProfileString(_T("AutoExec"), _T("Use"), _T("prompt"), szUse, SIZEOF(szUse), mirandabootini);
+ GetPrivateProfileString(_T("AutoExec"), _T("Use"), _T("prompt"), szUse, _countof(szUse), mirandabootini);
if (!mir_tstrcmpi(szUse, _T("no"))) return;
- GetPrivateProfileString(_T("AutoExec"), _T("Safe"), _T("CLC Icons CLUI CList SkinSounds"), buf, SIZEOF(buf), mirandabootini);
+ GetPrivateProfileString(_T("AutoExec"), _T("Safe"), _T("CLC Icons CLUI CList SkinSounds"), buf, _countof(buf), mirandabootini);
ptrA szSafeSections(mir_t2a(buf));
- GetPrivateProfileString(_T("AutoExec"), _T("Unsafe"), _T("AIM Facebook GG ICQ IRC JABBER MRA MSN SKYPE Tlen TWITTER VKontakte XFire"), buf, SIZEOF(buf), mirandabootini);
+ GetPrivateProfileString(_T("AutoExec"), _T("Unsafe"), _T("AIM Facebook GG ICQ IRC JABBER MRA MSN SKYPE Tlen TWITTER VKontakte XFire"), buf, _countof(buf), mirandabootini);
ptrA szUnsafeSections(mir_t2a(buf));
- GetPrivateProfileString(_T("AutoExec"), _T("Warn"), _T("notsafe"), szSecurity, SIZEOF(szSecurity), mirandabootini);
+ GetPrivateProfileString(_T("AutoExec"), _T("Warn"), _T("notsafe"), szSecurity, _countof(szSecurity), mirandabootini);
int secur = 0;
if (!mir_tstrcmpi(szSecurity, _T("none"))) secur = 0;
else if (!mir_tstrcmpi(szSecurity, _T("notsafe"))) secur = 1;
else if (!mir_tstrcmpi(szSecurity, _T("onlyunsafe"))) secur = 2;
- GetPrivateProfileString(_T("AutoExec"), _T("OverrideSecurityFilename"), _T(""), szOverrideSecurityFilename, SIZEOF(szOverrideSecurityFilename), mirandabootini);
- GetPrivateProfileString(_T("AutoExec"), _T("OnCreateFilename"), _T(""), szOnCreateFilename, SIZEOF(szOnCreateFilename), mirandabootini);
- GetPrivateProfileString(_T("AutoExec"), _T("Glob"), _T("autoexec_*.ini"), szFindPath, SIZEOF(szFindPath), mirandabootini);
+ GetPrivateProfileString(_T("AutoExec"), _T("OverrideSecurityFilename"), _T(""), szOverrideSecurityFilename, _countof(szOverrideSecurityFilename), mirandabootini);
+ GetPrivateProfileString(_T("AutoExec"), _T("OnCreateFilename"), _T(""), szOnCreateFilename, _countof(szOnCreateFilename), mirandabootini);
+ GetPrivateProfileString(_T("AutoExec"), _T("Glob"), _T("autoexec_*.ini"), szFindPath, _countof(szFindPath), mirandabootini);
if (g_bDbCreated && szOnCreateFilename[0]) {
PathToAbsoluteT(VARST(szOnCreateFilename), szIniPath);
@@ -447,7 +447,7 @@ static void DoAutoExec(void)
do {
bool secFN = mir_tstrcmpi(fd.cFileName, szOverrideSecurityFilename) == 0;
- mir_sntprintf(szIniPath, SIZEOF(szIniPath), _T("%s%s"), szFindPath, fd.cFileName);
+ mir_sntprintf(szIniPath, _countof(szIniPath), _T("%s%s"), szFindPath, fd.cFileName);
if (!mir_tstrcmpi(szUse, _T("prompt")) && !secFN) {
int result = DialogBoxParam(g_hInst, MAKEINTRESOURCE(IDD_INSTALLINI), NULL, InstallIniDlgProc, (LPARAM)szIniPath);
if (result == IDC_NOTOALL) break;
@@ -460,7 +460,7 @@ static void DoAutoExec(void)
DeleteFile(szIniPath);
else {
TCHAR szOnCompletion[8];
- GetPrivateProfileString(_T("AutoExec"), _T("OnCompletion"), _T("recycle"), szOnCompletion, SIZEOF(szOnCompletion), mirandabootini);
+ GetPrivateProfileString(_T("AutoExec"), _T("OnCompletion"), _T("recycle"), szOnCompletion, _countof(szOnCompletion), mirandabootini);
if (!mir_tstrcmpi(szOnCompletion, _T("delete")))
DeleteFile(szIniPath);
else if (!mir_tstrcmpi(szOnCompletion, _T("recycle"))) {
@@ -473,7 +473,7 @@ static void DoAutoExec(void)
}
else if (!mir_tstrcmpi(szOnCompletion, _T("rename"))) {
TCHAR szRenamePrefix[MAX_PATH], szNewPath[MAX_PATH];
- GetPrivateProfileString(_T("AutoExec"), _T("RenamePrefix"), _T("done_"), szRenamePrefix, SIZEOF(szRenamePrefix), mirandabootini);
+ GetPrivateProfileString(_T("AutoExec"), _T("RenamePrefix"), _T("done_"), szRenamePrefix, _countof(szRenamePrefix), mirandabootini);
mir_tstrcpy(szNewPath, szFindPath);
mir_tstrcat(szNewPath, szRenamePrefix);
mir_tstrcat(szNewPath, fd.cFileName);
diff --git a/src/mir_app/src/dbutils.cpp b/src/mir_app/src/dbutils.cpp
index 18e6bac54f..c8a9e9dbea 100644
--- a/src/mir_app/src/dbutils.cpp
+++ b/src/mir_app/src/dbutils.cpp
@@ -61,12 +61,12 @@ static INT_PTR DbEventTypeRegister(WPARAM, LPARAM lParam)
if (!p->textService) {
char szServiceName[100];
- mir_snprintf(szServiceName, SIZEOF(szServiceName), "%s/GetEventText%d", p->module, p->eventType);
+ mir_snprintf(szServiceName, _countof(szServiceName), "%s/GetEventText%d", p->module, p->eventType);
p->textService = mir_strdup(szServiceName);
}
if (!p->iconService) {
char szServiceName[100];
- mir_snprintf(szServiceName, SIZEOF(szServiceName), "%s/GetEventIcon%d", p->module, p->eventType);
+ mir_snprintf(szServiceName, _countof(szServiceName), "%s/GetEventIcon%d", p->module, p->eventType);
p->iconService = mir_strdup(szServiceName);
}
eventTypes.insert(p);
@@ -216,7 +216,7 @@ static INT_PTR DbEventGetIcon(WPARAM wParam, LPARAM lParam)
icon = IcoLib_GetIconByHandle(et->eventIcon);
if (!icon) {
char szName[100];
- mir_snprintf(szName, SIZEOF(szName), "eventicon_%s%d", dbei->szModule, dbei->eventType);
+ mir_snprintf(szName, _countof(szName), "eventicon_%s%d", dbei->szModule, dbei->eventType);
icon = IcoLib_GetIcon(szName);
}
diff --git a/src/mir_app/src/extraicons.cpp b/src/mir_app/src/extraicons.cpp
index 820ee03900..ff11fbfed4 100644
--- a/src/mir_app/src/extraicons.cpp
+++ b/src/mir_app/src/extraicons.cpp
@@ -520,7 +520,7 @@ void LoadExtraIconsModule()
hEventExtraImageListRebuilding = CreateHookableEvent(ME_CLIST_EXTRA_LIST_REBUILD);
// Icons
- Icon_Register(g_hInst, LPGEN("Contact list"), iconList, SIZEOF(iconList));
+ Icon_Register(g_hInst, LPGEN("Contact list"), iconList, _countof(iconList));
// Hooks
HookEvent(ME_SYSTEM_MODULESLOADED, ModulesLoaded);
diff --git a/src/mir_app/src/filter.cpp b/src/mir_app/src/filter.cpp
index 83f91c407c..9a99e7eac7 100644
--- a/src/mir_app/src/filter.cpp
+++ b/src/mir_app/src/filter.cpp
@@ -59,7 +59,7 @@ void AddTreeViewNodes(HWND hWndDlg, PageHash key, HTREEITEM root)
item.mask = TVIF_TEXT;
item.hItem = root;
item.pszText = title;
- item.cchTextMax = SIZEOF(title);
+ item.cchTextMax = _countof(title);
if (TreeView_GetItem(hWndDlg, &item))
if (mir_tstrlen(title) > 0)
@@ -78,12 +78,12 @@ void AddTreeViewNodes(HWND hWndDlg, PageHash key, HTREEITEM root)
void AddDialogString(HWND hWndDlg, const PageHash key)
{
TCHAR title[2048];
- GetWindowText(hWndDlg, title, SIZEOF(title));
+ GetWindowText(hWndDlg, title, _countof(title));
if (mir_tstrlen(title) > 0)
AddFilterString(key, title);
TCHAR szClass[64];
- GetClassName(hWndDlg, szClass, SIZEOF(szClass));
+ GetClassName(hWndDlg, szClass, _countof(szClass));
if (mir_tstrcmpi(szClass, _T("SysTreeView32")) == 0) {
HTREEITEM hItem = TreeView_GetRoot(hWndDlg);
@@ -98,7 +98,7 @@ void AddDialogString(HWND hWndDlg, const PageHash key)
title[0] = 0; //safety
int res = ListBox_GetText(hWndDlg, i, title);
if (res != LB_ERR) {
- title[SIZEOF(title) - 1] = 0;
+ title[_countof(title) - 1] = 0;
if (mir_tstrlen(title) > 0)
AddFilterString(key, title);
}
@@ -111,7 +111,7 @@ void AddDialogString(HWND hWndDlg, const PageHash key)
int count = ListView_GetItemCount(hWndDlg);
for (int i=0; i < count; i++) {
title[0] = 0; //safety
- ListView_GetItemText(hWndDlg, i, 0, title, SIZEOF(title));
+ ListView_GetItemText(hWndDlg, i, 0, title, _countof(title));
if (mir_tstrlen(title) > 0)
AddFilterString(key, title);
@@ -126,7 +126,7 @@ void AddDialogString(HWND hWndDlg, const PageHash key)
title[0] = 0; //safety
int res = ComboBox_GetLBText(hWndDlg, i, title);
if (res != CB_ERR) {
- title[SIZEOF(title) - 1] = 0;
+ title[_countof(title) - 1] = 0;
if (mir_tstrlen(title) > 0)
AddFilterString(key, title);
diff --git a/src/mir_app/src/findadd.cpp b/src/mir_app/src/findadd.cpp
index b1d470eacd..db81e02da2 100644
--- a/src/mir_app/src/findadd.cpp
+++ b/src/mir_app/src/findadd.cpp
@@ -284,7 +284,7 @@ static const int controls[] = { IDC_BYPROTOID, IDC_BYEMAIL, IDC_BYNAME, IDC_BYAD
static void CheckSearchTypeRadioButton(HWND hwndDlg, int idControl)
{
- for (int i = 0; i < SIZEOF(controls); i++)
+ for (int i = 0; i < _countof(controls); i++)
CheckDlgButton(hwndDlg, controls[i], idControl == controls[i] ? BST_CHECKED : BST_UNCHECKED);
}
@@ -359,7 +359,7 @@ static INT_PTR CALLBACK DlgProcFindAdd(HWND hwndDlg, UINT msg, WPARAM wParam, LP
ReleaseDC(GetDlgItem(hwndDlg, IDC_STATUSBAR), hdc);
partWidth[1] = partWidth[0] + 150;
partWidth[2] = -1;
- 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);
SetStatusBarSearchInfo(GetDlgItem(hwndDlg, IDC_STATUSBAR), dat);
@@ -703,7 +703,7 @@ static INT_PTR CALLBACK DlgProcFindAdd(HWND hwndDlg, UINT msg, WPARAM wParam, LP
BeginSearch(hwndDlg, dat, szProto, PS_SEARCHBYADVANCED, PF1_EXTSEARCHUI, dat->hwndTinySearch);
else if (IsDlgButtonChecked(hwndDlg, IDC_BYPROTOID)) {
TCHAR str[256];
- GetDlgItemText(hwndDlg, IDC_PROTOID, str, SIZEOF(str));
+ GetDlgItemText(hwndDlg, IDC_PROTOID, str, _countof(str));
rtrimt(str);
if (str[0] == 0)
MessageBox(hwndDlg, sttErrMsg, sttErrTitle, MB_ICONERROR | MB_OK);
@@ -712,7 +712,7 @@ static INT_PTR CALLBACK DlgProcFindAdd(HWND hwndDlg, UINT msg, WPARAM wParam, LP
}
else if (IsDlgButtonChecked(hwndDlg, IDC_BYEMAIL)) {
TCHAR str[256];
- GetDlgItemText(hwndDlg, IDC_EMAIL, str, SIZEOF(str));
+ GetDlgItemText(hwndDlg, IDC_EMAIL, str, _countof(str));
rtrimt(str);
if (str[0] == 0)
MessageBox(hwndDlg, sttErrMsg, sttErrTitle, MB_ICONERROR | MB_OK);
@@ -722,9 +722,9 @@ static INT_PTR CALLBACK DlgProcFindAdd(HWND hwndDlg, UINT msg, WPARAM wParam, LP
else if (IsDlgButtonChecked(hwndDlg, IDC_BYNAME)) {
TCHAR nick[256], first[256], last[256];
PROTOSEARCHBYNAME psbn;
- GetDlgItemText(hwndDlg, IDC_NAMENICK, nick, SIZEOF(nick));
- GetDlgItemText(hwndDlg, IDC_NAMEFIRST, first, SIZEOF(first));
- GetDlgItemText(hwndDlg, IDC_NAMELAST, last, SIZEOF(last));
+ GetDlgItemText(hwndDlg, IDC_NAMENICK, nick, _countof(nick));
+ GetDlgItemText(hwndDlg, IDC_NAMEFIRST, first, _countof(first));
+ GetDlgItemText(hwndDlg, IDC_NAMELAST, last, _countof(last));
psbn.pszFirstName = first;
psbn.pszLastName = last;
psbn.pszNick = nick;
@@ -774,7 +774,7 @@ static INT_PTR CALLBACK DlgProcFindAdd(HWND hwndDlg, UINT msg, WPARAM wParam, LP
}
else {
TCHAR str[256];
- GetDlgItemText(hwndDlg, IDC_PROTOID, str, SIZEOF(str));
+ GetDlgItemText(hwndDlg, IDC_PROTOID, str, _countof(str));
if (*rtrimt(str) == 0)
break;
diff --git a/src/mir_app/src/genmenu.cpp b/src/mir_app/src/genmenu.cpp
index 3246544f40..6e87b6f397 100644
--- a/src/mir_app/src/genmenu.cpp
+++ b/src/mir_app/src/genmenu.cpp
@@ -917,13 +917,13 @@ HMENU BuildRecursiveMenu(HMENU hMenu, PMO_IntMenuItem pRootMenu, ListParam *para
DBVARIANT dbv = { 0 };
int pos;
char MenuNameItems[256];
- mir_snprintf(MenuNameItems, SIZEOF(MenuNameItems), "%s_Items", pmo->pszName);
+ mir_snprintf(MenuNameItems, _countof(MenuNameItems), "%s_Items", pmo->pszName);
char menuItemName[256];
GetMenuItemName(pmi, menuItemName, sizeof(menuItemName));
// check if it visible
- mir_snprintf(DBString, SIZEOF(DBString), "%s_visible", menuItemName);
+ mir_snprintf(DBString, _countof(DBString), "%s_visible", menuItemName);
if (db_get_b(NULL, MenuNameItems, DBString, -1) == -1)
db_set_b(NULL, MenuNameItems, DBString, 1);
@@ -934,14 +934,14 @@ HMENU BuildRecursiveMenu(HMENU hMenu, PMO_IntMenuItem pRootMenu, ListParam *para
}
// mi.pszName
- mir_snprintf(DBString, SIZEOF(DBString), "%s_name", menuItemName);
+ mir_snprintf(DBString, _countof(DBString), "%s_name", menuItemName);
if (!db_get_ts(NULL, MenuNameItems, DBString, &dbv)) {
if (mir_tstrlen(dbv.ptszVal) > 0)
replaceStrT(pmi->CustomName, dbv.ptszVal);
db_free(&dbv);
}
- mir_snprintf(DBString, SIZEOF(DBString), "%s_pos", menuItemName);
+ mir_snprintf(DBString, _countof(DBString), "%s_pos", menuItemName);
if ((pos = db_get_dw(NULL, MenuNameItems, DBString, -1)) == -1) {
db_set_dw(NULL, MenuNameItems, DBString, mi->position);
if (pmi->submenu.first)
@@ -986,7 +986,7 @@ HMENU BuildRecursiveMenu(HMENU hMenu, PMO_IntMenuItem pRootMenu, ListParam *para
#ifdef PUTPOSITIONSONMENU
if (GetKeyState(VK_CONTROL) & 0x8000) {
TCHAR str[256];
- mir_sntprintf(str, SIZEOF(str), _T("%s (%d, id %x)"), mi->pszName, mi->position, mii.dwItemData);
+ mir_sntprintf(str, _countof(str), _T("%s (%d, id %x)"), mi->pszName, mi->position, mii.dwItemData);
mii.dwTypeData = str;
}
#endif
@@ -1001,7 +1001,7 @@ HMENU BuildRecursiveMenu(HMENU hMenu, PMO_IntMenuItem pRootMenu, ListParam *para
#ifdef PUTPOSITIONSONMENU
if (GetKeyState(VK_CONTROL) & 0x8000) {
TCHAR str[256];
- mir_sntprintf(str, SIZEOF(str), _T("%s (%d, id %x)"), mi->pszName, mi->position, mii.dwItemData);
+ mir_sntprintf(str, _countof(str), _T("%s (%d, id %x)"), mi->pszName, mi->position, mii.dwItemData);
mii.dwTypeData = str;
}
#endif
@@ -1060,10 +1060,10 @@ static int MO_RegisterIcon(PMO_IntMenuItem pmi, void*)
HICON hIcon = ImageList_GetIcon(pmi->parent->m_hMenuIcons, pmi->iconId, 0);
TCHAR sectionName[256];
- mir_sntprintf(sectionName, SIZEOF(sectionName), LPGENT("Menu icons") _T("/%s"), TranslateTS(pmi->parent->ptszDisplayName));
+ mir_sntprintf(sectionName, _countof(sectionName), LPGENT("Menu icons") _T("/%s"), TranslateTS(pmi->parent->ptszDisplayName));
char iconame[256];
- mir_snprintf(iconame, SIZEOF(iconame), "genmenu_%s_%s", pmi->parent->pszName, uname && *uname ? uname : descr);
+ mir_snprintf(iconame, _countof(iconame), "genmenu_%s_%s", pmi->parent->pszName, uname && *uname ? uname : descr);
// remove '&'
if (descr) {
diff --git a/src/mir_app/src/genmenuopt.cpp b/src/mir_app/src/genmenuopt.cpp
index 424488d4ea..db302e59da 100644
--- a/src/mir_app/src/genmenuopt.cpp
+++ b/src/mir_app/src/genmenuopt.cpp
@@ -73,7 +73,7 @@ class CGenMenuOptionsPage : public CDlgBase
TVITEMEX tvi;
tvi.hItem = m_menuItems.GetRoot();
- tvi.cchTextMax = SIZEOF(idstr);
+ tvi.cchTextMax = _countof(idstr);
tvi.mask = TVIF_TEXT | TVIF_PARAM | TVIF_HANDLE | TVIF_IMAGE;
tvi.pszText = idstr;
@@ -85,7 +85,7 @@ class CGenMenuOptionsPage : public CDlgBase
TIntMenuObject *pimo = g_menus[menupos];
char MenuNameItems[256];
- mir_snprintf(MenuNameItems, SIZEOF(MenuNameItems), "%s_Items", pimo->pszName);
+ mir_snprintf(MenuNameItems, _countof(MenuNameItems), "%s_Items", pimo->pszName);
int runtimepos = 100;
while (tvi.hItem != NULL) {
@@ -95,13 +95,13 @@ class CGenMenuOptionsPage : public CDlgBase
char menuItemName[256], DBString[300];
GetMenuItemName(iod->pimi, menuItemName, sizeof(menuItemName));
- mir_snprintf(DBString, SIZEOF(DBString), "%s_visible", menuItemName);
+ mir_snprintf(DBString, _countof(DBString), "%s_visible", menuItemName);
db_set_b(NULL, MenuNameItems, DBString, tvi.iImage != 0);
- mir_snprintf(DBString, SIZEOF(DBString), "%s_pos", menuItemName);
+ mir_snprintf(DBString, _countof(DBString), "%s_pos", menuItemName);
db_set_dw(NULL, MenuNameItems, DBString, runtimepos);
- mir_snprintf(DBString, SIZEOF(DBString), "%s_name", menuItemName);
+ mir_snprintf(DBString, _countof(DBString), "%s_name", menuItemName);
if (iod->name != NULL && iod->defname != NULL &&
mir_tstrcmp(iod->name, iod->defname) != 0)
db_set_ts(NULL, MenuNameItems, DBString, iod->name);
@@ -156,7 +156,7 @@ class CGenMenuOptionsPage : public CDlgBase
return false;
char menuItemName[256], MenuNameItems[256];
- mir_snprintf(MenuNameItems, SIZEOF(MenuNameItems), "%s_Items", pimo->pszName);
+ mir_snprintf(MenuNameItems, _countof(MenuNameItems), "%s_Items", pimo->pszName);
LIST<MenuItemOptData> arItems(10, SortMenuItems);
diff --git a/src/mir_app/src/groups.cpp b/src/mir_app/src/groups.cpp
index 8ad218df03..9775eb39ba 100644
--- a/src/mir_app/src/groups.cpp
+++ b/src/mir_app/src/groups.cpp
@@ -81,13 +81,13 @@ static INT_PTR CreateGroupInternal(INT_PTR iParent, const TCHAR *ptszName)
if (db_get_ts(NULL, "CListGroups", str, &dbv))
return 0;
- mir_sntprintf(newBaseName, SIZEOF(newBaseName), _T("%s\\%s"), dbv.ptszVal + 1, grpName);
+ mir_sntprintf(newBaseName, _countof(newBaseName), _T("%s\\%s"), dbv.ptszVal + 1, grpName);
mir_free(dbv.pszVal);
}
- else mir_tstrncpy(newBaseName, grpName, SIZEOF(newBaseName));
+ else mir_tstrncpy(newBaseName, grpName, _countof(newBaseName));
_itoa(newId, str, 10);
- mir_tstrncpy(newName + 1, newBaseName, SIZEOF(newName) - 1);
+ mir_tstrncpy(newName + 1, newBaseName, _countof(newName) - 1);
if (ptszName) {
i = GroupNameExists(newBaseName, -1);
if (i) newId = i - 1;
@@ -96,7 +96,7 @@ static INT_PTR CreateGroupInternal(INT_PTR iParent, const TCHAR *ptszName)
else {
i = 1;
while (GroupNameExists(newName + 1, -1))
- mir_sntprintf(newName + 1, SIZEOF(newName) - 1, _T("%s (%d)"), newBaseName, i++);
+ mir_sntprintf(newName + 1, _countof(newName) - 1, _T("%s (%d)"), newBaseName, i++);
}
if (i) {
const CLISTGROUPCHANGE grpChg = { sizeof(CLISTGROUPCHANGE), NULL, newName };
@@ -140,7 +140,7 @@ static INT_PTR GetGroupName2(WPARAM wParam, LPARAM lParam)
_itoa(wParam - 1, idstr, 10);
if (db_get_s(NULL, "CListGroups", idstr, &dbv))
return (INT_PTR) (char *) NULL;
- mir_strncpy(name, dbv.pszVal + 1, SIZEOF(name));
+ mir_strncpy(name, dbv.pszVal + 1, _countof(name));
if ((DWORD *) lParam != NULL)
*(DWORD *) lParam = dbv.pszVal[0];
db_free(&dbv);
@@ -157,7 +157,7 @@ TCHAR* fnGetGroupName(int idx, DWORD* pdwFlags)
if (db_get_ts(NULL, "CListGroups", idstr, &dbv))
return NULL;
- mir_tstrncpy(name, dbv.ptszVal + 1, SIZEOF(name));
+ mir_tstrncpy(name, dbv.ptszVal + 1, _countof(name));
if (pdwFlags != NULL)
*pdwFlags = dbv.ptszVal[0];
db_free(&dbv);
@@ -185,12 +185,12 @@ static INT_PTR DeleteGroup(WPARAM wParam, LPARAM)
_itoa(wParam - 1, str, 10);
if (db_get_ts(NULL, "CListGroups", str, &dbv))
return 1;
- mir_tstrncpy(name, dbv.ptszVal + 1, SIZEOF(name));
+ mir_tstrncpy(name, dbv.ptszVal + 1, _countof(name));
db_free(&dbv);
if (db_get_b(NULL, "CList", "ConfirmDelete", SETTING_CONFIRMDELETE_DEFAULT))
{
TCHAR szQuestion[256+100];
- mir_sntprintf(szQuestion, SIZEOF(szQuestion), TranslateT("Are you sure you want to delete group '%s'? This operation cannot be undone."), name);
+ mir_sntprintf(szQuestion, _countof(szQuestion), TranslateT("Are you sure you want to delete group '%s'? This operation cannot be undone."), name);
if (MessageBox(cli.hwndContactList, szQuestion, TranslateT("Delete group"), MB_YESNO|MB_ICONQUESTION) == IDNO)
return 1;
}
@@ -250,9 +250,9 @@ static INT_PTR DeleteGroup(WPARAM wParam, LPARAM)
break;
if (!_tcsncmp(dbv.ptszVal + 1, name, len) && dbv.pszVal[len + 1] == '\\' && _tcschr(dbv.ptszVal + len + 2, '\\') == NULL) {
if (szNewParent[0])
- mir_sntprintf(szNewName, SIZEOF(szNewName), _T("%s\\%s"), szNewParent, dbv.ptszVal + len + 2);
+ mir_sntprintf(szNewName, _countof(szNewName), _T("%s\\%s"), szNewParent, dbv.ptszVal + len + 2);
else
- mir_tstrncpy(szNewName, dbv.ptszVal + len + 2, SIZEOF(szNewName));
+ mir_tstrncpy(szNewName, dbv.ptszVal + len + 2, _countof(szNewName));
cli.pfnRenameGroup(i + 1, szNewName);
}
db_free(&dbv);
@@ -284,9 +284,9 @@ static int RenameGroupWithMove(int groupId, const TCHAR *szName, int move)
if (db_get_ts(NULL, "CListGroups", idstr, &dbv))
return 1;
str[0] = dbv.pszVal[0] & 0x7F;
- mir_tstrncpy(oldName, dbv.ptszVal + 1, SIZEOF(oldName));
+ mir_tstrncpy(oldName, dbv.ptszVal + 1, _countof(oldName));
db_free(&dbv);
- mir_tstrncpy(str + 1, szName, SIZEOF(str) - 1);
+ mir_tstrncpy(str + 1, szName, _countof(str) - 1);
db_set_ts(NULL, "CListGroups", idstr, str);
//must rename setting in all child contacts too
@@ -311,7 +311,7 @@ static int RenameGroupWithMove(int groupId, const TCHAR *szName, int move)
if (db_get_ts(NULL, "CListGroups", idstr, &dbv))
break;
if (!_tcsncmp(dbv.ptszVal + 1, oldName, len) && dbv.ptszVal[len + 1] == '\\' && _tcschr(dbv.ptszVal + len + 2, '\\') == NULL) {
- mir_sntprintf(szNewName, SIZEOF(szNewName), _T("%s\\%s"), szName, dbv.ptszVal + len + 2);
+ mir_sntprintf(szNewName, _countof(szNewName), _T("%s\\%s"), szName, dbv.ptszVal + len + 2);
RenameGroupWithMove(i, szNewName, 0); //luckily, child groups will never need reordering
}
db_free(&dbv);
@@ -323,7 +323,7 @@ static int RenameGroupWithMove(int groupId, const TCHAR *szName, int move)
TCHAR *pszLastBackslash;
int i;
- mir_tstrncpy(str, szName, SIZEOF(str));
+ mir_tstrncpy(str, szName, _countof(str));
pszLastBackslash = _tcsrchr(str, '\\');
if (pszLastBackslash != NULL) {
*pszLastBackslash = '\0';
@@ -484,18 +484,18 @@ static INT_PTR BuildGroupMenu(WPARAM, LPARAM)
do {
pBackslash = _tcschr(pNextField, '\\');
if (pBackslash == NULL) {
- mir_tstrncpy(szThisField, pNextField, SIZEOF(szThisField));
+ mir_tstrncpy(szThisField, pNextField, _countof(szThisField));
pNextField = NULL;
}
else {
- mir_tstrncpy(szThisField, pNextField, min(SIZEOF(szThisField), pBackslash - pNextField + 1));
+ mir_tstrncpy(szThisField, pNextField, min(_countof(szThisField), pBackslash - pNextField + 1));
pNextField = pBackslash + 1;
}
compareResult = 1;
menuItemCount = GetMenuItemCount(hThisMenu);
for (menuId = 0; menuId < menuItemCount; menuId++) {
mii.fMask = MIIM_TYPE | MIIM_SUBMENU | MIIM_DATA;
- mii.cch = SIZEOF(szThisMenuItem);
+ mii.cch = _countof(szThisMenuItem);
mii.dwTypeData = szThisMenuItem;
GetMenuItemInfo(hThisMenu, menuId, TRUE, &mii);
compareResult = mir_tstrcmp(szThisField, szThisMenuItem);
diff --git a/src/mir_app/src/hotkey_opts.cpp b/src/mir_app/src/hotkey_opts.cpp
index cd7d542a7e..015c0830cc 100644
--- a/src/mir_app/src/hotkey_opts.cpp
+++ b/src/mir_app/src/hotkey_opts.cpp
@@ -127,7 +127,7 @@ static LRESULT CALLBACK sttHotkeyEditProc(HWND hwnd, UINT msg, WPARAM wParam, LP
TCHAR buf[256] = { 0 };
data->key = (BYTE)LOWORD(wParam);
data->shift = (BYTE)HIWORD(wParam);
- HotkeyToName(buf, SIZEOF(buf), data->shift, data->key);
+ HotkeyToName(buf, _countof(buf), data->shift, data->key);
SetWindowText(hwnd, buf);
}
return 0;
@@ -169,7 +169,7 @@ static LRESULT CALLBACK sttHotkeyEditProc(HWND hwnd, UINT msg, WPARAM wParam, LP
data->key = key;
}
- HotkeyToName(buf, SIZEOF(buf), data->shift, data->key);
+ HotkeyToName(buf, _countof(buf), data->shift, data->key);
SetWindowText(hwnd, buf);
if (bKeyDown && data->key)
@@ -222,7 +222,7 @@ static void sttOptionsSetupItem(HWND hwndList, int idx, THotkeyItem *item)
lvi.mask = LVIF_TEXT;
lvi.iSubItem = COL_KEY;
- HotkeyToName(buf, SIZEOF(buf), HIBYTE(item->OptHotkey), LOBYTE(item->OptHotkey));
+ HotkeyToName(buf, _countof(buf), HIBYTE(item->OptHotkey), LOBYTE(item->OptHotkey));
lvi.pszText = buf;
ListView_SetItem(hwndList, &lvi);
@@ -269,14 +269,14 @@ static int CALLBACK sttOptionsSortList(LPARAM lParam1, LPARAM lParam2, LPARAM lP
lvi.mask = LVIF_TEXT | LVIF_PARAM;
lvi.iItem = lParam1;
lvi.pszText = title1;
- lvi.cchTextMax = SIZEOF(title1);
+ lvi.cchTextMax = _countof(title1);
if (ListView_GetItem((HWND)lParamSort, &lvi))
item1 = (THotkeyItem *)lvi.lParam;
lvi.mask = LVIF_TEXT | LVIF_PARAM;
lvi.iItem = lParam2;
lvi.pszText = title2;
- lvi.cchTextMax = SIZEOF(title2);
+ lvi.cchTextMax = _countof(title2);
if (ListView_GetItem((HWND)lParamSort, &lvi))
item2 = (THotkeyItem *)lvi.lParam;
@@ -523,7 +523,7 @@ static INT_PTR CALLBACK sttOptionsDlgProc(HWND hwndDlg, UINT msg, WPARAM wParam,
TCHAR buf[128];
LVITEM lvi = { 0 };
lvi.pszText = buf;
- lvi.cchTextMax = SIZEOF(buf);
+ lvi.cchTextMax = _countof(buf);
for (lvi.iItem = 0; lvi.iItem < count; ++lvi.iItem) {
char *szSetting;
@@ -896,7 +896,7 @@ static INT_PTR CALLBACK sttOptionsDlgProc(HWND hwndDlg, UINT msg, WPARAM wParam,
lvi.mask = LVIF_TEXT;
lvi.iItem = param->iItem;
lvi.pszText = buf;
- lvi.cchTextMax = SIZEOF(buf);
+ lvi.cchTextMax = _countof(buf);
ListView_GetItem(lpnmhdr->hwndFrom, &lvi);
if (param->uNewState >> 12 == 1) {
@@ -957,7 +957,7 @@ static INT_PTR CALLBACK sttOptionsDlgProc(HWND hwndDlg, UINT msg, WPARAM wParam,
lvi.mask = LVIF_TEXT | LVIF_PARAM;
lvi.iItem = param->nmcd.dwItemSpec;
lvi.pszText = buf;
- lvi.cchTextMax = SIZEOF(buf);
+ lvi.cchTextMax = _countof(buf);
ListView_GetItem(lpnmhdr->hwndFrom, &lvi);
item = (THotkeyItem *)lvi.lParam;
@@ -1014,7 +1014,7 @@ static INT_PTR CALLBACK sttOptionsDlgProc(HWND hwndDlg, UINT msg, WPARAM wParam,
TCHAR buf[128];
LVITEM lvi = { 0 };
lvi.pszText = buf;
- lvi.cchTextMax = SIZEOF(buf);
+ lvi.cchTextMax = _countof(buf);
for (lvi.iItem = 0; lvi.iItem < count; ++lvi.iItem) {
lvi.mask = LVIF_PARAM;
lvi.iSubItem = 0;
diff --git a/src/mir_app/src/hotkeys.cpp b/src/mir_app/src/hotkeys.cpp
index edc92b10dd..0e91b12775 100644
--- a/src/mir_app/src/hotkeys.cpp
+++ b/src/mir_app/src/hotkeys.cpp
@@ -154,7 +154,7 @@ static INT_PTR svcHotkeyRegister(WPARAM wParam, LPARAM lParam)
if (item->rootHotkey = hotkeys.find(item)) {
if (item->rootHotkey->allowSubHotkeys) {
char nameBuf[MAXMODULELABELLENGTH];
- mir_snprintf(nameBuf, SIZEOF(nameBuf), "%s$%d", item->rootHotkey->pszName, item->rootHotkey->nSubHotkeys);
+ mir_snprintf(nameBuf, _countof(nameBuf), "%s$%d", item->rootHotkey->pszName, item->rootHotkey->nSubHotkeys);
item->pszName = mir_strdup(nameBuf);
item->Enabled = TRUE;
@@ -221,7 +221,7 @@ static INT_PTR svcHotkeyUnregister(WPARAM, LPARAM lParam)
char *pszName = (char *)lParam;
char pszNamePrefix[MAXMODULELABELLENGTH];
size_t cbNamePrefix;
- mir_snprintf(pszNamePrefix, SIZEOF(pszNamePrefix), "%s$", pszName);
+ mir_snprintf(pszNamePrefix, _countof(pszNamePrefix), "%s$", pszName);
cbNamePrefix = mir_strlen(pszNamePrefix);
for (i = 0; i < hotkeys.getCount(); i++) {
@@ -377,7 +377,7 @@ int LoadSkinHotkeys(void)
HookEvent(ME_SYSTEM_MODULESLOADED, sttModulesLoaded);
- for (int i = 0; i < SIZEOF(oldSettings); i++) {
+ for (int i = 0; i < _countof(oldSettings); i++) {
char szSetting[100];
mir_snprintf(szSetting, "HK%s", oldSettings[i]);
diff --git a/src/mir_app/src/hyperlink.cpp b/src/mir_app/src/hyperlink.cpp
index bb62808f44..10121b2ee8 100644
--- a/src/mir_app/src/hyperlink.cpp
+++ b/src/mir_app/src/hyperlink.cpp
@@ -151,7 +151,7 @@ static LRESULT CALLBACK HyperlinkWndProc(HWND hwnd, UINT msg, WPARAM wParam, LPA
case WM_CREATE:
case HLK_MEASURETEXT:
{ TCHAR szText[256];
- if (!GetWindowText(hwnd, szText, SIZEOF(szText))) return 0;
+ if (!GetWindowText(hwnd, szText, _countof(szText))) return 0;
lParam = (LPARAM)szText;
/* fall thru */
case WM_SETTEXT:
@@ -228,7 +228,7 @@ static LRESULT CALLBACK HyperlinkWndProc(HWND hwnd, UINT msg, WPARAM wParam, LPA
hPrevFont = (HFONT)SelectObject(hdc, dat->hDisableFont);
textColor = dat->disableColor;
}
- if (GetClientRect(hwnd, &rc) && GetWindowText(hwnd, szText, SIZEOF(szText))) {
+ if (GetClientRect(hwnd, &rc) && GetWindowText(hwnd, szText, _countof(szText))) {
BOOL fSmoothing;
UINT fSmoothingType;
SystemParametersInfo(SPI_GETFONTSMOOTHING, 0, &fSmoothing, 0);
diff --git a/src/mir_app/src/icolib.cpp b/src/mir_app/src/icolib.cpp
index ad35eb3509..f5db3be974 100644
--- a/src/mir_app/src/icolib.cpp
+++ b/src/mir_app/src/icolib.cpp
@@ -348,7 +348,7 @@ IconSourceItem* GetIconSourceItemFromPath(const TCHAR* path, int cxIcon, int cyI
return NULL;
TCHAR file[MAX_PATH];
- mir_tstrncpy(file, path, SIZEOF(file));
+ mir_tstrncpy(file, path, _countof(file));
TCHAR *comma = _tcsrchr(file, ',');
int n;
@@ -368,7 +368,7 @@ IconSourceItem* CreateStaticIconSourceItem(int cxIcon, int cyIcon)
int i = 0;
do { // find new unique name
- mir_sntprintf(sourceName, SIZEOF(sourceName), _T("*StaticIcon_%d"), i++);
+ mir_sntprintf(sourceName, _countof(sourceName), _T("*StaticIcon_%d"), i++);
} while (iconSourceFileList.getIndex(&key) != -1);
IconSourceItem* newItem = (IconSourceItem*)mir_calloc(sizeof(IconSourceItem));
diff --git a/src/mir_app/src/ignore.cpp b/src/mir_app/src/ignore.cpp
index 5fc8208104..00d0384d74 100644
--- a/src/mir_app/src/ignore.cpp
+++ b/src/mir_app/src/ignore.cpp
@@ -58,7 +58,7 @@ static void SetListGroupIcons(HWND hwndList, HANDLE hFirstItem, HANDLE hParentIt
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);
}
@@ -66,7 +66,7 @@ static void SetListGroupIcons(HWND hwndList, HANDLE hFirstItem, HANDLE hParentIt
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)
@@ -75,7 +75,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];
}
@@ -200,7 +200,7 @@ static INT_PTR CALLBACK DlgProcIgnoreOpts(HWND hwndDlg, UINT msg, WPARAM, LPARAM
ImageList_AddIcon_IconLibLoaded(hIml, SKINICON_OTHER_TYPING);
SendDlgItemMessage(hwndDlg, IDC_LIST, 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);
}
@@ -305,7 +305,7 @@ static INT_PTR CALLBACK DlgProcIgnoreOpts(HWND hwndDlg, UINT msg, WPARAM, LPARAM
break;
case WM_DESTROY:
- for (int i=0; i < SIZEOF(hIcons); i++)
+ for (int i=0; i < _countof(hIcons); i++)
DestroyIcon(hIcons[i]);
HIMAGELIST hIml = (HIMAGELIST)SendDlgItemMessage(hwndDlg, IDC_LIST, CLM_GETEXTRAIMAGELIST, 0, 0);
ImageList_Destroy(hIml);
diff --git a/src/mir_app/src/langpack.cpp b/src/mir_app/src/langpack.cpp
index 692dfa7634..848eb81fee 100644
--- a/src/mir_app/src/langpack.cpp
+++ b/src/mir_app/src/langpack.cpp
@@ -75,7 +75,7 @@ BOOL EnumLangpacks(ENUM_PACKS_CALLBACK callback, WPARAM wParam, LPARAM lParam)
DWORD v = CallService(MS_SYSTEM_GETVERSION, 0, 0);
pack.szLastModifiedUsing.Format("%d.%d.%d", ((v >> 24) & 0xFF), ((v >> 16) & 0xFF), ((v >> 8) & 0xFF));
/* file date */
- if (GetModuleFileName(NULL, pack.tszFullPath, SIZEOF(pack.tszFullPath))) {
+ if (GetModuleFileName(NULL, pack.tszFullPath, _countof(pack.tszFullPath))) {
mir_tstrcpy(pack.tszFileName, _T("default"));
HANDLE hFile = CreateFile(pack.tszFileName, 0, FILE_SHARE_READ, 0, OPEN_EXISTING, 0, 0);
if (hFile != INVALID_HANDLE_VALUE) {
diff --git a/src/mir_app/src/lpopts.cpp b/src/mir_app/src/lpopts.cpp
index a0f8812d41..735d4ab1bf 100644
--- a/src/mir_app/src/lpopts.cpp
+++ b/src/mir_app/src/lpopts.cpp
@@ -36,18 +36,18 @@ static void DisplayPackInfo(HWND hwndDlg, const LANGPACK_INFO *pack)
if (!(pack->flags & LPF_NOLOCALE)) {
TCHAR szLocaleName[256], szLanguageName[128], szContryName[128];
- if (!GetLocaleInfo(pack->Locale, WINVER >= _WIN32_WINNT_WIN7 ? LOCALE_SENGLISHLANGUAGENAME : LOCALE_SENGLANGUAGE, szLanguageName, SIZEOF(szLanguageName)))
+ if (!GetLocaleInfo(pack->Locale, WINVER >= _WIN32_WINNT_WIN7 ? LOCALE_SENGLISHLANGUAGENAME : LOCALE_SENGLANGUAGE, szLanguageName, _countof(szLanguageName)))
szLanguageName[0] = _T('\0');
- if (!GetLocaleInfo(pack->Locale, WINVER >= _WIN32_WINNT_WIN7 ? LOCALE_SENGLISHCOUNTRYNAME : LOCALE_SENGCOUNTRY, szContryName, SIZEOF(szContryName)))
+ if (!GetLocaleInfo(pack->Locale, WINVER >= _WIN32_WINNT_WIN7 ? LOCALE_SENGLISHCOUNTRYNAME : LOCALE_SENGCOUNTRY, szContryName, _countof(szContryName)))
szContryName[0] = _T('\0');
/* add some note if its incompatible */
if (szLanguageName[0] && szContryName[0]) {
- mir_sntprintf(szLocaleName, SIZEOF(szLocaleName), _T("%s (%s)"), TranslateTS(szLanguageName), TranslateTS(szContryName));
+ mir_sntprintf(szLocaleName, _countof(szLocaleName), _T("%s (%s)"), TranslateTS(szLanguageName), TranslateTS(szContryName));
if (!IsValidLocale(pack->Locale, LCID_INSTALLED)) {
TCHAR *pszIncompat;
pszIncompat = TranslateT("(incompatible)");
- szLocaleName[SIZEOF(szLocaleName) - mir_tstrlen(pszIncompat) - 1] = 0;
+ szLocaleName[_countof(szLocaleName) - mir_tstrlen(pszIncompat) - 1] = 0;
mir_tstrcat(mir_tstrcat(szLocaleName, _T(" ")), pszIncompat);
}
SetDlgItemText(hwndDlg, IDC_LANGLOCALE, szLocaleName);
@@ -60,7 +60,7 @@ static void DisplayPackInfo(HWND hwndDlg, const LANGPACK_INFO *pack)
SYSTEMTIME stFileDate;
TCHAR szDate[128]; szDate[0] = 0;
if (FileTimeToSystemTime(&pack->ftFileDate, &stFileDate))
- GetDateFormat(Langpack_GetDefaultLocale(), DATE_SHORTDATE, &stFileDate, NULL, szDate, SIZEOF(szDate));
+ GetDateFormat(Langpack_GetDefaultLocale(), DATE_SHORTDATE, &stFileDate, NULL, szDate, _countof(szDate));
SetDlgItemText(hwndDlg, IDC_LANGDATE, szDate);
/* general */
@@ -77,7 +77,7 @@ static BOOL InsertPackItemEnumProc(LANGPACK_INFO *pack, WPARAM wParam, LPARAM)
/* insert */
TCHAR tszName[512];
- mir_sntprintf(tszName, SIZEOF(tszName), _T("%s [%s]"),
+ mir_sntprintf(tszName, _countof(tszName), _T("%s [%s]"),
TranslateTS(pack->tszLanguage),
pack->flags & LPF_DEFAULT ? TranslateT("built-in") : pack->tszFileName);
UINT message = pack->flags & LPF_DEFAULT ? CB_INSERTSTRING : CB_ADDSTRING;
@@ -125,7 +125,7 @@ INT_PTR CALLBACK DlgLangpackOpt(HWND hwndDlg, UINT msg, WPARAM wParam, LPARAM lP
{
char buf[512];
mir_strcpy(buf, "mailto:");
- if (GetDlgItemTextA(hwndDlg, LOWORD(wParam), &buf[7], SIZEOF(buf) - 7))
+ if (GetDlgItemTextA(hwndDlg, LOWORD(wParam), &buf[7], _countof(buf) - 7))
CallService(MS_UTILS_OPENURL, 0, (LPARAM)buf);
}
break;
diff --git a/src/mir_app/src/meta_main.cpp b/src/mir_app/src/meta_main.cpp
index 3c18940afe..2b49613832 100644
--- a/src/mir_app/src/meta_main.cpp
+++ b/src/mir_app/src/meta_main.cpp
@@ -56,7 +56,7 @@ void UnloadMetacontacts(void)
// Called when the plugin is loaded into Miranda
int LoadMetacontacts(void)
{
- Icon_Register(g_hInst, LPGEN("MetaContacts"), iconList, SIZEOF(iconList), "mc");
+ Icon_Register(g_hInst, LPGEN("MetaContacts"), iconList, _countof(iconList), "mc");
db_set_resident(META_PROTO, "Status");
db_set_resident(META_PROTO, "IdleTS");
diff --git a/src/mir_app/src/meta_menu.cpp b/src/mir_app/src/meta_menu.cpp
index 49901c6412..1dce9747d4 100644
--- a/src/mir_app/src/meta_menu.cpp
+++ b/src/mir_app/src/meta_menu.cpp
@@ -296,7 +296,7 @@ int Meta_ModifyMenu(WPARAM hMeta, LPARAM)
// show hide nudge menu item
char serviceFunc[256];
- mir_snprintf(serviceFunc, SIZEOF(serviceFunc), "%s%s", GetContactProto(Meta_GetMostOnline(cc)), PS_SEND_NUDGE);
+ mir_snprintf(serviceFunc, _countof(serviceFunc), "%s%s", GetContactProto(Meta_GetMostOnline(cc)), PS_SEND_NUDGE);
CallService(MS_NUDGE_SHOWMENU, (WPARAM)META_PROTO, ServiceExists(serviceFunc));
return 0;
}
diff --git a/src/mir_app/src/meta_services.cpp b/src/mir_app/src/meta_services.cpp
index 5c6962f8cd..2379458374 100644
--- a/src/mir_app/src/meta_services.cpp
+++ b/src/mir_app/src/meta_services.cpp
@@ -243,7 +243,7 @@ INT_PTR Meta_SendMessage(WPARAM wParam, LPARAM lParam)
tfap->hContact = ccs->hContact;
tfap->hEvent = hEvent;
tfap->id = 10;
- strncpy(tfap->msg, Translate("No online contacts found."), SIZEOF(tfap->msg) - 1);
+ strncpy(tfap->msg, Translate("No online contacts found."), _countof(tfap->msg) - 1);
CloseHandle(mir_forkthread(sttFakeAckFail, (void*)tfap));
SetEvent(hEvent);
@@ -852,7 +852,7 @@ void Meta_InitServices()
// hidden contact menu items...ho hum
for (int i = 0; i < MAX_CONTACTS; i++) {
char szServiceName[100];
- mir_snprintf(szServiceName, SIZEOF(szServiceName), "MetaContacts/MenuFunc%d", i);
+ mir_snprintf(szServiceName, _countof(szServiceName), "MetaContacts/MenuFunc%d", i);
CreateServiceFunctionParam(szServiceName, MenuFunc, i);
}
diff --git a/src/mir_app/src/meta_utils.cpp b/src/mir_app/src/meta_utils.cpp
index fc32d1a929..3be2190071 100644
--- a/src/mir_app/src/meta_utils.cpp
+++ b/src/mir_app/src/meta_utils.cpp
@@ -489,8 +489,8 @@ int Meta_SetAllNicks()
static void SwapValues(MCONTACT hContact, LPCSTR szSetting, int n1, int n2)
{
char buf1[100], buf2[100];
- mir_snprintf(buf1, SIZEOF(buf1), "%s%d", szSetting, n1);
- mir_snprintf(buf2, SIZEOF(buf2), "%s%d", szSetting, n2);
+ mir_snprintf(buf1, _countof(buf1), "%s%d", szSetting, n1);
+ mir_snprintf(buf2, _countof(buf2), "%s%d", szSetting, n2);
DBVARIANT dbv1, dbv2;
int ok1 = !db_get(hContact, META_PROTO, buf1, &dbv1);
@@ -526,7 +526,7 @@ int Meta_SwapContacts(DBCachedContact *cc, int n1, int n2)
void Meta_GetSubNick(MCONTACT hMeta, int i, CMString &tszDest)
{
char idStr[50];
- mir_snprintf(idStr, SIZEOF(idStr), "Login%d", i);
+ mir_snprintf(idStr, _countof(idStr), "Login%d", i);
DBVARIANT dbv;
if(db_get(hMeta, META_PROTO, idStr, &dbv))
diff --git a/src/mir_app/src/miranda.cpp b/src/mir_app/src/miranda.cpp
index a76fc46adc..6c908228ba 100644
--- a/src/mir_app/src/miranda.cpp
+++ b/src/mir_app/src/miranda.cpp
@@ -325,7 +325,7 @@ static INT_PTR OkToExit(WPARAM, LPARAM)
static INT_PTR GetMirandaVersion(WPARAM, LPARAM)
{
TCHAR filename[MAX_PATH];
- GetModuleFileName(g_hInst, filename, SIZEOF(filename));
+ GetModuleFileName(g_hInst, filename, _countof(filename));
DWORD unused, verInfoSize = GetFileVersionInfoSize(filename, &unused);
PVOID pVerInfo = _alloca(verInfoSize);
@@ -344,7 +344,7 @@ static INT_PTR GetMirandaVersion(WPARAM, LPARAM)
static INT_PTR GetMirandaFileVersion(WPARAM, LPARAM lParam)
{
TCHAR filename[MAX_PATH];
- GetModuleFileName(g_hInst, filename, SIZEOF(filename));
+ GetModuleFileName(g_hInst, filename, _countof(filename));
DWORD unused, verInfoSize = GetFileVersionInfoSize(filename, &unused);
PVOID pVerInfo = _alloca(verInfoSize);
@@ -365,7 +365,7 @@ static INT_PTR GetMirandaFileVersion(WPARAM, LPARAM lParam)
static INT_PTR GetMirandaVersionText(WPARAM wParam, LPARAM lParam)
{
TCHAR filename[MAX_PATH], *productVersion;
- GetModuleFileName(g_hInst, filename, SIZEOF(filename));
+ GetModuleFileName(g_hInst, filename, _countof(filename));
DWORD unused, verInfoSize = GetFileVersionInfoSize(filename, &unused);
PVOID pVerInfo = _alloca(verInfoSize);
diff --git a/src/mir_app/src/netlib.cpp b/src/mir_app/src/netlib.cpp
index 7453fe5c0a..5cd39c0e68 100644
--- a/src/mir_app/src/netlib.cpp
+++ b/src/mir_app/src/netlib.cpp
@@ -289,8 +289,8 @@ INT_PTR NetlibCloseHandle(WPARAM wParam, LPARAM)
waitHandles[1] = nlc->hOkToCloseEvent;
waitHandles[2] = nlc->ncsRecv.hMutex;
waitHandles[3] = nlc->ncsSend.hMutex;
- waitResult = WaitForMultipleObjects(SIZEOF(waitHandles), waitHandles, TRUE, INFINITE);
- if (waitResult >= WAIT_OBJECT_0 + SIZEOF(waitHandles)) {
+ waitResult = WaitForMultipleObjects(_countof(waitHandles), waitHandles, TRUE, INFINITE);
+ if (waitResult >= WAIT_OBJECT_0 + _countof(waitHandles)) {
ReleaseMutex(hConnectionHeaderMutex);
SetLastError(ERROR_INVALID_PARAMETER); //already been closed
return 0;
diff --git a/src/mir_app/src/netlibautoproxy.cpp b/src/mir_app/src/netlibautoproxy.cpp
index 92982a9999..f9572d4cb9 100644
--- a/src/mir_app/src/netlibautoproxy.cpp
+++ b/src/mir_app/src/netlibautoproxy.cpp
@@ -370,14 +370,14 @@ void NetlibLoadIeProxy(void)
int tResult = RegQueryValueExA(hSettings, "ProxyEnable", NULL, NULL, (BYTE*)&enabled, &tValueLen);
bEnabled = enabled && tResult == ERROR_SUCCESS;
- tValueLen = SIZEOF(szHostStr);
+ tValueLen = _countof(szHostStr);
tResult = RegQueryValueExA(hSettings, "ProxyServer", NULL, NULL, (BYTE*)szHostStr, &tValueLen);
bEnabled = bEnabled && tResult == ERROR_SUCCESS;
- tValueLen = SIZEOF(szAutoUrlStr);
+ tValueLen = _countof(szAutoUrlStr);
RegQueryValueExA(hSettings, "AutoConfigUrl", NULL, NULL, (BYTE*)szAutoUrlStr, &tValueLen);
- tValueLen = SIZEOF(szProxyBypassStr);
+ tValueLen = _countof(szProxyBypassStr);
RegQueryValueExA(hSettings, "ProxyOverride", NULL, NULL, (BYTE*)szProxyBypassStr, &tValueLen);
RegCloseKey(hSettings);
diff --git a/src/mir_app/src/netlibbind.cpp b/src/mir_app/src/netlibbind.cpp
index 77fb25fd97..2627b0fc96 100644
--- a/src/mir_app/src/netlibbind.cpp
+++ b/src/mir_app/src/netlibbind.cpp
@@ -279,7 +279,7 @@ LBL_Error:
if (nlb->dwInternalIP == 0) {
char hostname[64] = "";
- gethostname(hostname, SIZEOF(hostname));
+ gethostname(hostname, _countof(hostname));
PHOSTENT he = gethostbyname(hostname);
if (he && he->h_addr)
diff --git a/src/mir_app/src/netlibhttp.cpp b/src/mir_app/src/netlibhttp.cpp
index d18139d69e..c1d154bc1c 100644
--- a/src/mir_app/src/netlibhttp.cpp
+++ b/src/mir_app/src/netlibhttp.cpp
@@ -264,7 +264,7 @@ struct HttpSecurityContext
if (szHost && _stricmp(szProvider, "Basic")) {
unsigned long ip = inet_addr(szHost);
PHOSTENT host = (ip == INADDR_NONE) ? gethostbyname(szHost) : gethostbyaddr((char*)&ip, 4, AF_INET);
- mir_snprintf(szSpnStr, SIZEOF(szSpnStr), "HTTP/%s", host && host->h_name ? host->h_name : szHost);
+ mir_snprintf(szSpnStr, _countof(szSpnStr), "HTTP/%s", host && host->h_name ? host->h_name : szHost);
_strlwr(szSpnStr + 5);
NetlibLogf(nlc->nlu, "Host SPN: %s", szSpnStr);
}
@@ -311,7 +311,7 @@ static int HttpPeekFirstResponseLine(NetlibConnection *nlc, DWORD dwTimeoutTime,
char *peol;
while(true) {
- bytesPeeked = RecvWithTimeoutTime(nlc, dwTimeoutTime, buffer, SIZEOF(buffer) - 1, MSG_PEEK | recvFlags);
+ bytesPeeked = RecvWithTimeoutTime(nlc, dwTimeoutTime, buffer, _countof(buffer) - 1, MSG_PEEK | recvFlags);
if (bytesPeeked == 0) {
SetLastError(ERROR_HANDLE_EOF);
@@ -328,7 +328,7 @@ static int HttpPeekFirstResponseLine(NetlibConnection *nlc, DWORD dwTimeoutTime,
SetLastError(ERROR_BAD_FORMAT);
return 0;
}
- if (bytesPeeked == SIZEOF(buffer) - 1) {
+ if (bytesPeeked == _countof(buffer) - 1) {
SetLastError(ERROR_BUFFER_OVERFLOW);
return 0;
}
@@ -868,13 +868,13 @@ INT_PTR NetlibHttpTransaction(WPARAM wParam, LPARAM lParam)
++nlhrSend.headersCount;
char szMirandaVer[64];
- CallService(MS_SYSTEM_GETVERSIONTEXT, SIZEOF(szMirandaVer), (LPARAM)szMirandaVer);
+ CallService(MS_SYSTEM_GETVERSIONTEXT, _countof(szMirandaVer), (LPARAM)szMirandaVer);
char *pspace = strchr(szMirandaVer, ' ');
if (pspace) {
*pspace++='\0';
- mir_snprintf(szUserAgent, SIZEOF(szUserAgent), "Miranda/%s (%s)", szMirandaVer, pspace);
+ mir_snprintf(szUserAgent, _countof(szUserAgent), "Miranda/%s (%s)", szMirandaVer, pspace);
}
- else mir_snprintf(szUserAgent, SIZEOF(szUserAgent), "Miranda/%s", szMirandaVer);
+ else mir_snprintf(szUserAgent, _countof(szUserAgent), "Miranda/%s", szMirandaVer);
}
if (!doneAcceptEncoding) {
nlhrSend.headers[nlhrSend.headersCount].szName = "Accept-Encoding";
diff --git a/src/mir_app/src/netliblog.cpp b/src/mir_app/src/netliblog.cpp
index 3ac72264d8..7c9ae6e08d 100644
--- a/src/mir_app/src/netliblog.cpp
+++ b/src/mir_app/src/netliblog.cpp
@@ -104,7 +104,7 @@ static INT_PTR CALLBACK LogOptionsDlgProc(HWND hwndDlg, UINT message, WPARAM wPa
CheckDlgButton(hwndDlg, IDC_TEXTDUMPS, logOptions.textDumps ? BST_CHECKED : BST_UNCHECKED);
CheckDlgButton(hwndDlg, IDC_AUTODETECTTEXT, logOptions.autoDetectText ? BST_CHECKED : BST_UNCHECKED);
{
- for (int i=0; i < SIZEOF(szTimeFormats); i++)
+ for (int i=0; i < _countof(szTimeFormats); i++)
SendDlgItemMessage(hwndDlg, IDC_TIMEFORMAT, CB_ADDSTRING, 0, (LPARAM)TranslateTS(szTimeFormats[i]));
}
SendDlgItemMessage(hwndDlg, IDC_TIMEFORMAT, CB_SETCURSEL, logOptions.timeFormat, 0);
@@ -148,7 +148,7 @@ static INT_PTR CALLBACK LogOptionsDlgProc(HWND hwndDlg, UINT message, WPARAM wPa
CheckDlgButton(hwndDlg, IDC_TOFILE, BST_CHECKED);
TCHAR path[MAX_PATH];
- GetWindowText((HWND)lParam, path, SIZEOF(path));
+ GetWindowText((HWND)lParam, path, _countof(path));
PathToAbsoluteT(VARST(path), path);
SetDlgItemText(hwndDlg, IDC_PATH, path);
@@ -157,10 +157,10 @@ static INT_PTR CALLBACK LogOptionsDlgProc(HWND hwndDlg, UINT message, WPARAM wPa
case IDC_FILENAMEBROWSE:
case IDC_RUNATSTARTBROWSE:
- GetWindowText(GetWindow((HWND)lParam, GW_HWNDPREV), str, SIZEOF(str));
+ GetWindowText(GetWindow((HWND)lParam, GW_HWNDPREV), str, _countof(str));
{
TCHAR filter[200];
- mir_sntprintf(filter, SIZEOF(filter), _T("%s (*)%c*%c"), TranslateT("All files"), 0, 0);
+ mir_sntprintf(filter, _countof(filter), _T("%s (*)%c*%c"), TranslateT("All files"), 0, 0);
OPENFILENAME ofn = { 0 };
ofn.lStructSize = OPENFILENAME_SIZE_VERSION_400;
@@ -174,7 +174,7 @@ static INT_PTR CALLBACK LogOptionsDlgProc(HWND hwndDlg, UINT message, WPARAM wPa
}
ofn.lpstrFilter = filter;
ofn.lpstrFile = str;
- ofn.nMaxFile = SIZEOF(str) - 2;
+ ofn.nMaxFile = _countof(str) - 2;
ofn.nMaxFileTitle = MAX_PATH;
if (LOWORD(wParam) == IDC_FILENAMEBROWSE) {
if (!GetSaveFileName(&ofn)) return 1;
@@ -183,7 +183,7 @@ static INT_PTR CALLBACK LogOptionsDlgProc(HWND hwndDlg, UINT message, WPARAM wPa
return 1;
if (LOWORD(wParam) == IDC_RUNATSTARTBROWSE && _tcschr(str, ' ') != NULL) {
- memmove(str + 1, str, ((SIZEOF(str) - 2) * sizeof(TCHAR)));
+ memmove(str + 1, str, ((_countof(str) - 2) * sizeof(TCHAR)));
str[0] = '"';
mir_tstrcat(str, _T("\""));
}
@@ -192,7 +192,7 @@ static INT_PTR CALLBACK LogOptionsDlgProc(HWND hwndDlg, UINT message, WPARAM wPa
break;
case IDC_RUNNOW:
- GetDlgItemText(hwndDlg, IDC_RUNATSTART, str, SIZEOF(str));
+ GetDlgItemText(hwndDlg, IDC_RUNATSTART, str, _countof(str));
if (str[0]) {
STARTUPINFO si = { sizeof(si) };
PROCESS_INFORMATION pi;
@@ -201,15 +201,15 @@ static INT_PTR CALLBACK LogOptionsDlgProc(HWND hwndDlg, UINT message, WPARAM wPa
break;
case IDOK:
- GetDlgItemText(hwndDlg, IDC_RUNATSTART, str, SIZEOF(str));
+ GetDlgItemText(hwndDlg, IDC_RUNATSTART, str, _countof(str));
db_set_ts(NULL, "Netlib", "RunAtStart", str);
db_set_b(NULL, "Netlib", "ShowLogOptsAtStart", (BYTE)IsDlgButtonChecked(hwndDlg, IDC_SHOWTHISDLGATSTART));
- GetDlgItemText(hwndDlg, IDC_FILENAME, str, SIZEOF(str));
+ GetDlgItemText(hwndDlg, IDC_FILENAME, str, _countof(str));
logOptions.tszUserFile = rtrimt(str);
db_set_ts(NULL, "Netlib", "File", str);
- GetDlgItemText(hwndDlg, IDC_PATH, str, SIZEOF(str));
+ GetDlgItemText(hwndDlg, IDC_PATH, str, _countof(str));
logOptions.tszFile = rtrimt(str);
db_set_b(NULL, "Netlib", "DumpRecv", logOptions.dumpRecv = IsDlgButtonChecked(hwndDlg, IDC_DUMPRECV));
@@ -300,21 +300,21 @@ static INT_PTR NetlibLog(WPARAM wParam, LPARAM lParam)
char szTime[32], szHead[128];
switch (logOptions.timeFormat) {
case TIMEFORMAT_HHMMSS:
- GetTimeFormatA(LOCALE_USER_DEFAULT, TIME_FORCE24HOURFORMAT | TIME_NOTIMEMARKER, NULL, NULL, szTime, SIZEOF(szTime));
+ GetTimeFormatA(LOCALE_USER_DEFAULT, TIME_FORCE24HOURFORMAT | TIME_NOTIMEMARKER, NULL, NULL, szTime, _countof(szTime));
mir_strcat(szTime, " ");
break;
case TIMEFORMAT_MILLISECONDS:
QueryPerformanceCounter(&liTimeNow);
liTimeNow.QuadPart -= mirandaStartTime;
- mir_snprintf(szTime, SIZEOF(szTime), "%I64u.%03I64u ", liTimeNow.QuadPart / perfCounterFreq,
+ mir_snprintf(szTime, _countof(szTime), "%I64u.%03I64u ", liTimeNow.QuadPart / perfCounterFreq,
1000 * (liTimeNow.QuadPart % perfCounterFreq) / perfCounterFreq);
break;
case TIMEFORMAT_MICROSECONDS:
QueryPerformanceCounter(&liTimeNow);
liTimeNow.QuadPart -= mirandaStartTime;
- mir_snprintf(szTime, SIZEOF(szTime), "%I64u.%06I64u ", liTimeNow.QuadPart / perfCounterFreq,
+ mir_snprintf(szTime, _countof(szTime), "%I64u.%06I64u ", liTimeNow.QuadPart / perfCounterFreq,
1000000 * (liTimeNow.QuadPart % perfCounterFreq) / perfCounterFreq);
break;
@@ -325,9 +325,9 @@ static INT_PTR NetlibLog(WPARAM wParam, LPARAM lParam)
char *szUser = (logOptions.showUser) ? (nlu == NULL ? NULL : nlu->user.szSettingsModule) : NULL;
if (szUser)
- mir_snprintf(szHead, SIZEOF(szHead), "[%s%04X] [%s] ", szTime, GetCurrentThreadId(), szUser);
+ mir_snprintf(szHead, _countof(szHead), "[%s%04X] [%s] ", szTime, GetCurrentThreadId(), szUser);
else
- mir_snprintf(szHead, SIZEOF(szHead), "[%s%04X] ", szTime, GetCurrentThreadId());
+ mir_snprintf(szHead, _countof(szHead), "[%s%04X] ", szTime, GetCurrentThreadId());
if (logOptions.toOutputDebugString) {
if (szHead[0])
@@ -401,7 +401,7 @@ void NetlibDumpData(NetlibConnection *nlc, PBYTE buf, int len, int sent, int fla
WaitForSingleObject(hConnectionHeaderMutex, INFINITE);
NetlibUser *nlu = nlc ? nlc->nlu : NULL;
- int titleLineLen = mir_snprintf(szTitleLine, SIZEOF(szTitleLine), "(%p:%u) Data %s%s\r\n",
+ int titleLineLen = mir_snprintf(szTitleLine, _countof(szTitleLine), "(%p:%u) Data %s%s\r\n",
nlc, nlc ? nlc->s : 0, sent ? "sent" : "received", flags & MSG_DUMPPROXY ? " (proxy)" : "");
ReleaseMutex(hConnectionHeaderMutex);
diff --git a/src/mir_app/src/netlibopts.cpp b/src/mir_app/src/netlibopts.cpp
index 85d17fcee8..90e6a5a555 100644
--- a/src/mir_app/src/netlibopts.cpp
+++ b/src/mir_app/src/netlibopts.cpp
@@ -304,7 +304,7 @@ static INT_PTR CALLBACK DlgProcNetlibOpts(HWND hwndDlg, UINT msg, WPARAM wParam,
CopySettingsStruct(&settings, &tempSettings[iUser]->settings);
flags = tempSettings[iUser]->flags;
}
- ShowMultipleControls(hwndDlg, outgoingConnectionsControls, SIZEOF(outgoingConnectionsControls), flags&NUF_OUTGOING ? SW_SHOW : SW_HIDE);
+ ShowMultipleControls(hwndDlg, outgoingConnectionsControls, _countof(outgoingConnectionsControls), flags&NUF_OUTGOING ? SW_SHOW : SW_HIDE);
CheckDlgButton(hwndDlg, IDC_USEPROXY, settings.useProxy ? BST_CHECKED : BST_UNCHECKED);
SendDlgItemMessage(hwndDlg, IDC_PROXYTYPE, CB_RESETCONTENT, 0, 0);
if (settings.proxyType == 0) AddProxyTypeItem(hwndDlg, 0, settings.proxyType);
@@ -323,7 +323,7 @@ static INT_PTR CALLBACK DlgProcNetlibOpts(HWND hwndDlg, UINT msg, WPARAM wParam,
CheckDlgButton(hwndDlg, IDC_PROXYDNS, settings.dnsThroughProxy ? BST_CHECKED : BST_UNCHECKED);
CheckDlgButton(hwndDlg, IDC_VALIDATESSL, settings.validateSSL ? BST_CHECKED : BST_UNCHECKED);
- ShowMultipleControls(hwndDlg, incomingConnectionsControls, SIZEOF(incomingConnectionsControls), flags&NUF_INCOMING ? SW_SHOW : SW_HIDE);
+ ShowMultipleControls(hwndDlg, incomingConnectionsControls, _countof(incomingConnectionsControls), flags&NUF_INCOMING ? SW_SHOW : SW_HIDE);
CheckDlgButton(hwndDlg, IDC_SPECIFYPORTS, settings.specifyIncomingPorts ? BST_CHECKED : BST_UNCHECKED);
SetDlgItemTextA(hwndDlg, IDC_PORTSRANGE, settings.szIncomingPorts ? settings.szIncomingPorts : "");
@@ -341,11 +341,11 @@ static INT_PTR CALLBACK DlgProcNetlibOpts(HWND hwndDlg, UINT msg, WPARAM wParam,
TCHAR str[80];
{
int selectedProxyType = SendDlgItemMessage(hwndDlg, IDC_PROXYTYPE, CB_GETITEMDATA, SendDlgItemMessage(hwndDlg, IDC_PROXYTYPE, CB_GETCURSEL, 0, 0), 0);
- mir_sntprintf(str, SIZEOF(str), TranslateT("(often %d)"), oftenProxyPorts[selectedProxyType]);
+ mir_sntprintf(str, _countof(str), TranslateT("(often %d)"), oftenProxyPorts[selectedProxyType]);
SetDlgItemText(hwndDlg, IDC_STOFTENPORT, str);
if (IsDlgButtonChecked(hwndDlg, IDC_USEPROXY) != BST_UNCHECKED) {
int enableAuth = 0, enableUser = 0, enablePass = 0, enableServer = 1;
- EnableMultipleControls(hwndDlg, useProxyControls, SIZEOF(useProxyControls), TRUE);
+ EnableMultipleControls(hwndDlg, useProxyControls, _countof(useProxyControls), TRUE);
if (selectedProxyType == 0) {
for (int i = 0; i < tempSettings.getCount(); i++) {
NetlibTempSettings *p = tempSettings[i];
@@ -378,9 +378,9 @@ static INT_PTR CALLBACK DlgProcNetlibOpts(HWND hwndDlg, UINT msg, WPARAM wParam,
EnableWindow(GetDlgItem(hwndDlg, IDC_PROXYHOST), enableServer);
EnableWindow(GetDlgItem(hwndDlg, IDC_PROXYPORT), enableServer);
}
- else EnableMultipleControls(hwndDlg, useProxyControls, SIZEOF(useProxyControls), FALSE);
- EnableMultipleControls(hwndDlg, specifyPortsControls, SIZEOF(specifyPortsControls), IsDlgButtonChecked(hwndDlg, IDC_SPECIFYPORTS) != BST_UNCHECKED);
- EnableMultipleControls(hwndDlg, specifyOPortsControls, SIZEOF(specifyOPortsControls), IsDlgButtonChecked(hwndDlg, IDC_SPECIFYPORTSO) != BST_UNCHECKED);
+ else EnableMultipleControls(hwndDlg, useProxyControls, _countof(useProxyControls), FALSE);
+ EnableMultipleControls(hwndDlg, specifyPortsControls, _countof(specifyPortsControls), IsDlgButtonChecked(hwndDlg, IDC_SPECIFYPORTS) != BST_UNCHECKED);
+ EnableMultipleControls(hwndDlg, specifyOPortsControls, _countof(specifyOPortsControls), IsDlgButtonChecked(hwndDlg, IDC_SPECIFYPORTSO) != BST_UNCHECKED);
}
break;
diff --git a/src/mir_app/src/netlibsecurity.cpp b/src/mir_app/src/netlibsecurity.cpp
index 1471d611b9..eae0b5a5ac 100644
--- a/src/mir_app/src/netlibsecurity.cpp
+++ b/src/mir_app/src/netlibsecurity.cpp
@@ -66,7 +66,7 @@ static void ReportSecError(SECURITY_STATUS scRet, int line)
{
char szMsgBuf[256];
FormatMessageA(FORMAT_MESSAGE_FROM_SYSTEM | FORMAT_MESSAGE_IGNORE_INSERTS,
- NULL, scRet, LANG_USER_DEFAULT, szMsgBuf, SIZEOF(szMsgBuf), NULL);
+ NULL, scRet, LANG_USER_DEFAULT, szMsgBuf, _countof(szMsgBuf), NULL);
char *p = strchr(szMsgBuf, 13); if (p) *p = 0;
diff --git a/src/mir_app/src/netlibsock.cpp b/src/mir_app/src/netlibsock.cpp
index ee1cfde144..88c089d73f 100644
--- a/src/mir_app/src/netlibsock.cpp
+++ b/src/mir_app/src/netlibsock.cpp
@@ -218,7 +218,7 @@ char* NetlibAddressToString(SOCKADDR_INET_M* addr)
if (addr->si_family == AF_INET) {
char *szIp = inet_ntoa(addr->Ipv4.sin_addr);
if (addr->Ipv4.sin_port != 0) {
- mir_snprintf(saddr, SIZEOF(saddr), "%s:%d", szIp, htons(addr->Ipv4.sin_port));
+ mir_snprintf(saddr, _countof(saddr), "%s:%d", szIp, htons(addr->Ipv4.sin_port));
return mir_strdup(saddr);
}
return mir_strdup(szIp);
diff --git a/src/mir_app/src/netlibupnp.cpp b/src/mir_app/src/netlibupnp.cpp
index 55fe46152a..63654ea4f5 100644
--- a/src/mir_app/src/netlibupnp.cpp
+++ b/src/mir_app/src/netlibupnp.cpp
@@ -261,7 +261,7 @@ static int httpTransact(char* szUrl, char* szResult, int resSize, char* szAction
char szData1[1024];
szReq = mir_strdup(szResult);
- sz = mir_snprintf(szData1, SIZEOF(szData1),
+ sz = mir_snprintf(szData1, _countof(szData1),
soap_action, szActionName, szDev, szReq, szActionName);
sz = mir_snprintf(szData, 4096,
@@ -274,7 +274,7 @@ static int httpTransact(char* szUrl, char* szResult, int resSize, char* szAction
{
char szData1[1024];
- sz = mir_snprintf(szData1, SIZEOF(szData1),
+ sz = mir_snprintf(szData1, _countof(szData1),
soap_query, szActionName);
sz = mir_snprintf(szData, 4096,
@@ -787,7 +787,7 @@ void NetlibUPnPCleanup(void*)
if (txtParseParam(szData, "<NewExternalPort", ">", "<", buf, sizeof(buf))) {
WORD mport = (WORD)atol(buf);
- if (j >= SIZEOF(ports))
+ if (j >= _countof(ports))
break;
for (k = 0; k < numports; ++k)
diff --git a/src/mir_app/src/newplugins.cpp b/src/mir_app/src/newplugins.cpp
index e3263906aa..8c6d7de124 100644
--- a/src/mir_app/src/newplugins.cpp
+++ b/src/mir_app/src/newplugins.cpp
@@ -118,7 +118,7 @@ static const MUUID pluginBannedList[] =
static bool isPluginBanned(const MUUID& u1)
{
- for (int i = 0; i < SIZEOF(pluginBannedList); i++)
+ for (int i = 0; i < _countof(pluginBannedList); i++)
if (equalUUID(pluginBannedList[i], u1))
return true;
@@ -148,7 +148,7 @@ static MuuidReplacement pluginDefault[] =
int getDefaultPluginIdx(const MUUID &muuid)
{
- for (int i = 0; i < SIZEOF(pluginDefault); i++)
+ for (int i = 0; i < _countof(pluginDefault); i++)
if (equalUUID(muuid, pluginDefault[i].uuid))
return i;
@@ -157,7 +157,7 @@ int getDefaultPluginIdx(const MUUID &muuid)
int LoadStdPlugins()
{
- for (int i = 0; i < SIZEOF(pluginDefault); i++) {
+ for (int i = 0; i < _countof(pluginDefault); i++) {
if (pluginDefault[i].pImpl)
continue;
@@ -352,7 +352,7 @@ int Plugin_UnloadDyn(pluginEntry *p)
// mark default plugins to be loaded
if (!(p->pclass & PCLASS_CORE))
- for (int i = 0; i < SIZEOF(pluginDefault); i++)
+ for (int i = 0; i < _countof(pluginDefault); i++)
if (pluginDefault[i].pImpl == p)
pluginDefault[i].pImpl = NULL;
@@ -374,12 +374,12 @@ void enumPlugins(SCAN_PLUGINS_CALLBACK cb, WPARAM wParam, LPARAM lParam)
{
// get miranda's exe path
TCHAR exe[MAX_PATH];
- GetModuleFileName(NULL, exe, SIZEOF(exe));
+ GetModuleFileName(NULL, exe, _countof(exe));
TCHAR *p = _tcsrchr(exe, '\\'); if (p) *p = 0;
// create the search filter
TCHAR search[MAX_PATH];
- mir_sntprintf(search, SIZEOF(search), _T("%s\\Plugins\\*.dll"), exe);
+ mir_sntprintf(search, _countof(search), _T("%s\\Plugins\\*.dll"), exe);
// FFFN will return filenames for things like dot dll+ or dot dllx
WIN32_FIND_DATA ffd;
@@ -403,7 +403,7 @@ pluginEntry* OpenPlugin(TCHAR *tszFileName, TCHAR *dir, TCHAR *path)
pluginList.insert(p);
TCHAR tszFullPath[MAX_PATH];
- mir_sntprintf(tszFullPath, SIZEOF(tszFullPath), _T("%s\\%s\\%s"), path, dir, tszFileName);
+ mir_sntprintf(tszFullPath, _countof(tszFullPath), _T("%s\\%s\\%s"), path, dir, tszFileName);
// map dll into the memory and check its exports
bool bIsPlugin = false;
@@ -485,7 +485,7 @@ int isPluginOnWhiteList(const TCHAR* pluginname)
bool TryLoadPlugin(pluginEntry *p, bool bDynamic)
{
TCHAR exe[MAX_PATH], tszFullPath[MAX_PATH];
- GetModuleFileName(NULL, exe, SIZEOF(exe));
+ GetModuleFileName(NULL, exe, _countof(exe));
TCHAR* slice = _tcsrchr(exe, '\\');
if (slice)
*slice = 0;
@@ -496,7 +496,7 @@ bool TryLoadPlugin(pluginEntry *p, bool bDynamic)
if (!(p->pclass & PCLASS_BASICAPI)) {
BASIC_PLUGIN_INFO bpi;
- mir_sntprintf(tszFullPath, SIZEOF(tszFullPath), _T("%s\\%s\\%s"), exe, (p->pclass & PCLASS_CORE) ? _T("Core") : _T("Plugins"), p->pluginname);
+ mir_sntprintf(tszFullPath, _countof(tszFullPath), _T("%s\\%s\\%s"), exe, (p->pclass & PCLASS_CORE) ? _T("Core") : _T("Plugins"), p->pluginname);
if (!checkAPI(tszFullPath, &bpi, mirandaVersion, CHECKAPI_NONE)) {
p->pclass |= PCLASS_FAILED;
return false;
@@ -552,10 +552,10 @@ static TCHAR tszCoreErr[] = LPGENT("Core plugin '%s' cannot be loaded or missing
bool LoadCorePlugin(MuuidReplacement &mr)
{
TCHAR exe[MAX_PATH], tszPlugName[MAX_PATH];
- GetModuleFileName(NULL, exe, SIZEOF(exe));
+ GetModuleFileName(NULL, exe, _countof(exe));
TCHAR *p = _tcsrchr(exe, '\\'); if (p) *p = 0;
- mir_sntprintf(tszPlugName, SIZEOF(tszPlugName), _T("%s.dll"), mr.stdplugname);
+ mir_sntprintf(tszPlugName, _countof(tszPlugName), _T("%s.dll"), mr.stdplugname);
pluginEntry* pPlug = OpenPlugin(tszPlugName, _T("Core"), exe);
if (pPlug->pclass & PCLASS_FAILED) {
LBL_Error:
@@ -613,14 +613,14 @@ static pluginEntry* getCListModule(TCHAR *exe)
if (!isPluginOnWhiteList(p->pluginname))
continue;
- mir_sntprintf(tszFullPath, SIZEOF(tszFullPath), _T("%s\\Plugins\\%s"), exe, p->pluginname);
+ mir_sntprintf(tszFullPath, _countof(tszFullPath), _T("%s\\Plugins\\%s"), exe, p->pluginname);
if (loadClistModule(tszFullPath, p))
return p;
}
MuuidReplacement& stdClist = pluginDefault[11];
if (LoadCorePlugin(stdClist)) {
- mir_sntprintf(tszFullPath, SIZEOF(tszFullPath), _T("%s\\Core\\%s.dll"), exe, stdClist.stdplugname);
+ mir_sntprintf(tszFullPath, _countof(tszFullPath), _T("%s\\Core\\%s.dll"), exe, stdClist.stdplugname);
if (loadClistModule(tszFullPath, stdClist.pImpl))
return stdClist.pImpl;
}
@@ -758,7 +758,7 @@ int LoadNewPluginsModule(void)
{
// make full path to the plugin
TCHAR exe[MAX_PATH], fullPath[MAX_PATH];
- GetModuleFileName(NULL, exe, SIZEOF(exe));
+ GetModuleFileName(NULL, exe, _countof(exe));
TCHAR *slice = _tcsrchr(exe, '\\');
if (slice)
*slice = 0;
@@ -774,7 +774,7 @@ int LoadNewPluginsModule(void)
// if freeimage is present, load it to provide the basic core functions
if (plugin_freeimg != NULL) {
BASIC_PLUGIN_INFO bpi;
- mir_sntprintf(fullPath, SIZEOF(fullPath), _T("%s\\Plugins\\%s"), exe, plugin_freeimg->pluginname);
+ mir_sntprintf(fullPath, _countof(fullPath), _T("%s\\Plugins\\%s"), exe, plugin_freeimg->pluginname);
if (checkAPI(fullPath, &bpi, mirandaVersion, CHECKAPI_NONE)) {
plugin_freeimg->bpi = bpi;
plugin_freeimg->pclass |= PCLASS_OK | PCLASS_BASICAPI;
diff --git a/src/mir_app/src/options.cpp b/src/mir_app/src/options.cpp
index faf822d515..28ddc75529 100644
--- a/src/mir_app/src/options.cpp
+++ b/src/mir_app/src/options.cpp
@@ -160,7 +160,7 @@ HTREEITEM FindNamedTreeItemAtRoot(HWND hwndTree, const TCHAR* name)
TVITEM tvi;
tvi.mask = TVIF_TEXT;
tvi.pszText = str;
- tvi.cchTextMax = SIZEOF(str);
+ tvi.cchTextMax = _countof(str);
tvi.hItem = TreeView_GetRoot(hwndTree);
while (tvi.hItem != NULL) {
SendMessage(hwndTree, TVM_GETITEM, 0, (LPARAM)&tvi);
@@ -178,7 +178,7 @@ static HTREEITEM FindNamedTreeItemAtChildren(HWND hwndTree, HTREEITEM hItem, con
TVITEM tvi;
tvi.mask = TVIF_TEXT;
tvi.pszText = str;
- tvi.cchTextMax = SIZEOF(str);
+ tvi.cchTextMax = _countof(str);
tvi.hItem = TreeView_GetChild(hwndTree, hItem);
while (tvi.hItem != NULL) {
SendMessage(hwndTree, TVM_GETITEM, 0, (LPARAM)&tvi);
@@ -193,7 +193,7 @@ static HTREEITEM FindNamedTreeItemAtChildren(HWND hwndTree, HTREEITEM hItem, con
static BOOL CALLBACK BoldGroupTitlesEnumChildren(HWND hwnd, LPARAM lParam)
{
TCHAR szClass[64];
- GetClassName(hwnd, szClass, SIZEOF(szClass));
+ GetClassName(hwnd, szClass, _countof(szClass));
if (!mir_tstrcmp(szClass, _T("Button")) && (GetWindowLongPtr(hwnd, GWL_STYLE) & 0x0F) == BS_GROUPBOX)
SendMessage(hwnd, WM_SETFONT, lParam, 0);
@@ -208,7 +208,7 @@ static void SaveOptionsTreeState(HWND hdlg)
char buf[130], str[128];
tvi.mask = TVIF_TEXT | TVIF_STATE;
tvi.pszText = str;
- tvi.cchTextMax = SIZEOF(str);
+ tvi.cchTextMax = _countof(str);
tvi.hItem = TreeView_GetRoot(GetDlgItem(hdlg, IDC_PAGETREE));
while (tvi.hItem != NULL) {
if (SendDlgItemMessageA(hdlg, IDC_PAGETREE, TVM_GETITEMA, 0, (LPARAM)&tvi)) {
@@ -233,7 +233,7 @@ static void ThemeDialogBackground(HWND hwnd, BOOL tabbed)
static TCHAR* GetPluginName(HINSTANCE hInstance, TCHAR *buffer, int size)
{
TCHAR tszModuleName[MAX_PATH];
- GetModuleFileName(hInstance, tszModuleName, SIZEOF(tszModuleName));
+ GetModuleFileName(hInstance, tszModuleName, _countof(tszModuleName));
TCHAR *dllName = _tcsrchr(tszModuleName, '\\');
if (!dllName)
dllName = tszModuleName;
@@ -272,7 +272,7 @@ static void FindFilterStrings(int enableKeywordFiltering, int current, HWND hWnd
TCHAR pluginName[MAX_PATH];
char *temp = GetPluginNameByInstance(page->getInst());
- GetDialogStrings(enableKeywordFiltering, key, GetPluginName(page->getInst(), pluginName, SIZEOF(pluginName)), hWnd, page->ptszGroup, page->ptszTitle, page->ptszTab, _A2T(temp));
+ GetDialogStrings(enableKeywordFiltering, key, GetPluginName(page->getInst(), pluginName, _countof(pluginName)), hWnd, page->ptszGroup, page->ptszTitle, page->ptszTab, _A2T(temp));
if (enableKeywordFiltering && !current)
DestroyWindow(hWnd); // destroy the page, we're done with it
@@ -508,7 +508,7 @@ static void FillFilterCombo(HWND hDlg, OptionsDlgData* dat)
countKnownInst++;
TCHAR tszModuleName[MAX_PATH];
- GetModuleFileName(inst, tszModuleName, SIZEOF(tszModuleName));
+ GetModuleFileName(inst, tszModuleName, _countof(tszModuleName));
TCHAR *dllName = mir_a2t(GetPluginNameByInstance(inst));
if (!dllName) dllName = mir_tstrdup(_tcsrchr(tszModuleName, _T('\\')));
@@ -526,7 +526,7 @@ static void FillFilterCombo(HWND hDlg, OptionsDlgData* dat)
static void RebuildPageTree(HWND hdlg, OptionsDlgData *dat)
{
LPARAM oldSel = SendDlgItemMessage(hdlg, IDC_KEYWORD_FILTER, CB_GETEDITSEL, 0, 0);
- GetDlgItemText(hdlg, IDC_KEYWORD_FILTER, dat->szFilterString, SIZEOF(dat->szFilterString));
+ GetDlgItemText(hdlg, IDC_KEYWORD_FILTER, dat->szFilterString, _countof(dat->szFilterString));
// if filter string is set to all modules then make the filter string empty (this will return all modules)
BOOL bRemoveFocusFromFilter = FALSE;
@@ -538,7 +538,7 @@ static void RebuildPageTree(HWND hdlg, OptionsDlgData *dat)
else if (mir_tstrcmp(dat->szFilterString, TranslateT(CORE_MODULES_FILTER)) == 0) {
// replace string with process name - that will show core settings
TCHAR szFileName[300];
- GetModuleFileName(g_hInst, szFileName, SIZEOF(szFileName));
+ GetModuleFileName(g_hInst, szFileName, _countof(szFileName));
TCHAR *pos = _tcsrchr(szFileName, _T('\\'));
if (pos)
pos++;
@@ -552,7 +552,7 @@ static void RebuildPageTree(HWND hdlg, OptionsDlgData *dat)
if (sel != -1) {
HINSTANCE hinst = (HINSTANCE)SendDlgItemMessage(hdlg, IDC_KEYWORD_FILTER, (UINT)CB_GETITEMDATA, sel, 0);
TCHAR szFileName[300];
- GetModuleFileName(hinst, szFileName, SIZEOF(szFileName));
+ GetModuleFileName(hinst, szFileName, _countof(szFileName));
TCHAR *pos = _tcsrchr(szFileName, _T('\\'));
if (pos) pos++;
else pos = szFileName;
@@ -651,7 +651,7 @@ static void RebuildPageTree(HWND hdlg, OptionsDlgData *dat)
TVITEMA tvi;
tvi.mask = TVIF_TEXT | TVIF_STATE;
tvi.pszText = str;
- tvi.cchTextMax = SIZEOF(str);
+ tvi.cchTextMax = _countof(str);
tvi.hItem = TreeView_GetRoot(hwndTree);
while (tvi.hItem != NULL) {
if (SendMessageA(hwndTree, TVM_GETITEMA, 0, (LPARAM)&tvi)) {
@@ -1151,7 +1151,7 @@ void OpenAccountOptions(PROTOACCOUNT *pa)
return;
TCHAR tszTitle[100];
- mir_sntprintf(tszTitle, SIZEOF(tszTitle), TranslateT("%s options"), pa->tszAccountName);
+ mir_sntprintf(tszTitle, _countof(tszTitle), TranslateT("%s options"), pa->tszAccountName);
OPENOPTIONSDIALOG ood = { sizeof(ood) };
ood.pszGroup = LPGEN("Network");
diff --git a/src/mir_app/src/path.cpp b/src/mir_app/src/path.cpp
index 8e6ea249a9..ce9e92e4c8 100644
--- a/src/mir_app/src/path.cpp
+++ b/src/mir_app/src/path.cpp
@@ -94,7 +94,7 @@ static __forceinline char *GetContactIDX(char *, MCONTACT hContact)
static __forceinline char *GetEnvironmentVariableX(char *variable)
{
char result[512];
- if (GetEnvironmentVariableA(variable, result, SIZEOF(result)))
+ if (GetEnvironmentVariableA(variable, result, _countof(result)))
return mir_strdup(result);
return NULL;
}
@@ -124,7 +124,7 @@ static __forceinline char *GetModulePathX(char *, HMODULE hModule)
static __forceinline char *GetUserNameX(char *)
{
char result[128];
- DWORD size = SIZEOF(result);
+ DWORD size = _countof(result);
if (GetUserNameA(result, &size))
return mir_strdup(result);
return NULL;
@@ -144,13 +144,13 @@ static __forceinline char *GetPathVarX(char *, int code)
if (hAvatarFolder != NULL)
_tcsncpy_s(szFullPath, tszAvatarRoot, _TRUNCATE);
else
- mir_sntprintf(szFullPath, SIZEOF(szFullPath), _T("%s\\%s\\AvatarCache"), g_profileDir, g_shortProfileName);
+ mir_sntprintf(szFullPath, _countof(szFullPath), _T("%s\\%s\\AvatarCache"), g_profileDir, g_shortProfileName);
break;
case 2:
- mir_sntprintf(szFullPath, SIZEOF(szFullPath), _T("%s\\%s\\Logs"), g_profileDir, g_shortProfileName);
+ mir_sntprintf(szFullPath, _countof(szFullPath), _T("%s\\%s\\Logs"), g_profileDir, g_shortProfileName);
break;
case 3:
- mir_sntprintf(szFullPath, SIZEOF(szFullPath), _T("%s\\%s"), g_profileDir, g_shortProfileName);
+ mir_sntprintf(szFullPath, _countof(szFullPath), _T("%s\\%s"), g_profileDir, g_shortProfileName);
break;
}
return makeFileName(szFullPath);
@@ -178,7 +178,7 @@ static __forceinline TCHAR *GetContactIDX(TCHAR *, MCONTACT hContact)
static __forceinline TCHAR *GetEnvironmentVariableX(TCHAR *variable)
{
TCHAR result[512];
- if (GetEnvironmentVariable(variable, result, SIZEOF(result)))
+ if (GetEnvironmentVariable(variable, result, _countof(result)))
return mir_tstrdup(result);
return NULL;
}
@@ -199,7 +199,7 @@ static __forceinline TCHAR *GetProfileDirX(TCHAR*)
static __forceinline TCHAR *GetModulePathX(TCHAR *, HMODULE hModule)
{
TCHAR result[MAX_PATH];
- GetModuleFileName(hModule, result, SIZEOF(result));
+ GetModuleFileName(hModule, result, _countof(result));
TCHAR* str = _tcsrchr(result, '\\');
if (str) *str = 0;
return mir_tstrdup(result);
@@ -208,7 +208,7 @@ static __forceinline TCHAR *GetModulePathX(TCHAR *, HMODULE hModule)
static __forceinline TCHAR *GetUserNameX(TCHAR *)
{
TCHAR result[128];
- DWORD size = SIZEOF(result);
+ DWORD size = _countof(result);
if (GetUserName(result, &size))
return mir_tstrdup(result);
return NULL;
@@ -228,13 +228,13 @@ static __forceinline TCHAR *GetPathVarX(TCHAR *, int code)
if (hAvatarFolder != NULL)
_tcsncpy_s(szFullPath, tszAvatarRoot, _TRUNCATE);
else
- mir_sntprintf(szFullPath, SIZEOF(szFullPath), _T("%s\\%s\\AvatarCache"), g_profileDir, g_shortProfileName);
+ mir_sntprintf(szFullPath, _countof(szFullPath), _T("%s\\%s\\AvatarCache"), g_profileDir, g_shortProfileName);
break;
case 2:
- mir_sntprintf(szFullPath, SIZEOF(szFullPath), _T("%s\\%s\\Logs"), g_profileDir, g_shortProfileName);
+ mir_sntprintf(szFullPath, _countof(szFullPath), _T("%s\\%s\\Logs"), g_profileDir, g_shortProfileName);
break;
case 3:
- mir_sntprintf(szFullPath, SIZEOF(szFullPath), _T("%s\\%s"), g_profileDir, g_shortProfileName);
+ mir_sntprintf(szFullPath, _countof(szFullPath), _T("%s\\%s"), g_profileDir, g_shortProfileName);
break;
}
return mir_tstrdup(szFullPath);
@@ -393,20 +393,20 @@ int InitPathUtils(void)
static int OnFoldersChanged(WPARAM, LPARAM)
{
- mir_sntprintf(tszAvatarRoot, SIZEOF(tszAvatarRoot), _T("%s\\%s\\AvatarCache"), g_profileDir, g_shortProfileName);
+ mir_sntprintf(tszAvatarRoot, _countof(tszAvatarRoot), _T("%s\\%s\\AvatarCache"), g_profileDir, g_shortProfileName);
TCHAR tmpVar[MAX_PATH];
- if (!FoldersGetCustomPathT(hAvatarFolder, tmpVar, SIZEOF(tmpVar), tszAvatarRoot))
+ if (!FoldersGetCustomPathT(hAvatarFolder, tmpVar, _countof(tmpVar), tszAvatarRoot))
_tcsncpy_s(tszAvatarRoot, tmpVar, _TRUNCATE);
return 0;
}
void InitPathVar()
{
- mir_sntprintf(tszAvatarRoot, SIZEOF(tszAvatarRoot), _T("%s\\%s\\AvatarCache"), g_profileDir, g_shortProfileName);
+ mir_sntprintf(tszAvatarRoot, _countof(tszAvatarRoot), _T("%s\\%s\\AvatarCache"), g_profileDir, g_shortProfileName);
if (hAvatarFolder = FoldersRegisterCustomPathT( LPGEN("Avatars"), LPGEN("Avatars root folder"), tszAvatarRoot)) {
TCHAR tmpVar[MAX_PATH];
- if (!FoldersGetCustomPathT(hAvatarFolder, tmpVar, SIZEOF(tmpVar), tszAvatarRoot))
+ if (!FoldersGetCustomPathT(hAvatarFolder, tmpVar, _countof(tmpVar), tszAvatarRoot))
_tcsncpy_s(tszAvatarRoot, tmpVar, _TRUNCATE);
HookEvent(ME_FOLDERS_PATH_CHANGED, OnFoldersChanged);
}
diff --git a/src/mir_app/src/pluginopts.cpp b/src/mir_app/src/pluginopts.cpp
index 9f62b32c6e..278050a96d 100644
--- a/src/mir_app/src/pluginopts.cpp
+++ b/src/mir_app/src/pluginopts.cpp
@@ -184,7 +184,7 @@ static void RemoveAllItems(HWND hwnd)
static bool LoadPluginDynamically(PluginListItemData *dat)
{
TCHAR exe[MAX_PATH];
- GetModuleFileName(NULL, exe, SIZEOF(exe));
+ GetModuleFileName(NULL, exe, _countof(exe));
TCHAR *p = _tcsrchr(exe, '\\'); if (p) *p = 0;
pluginEntry* pPlug = OpenPlugin(dat->fileName, _T("Plugins"), exe);
@@ -424,7 +424,7 @@ INT_PTR CALLBACK DlgPluginOpt(HWND hwndDlg, UINT msg, WPARAM wParam, LPARAM lPar
PluginListItemData *dat = (PluginListItemData*)lvi.lParam;
TCHAR buf[1024];
- ListView_GetItemText(hwndList, hdr->iItem, 2, buf, SIZEOF(buf));
+ ListView_GetItemText(hwndList, hdr->iItem, 2, buf, _countof(buf));
SetDlgItemText(hwndDlg, IDC_PLUGININFOFRAME, sel ? buf : _T(""));
ptrT tszAuthor(latin2t(sel ? dat->author : NULL));
@@ -456,12 +456,12 @@ INT_PTR CALLBACK DlgPluginOpt(HWND hwndDlg, UINT msg, WPARAM wParam, LPARAM lPar
if (hdr->hdr.code == PSN_APPLY) {
bool needRestart = false;
TCHAR bufRestart[1024];
- int bufLen = mir_sntprintf(bufRestart, SIZEOF(bufRestart), _T("%s\n"), TranslateT("Miranda NG must be restarted to apply changes for these plugins:"));
+ int bufLen = mir_sntprintf(bufRestart, _countof(bufRestart), _T("%s\n"), TranslateT("Miranda NG must be restarted to apply changes for these plugins:"));
HWND hwndList = GetDlgItem(hwndDlg, IDC_PLUGLIST);
for (int iRow = 0; iRow != -1;) {
TCHAR buf[1024];
- ListView_GetItemText(hwndList, iRow, 1, buf, SIZEOF(buf));
+ ListView_GetItemText(hwndList, iRow, 1, buf, _countof(buf));
int iState = ListView_GetItemState(hwndList, iRow, LVIS_STATEIMAGEMASK);
SetPluginOnWhiteList(buf, (iState & 0x2000) ? 1 : 0);
@@ -483,7 +483,7 @@ INT_PTR CALLBACK DlgPluginOpt(HWND hwndDlg, UINT msg, WPARAM wParam, LPARAM lPar
ListView_SetItem(hwndList, &lvi);
}
else {
- bufLen += mir_sntprintf(bufRestart + bufLen, SIZEOF(bufRestart) - bufLen, _T(" - %s\n"), buf);
+ bufLen += mir_sntprintf(bufRestart + bufLen, _countof(bufRestart) - bufLen, _T(" - %s\n"), buf);
needRestart = true;
}
}
@@ -496,7 +496,7 @@ INT_PTR CALLBACK DlgPluginOpt(HWND hwndDlg, UINT msg, WPARAM wParam, LPARAM lPar
ListView_SetItem(hwndList, &lvi);
}
else {
- bufLen += mir_sntprintf(bufRestart + bufLen, SIZEOF(bufRestart) - bufLen, _T(" - %s\n"), buf);
+ bufLen += mir_sntprintf(bufRestart + bufLen, _countof(bufRestart) - bufLen, _T(" - %s\n"), buf);
needRestart = true;
}
}
@@ -510,7 +510,7 @@ INT_PTR CALLBACK DlgPluginOpt(HWND hwndDlg, UINT msg, WPARAM wParam, LPARAM lPar
ShowWindow(GetDlgItem(hwndDlg, IDC_RESTART), needRestart);
if (needRestart) {
- mir_sntprintf(bufRestart + bufLen, SIZEOF(bufRestart) - bufLen, _T("\n%s"), TranslateT("Do you want to restart it now?"));
+ mir_sntprintf(bufRestart + bufLen, _countof(bufRestart) - bufLen, _T("\n%s"), TranslateT("Do you want to restart it now?"));
if (MessageBox(NULL, bufRestart, _T("Miranda NG"), MB_ICONWARNING | MB_YESNO) == IDYES)
CallService(MS_SYSTEM_RESTART, 1, 0);
}
@@ -530,7 +530,7 @@ INT_PTR CALLBACK DlgPluginOpt(HWND hwndDlg, UINT msg, WPARAM wParam, LPARAM lPar
char buf[512];
char *p = &buf[7];
mir_strcpy(buf, "mailto:");
- if (GetDlgItemTextA(hwndDlg, LOWORD(wParam), p, SIZEOF(buf) - 7))
+ if (GetDlgItemTextA(hwndDlg, LOWORD(wParam), p, _countof(buf) - 7))
CallService(MS_UTILS_OPENURL, 0, (LPARAM)(LOWORD(wParam) == IDC_PLUGINEMAIL ? buf : p));
break;
}
diff --git a/src/mir_app/src/profilemanager.cpp b/src/mir_app/src/profilemanager.cpp
index e2ffc37f79..bda73395a4 100644
--- a/src/mir_app/src/profilemanager.cpp
+++ b/src/mir_app/src/profilemanager.cpp
@@ -46,7 +46,7 @@ static int findProfiles(TCHAR *szProfileDir, ENUMPROFILECALLBACK callback, LPARA
{
// find in Miranda NG profile subfolders
TCHAR searchspec[MAX_PATH];
- mir_sntprintf(searchspec, SIZEOF(searchspec), _T("%s\\*.*"), szProfileDir);
+ mir_sntprintf(searchspec, _countof(searchspec), _T("%s\\*.*"), szProfileDir);
WIN32_FIND_DATA ffd;
HANDLE hFind = FindFirstFile(searchspec, &ffd);
@@ -59,7 +59,7 @@ static int findProfiles(TCHAR *szProfileDir, ENUMPROFILECALLBACK callback, LPARA
TCHAR buf[MAX_PATH], profile[MAX_PATH];
mir_sntprintf(buf, _T("%s\\%s\\%s.dat"), szProfileDir, ffd.cFileName, ffd.cFileName);
if (_taccess(buf, 0) == 0) {
- mir_sntprintf(profile, SIZEOF(profile), _T("%s.dat"), ffd.cFileName);
+ mir_sntprintf(profile, _countof(profile), _T("%s.dat"), ffd.cFileName);
if (!callback(buf, profile, lParam))
break;
}
@@ -264,11 +264,11 @@ class CChooseProfileDlg : public CDlgBase
struct _stat statbuf;
if (_tstat(tszFullPath, &statbuf) == 0) {
if (statbuf.st_size > 1000000) {
- mir_sntprintf(sizeBuf, SIZEOF(sizeBuf), _T("%.3lf"), (double)statbuf.st_size / 1048576.0);
+ mir_sntprintf(sizeBuf, _countof(sizeBuf), _T("%.3lf"), (double)statbuf.st_size / 1048576.0);
mir_tstrcpy(sizeBuf + 5, _T(" MB"));
}
else {
- mir_sntprintf(sizeBuf, SIZEOF(sizeBuf), _T("%.3lf"), (double)statbuf.st_size / 1024.0);
+ mir_sntprintf(sizeBuf, _countof(sizeBuf), _T("%.3lf"), (double)statbuf.st_size / 1024.0);
mir_tstrcpy(sizeBuf + 5, _T(" KB"));
}
bFileLocked = !fileExist(tszFullPath);
@@ -315,11 +315,11 @@ class CChooseProfileDlg : public CDlgBase
item.mask = LVIF_TEXT | LVIF_IMAGE;
item.iItem = iItem;
item.pszText = profile;
- item.cchTextMax = SIZEOF(profile);
+ item.cchTextMax = _countof(profile);
if (!m_profileList.GetItem(&item))
return;
- mir_sntprintf(fullName, SIZEOF(fullName), _T("%s\\%s\\%s.dat"), m_pd->ptszProfileDir, profile, profile);
+ mir_sntprintf(fullName, _countof(fullName), _T("%s\\%s\\%s.dat"), m_pd->ptszProfileDir, profile, profile);
CallService(MS_DB_CHECKPROFILE, (WPARAM)fullName, item.iImage == 2);
}
@@ -334,15 +334,15 @@ class CChooseProfileDlg : public CDlgBase
item.mask = LVIF_TEXT;
item.iItem = iItem;
item.pszText = profile;
- item.cchTextMax = SIZEOF(profile);
+ item.cchTextMax = _countof(profile);
if (!m_profileList.GetItem(&item))
return;
- mir_sntprintf(profilef, SIZEOF(profilef), TranslateT("Are you sure you want to remove profile \"%s\"?"), profile);
+ mir_sntprintf(profilef, _countof(profilef), TranslateT("Are you sure you want to remove profile \"%s\"?"), profile);
if (IDYES != MessageBox(NULL, profilef, _T("Miranda NG"), MB_YESNO | MB_TASKMODAL | MB_ICONWARNING))
return;
- mir_sntprintf(profilef, SIZEOF(profilef), _T("%s\\%s%c"), m_pd->ptszProfileDir, profile, 0);
+ mir_sntprintf(profilef, _countof(profilef), _T("%s\\%s%c"), m_pd->ptszProfileDir, profile, 0);
SHFILEOPSTRUCT sf = { 0 };
sf.wFunc = FO_DELETE;
@@ -361,7 +361,7 @@ class CChooseProfileDlg : public CDlgBase
item.mask = LVIF_TEXT | LVIF_IMAGE;
item.iItem = m_profileList.GetNextItem(-1, LVNI_SELECTED | LVNI_ALL);
item.pszText = profile;
- item.cchTextMax = SIZEOF(profile);
+ item.cchTextMax = _countof(profile);
if (!m_profileList.GetItem(&item))
return;
@@ -383,7 +383,7 @@ class CChooseProfileDlg : public CDlgBase
// profile is placed in "profile_name" subfolder
TCHAR tmpPath[MAX_PATH];
- mir_sntprintf(tmpPath, SIZEOF(tmpPath), _T("%s\\%s.dat"), m_pd->ptszProfileDir, profile);
+ mir_sntprintf(tmpPath, _countof(tmpPath), _T("%s\\%s.dat"), m_pd->ptszProfileDir, profile);
if (_taccess(tmpPath, 2))
mir_sntprintf(m_pd->ptszProfile, MAX_PATH, _T("%s\\%s\\%s.dat"), m_pd->ptszProfileDir, profile, profile);
else
@@ -519,8 +519,8 @@ public:
if (auto pTip = evt->nmlvit) {
TCHAR profilename[MAX_PATH], tszFullPath[MAX_PATH];
struct _stat statbuf;
- m_profileList.GetItemText(pTip->iItem, 0, profilename, SIZEOF(profilename));
- mir_sntprintf(tszFullPath, SIZEOF(tszFullPath), _T("%s\\%s\\%s.dat"), m_pd->ptszProfileDir, profilename, profilename);
+ m_profileList.GetItemText(pTip->iItem, 0, profilename, _countof(profilename));
+ mir_sntprintf(tszFullPath, _countof(tszFullPath), _T("%s\\%s\\%s.dat"), m_pd->ptszProfileDir, profilename, profilename);
_tstat(tszFullPath, &statbuf);
mir_sntprintf(pTip->pszText, pTip->cchTextMax, _T("%s\n%s: %s\n%s: %s"), tszFullPath, TranslateT("Created"), rtrimt(NEWTSTR_ALLOCA(_tctime(&statbuf.st_ctime))), TranslateT("Modified"), rtrimt(NEWTSTR_ALLOCA(_tctime(&statbuf.st_mtime))));
}
diff --git a/src/mir_app/src/proto_accs.cpp b/src/mir_app/src/proto_accs.cpp
index 6aa601dfbf..86fbbf713f 100644
--- a/src/mir_app/src/proto_accs.cpp
+++ b/src/mir_app/src/proto_accs.cpp
@@ -428,7 +428,7 @@ void UnloadAccountsModule()
}
accounts.destroy();
- for (int i = 0; i < SIZEOF(hHooks); i++)
+ for (int i = 0; i < _countof(hHooks); i++)
UnhookEvent(hHooks[i]);
}
diff --git a/src/mir_app/src/proto_opts.cpp b/src/mir_app/src/proto_opts.cpp
index c34ffdc6d0..ce4c986679 100644
--- a/src/mir_app/src/proto_opts.cpp
+++ b/src/mir_app/src/proto_opts.cpp
@@ -124,7 +124,7 @@ static bool OnCreateAccount(HWND hwndDlg)
PROTOACCOUNT *pa = param->pa;
TCHAR tszAccName[256];
- GetDlgItemText(hwndDlg, IDC_ACCNAME, tszAccName, SIZEOF(tszAccName));
+ GetDlgItemText(hwndDlg, IDC_ACCNAME, tszAccName, _countof(tszAccName));
rtrimt(tszAccName);
if (tszAccName[0] == 0) {
MessageBox(hwndDlg, TranslateT("Account name must be filled."), TranslateT("Account error"), MB_ICONERROR | MB_OK);
@@ -133,7 +133,7 @@ static bool OnCreateAccount(HWND hwndDlg)
if (param->action == PRAC_ADDED) {
char buf[200];
- GetDlgItemTextA(hwndDlg, IDC_ACCINTERNALNAME, buf, SIZEOF(buf));
+ GetDlgItemTextA(hwndDlg, IDC_ACCINTERNALNAME, buf, _countof(buf));
if (FindAccountByName(rtrim(buf))) {
MessageBox(hwndDlg, TranslateT("Account name has to be unique. Please enter unique name."), TranslateT("Account error"), MB_ICONERROR | MB_OK);
return false;
@@ -143,13 +143,13 @@ static bool OnCreateAccount(HWND hwndDlg)
if (param->action == PRAC_UPGRADED) {
BOOL oldProto = pa->bOldProto;
TCHAR szPlugin[MAX_PATH];
- mir_sntprintf(szPlugin, SIZEOF(szPlugin), _T("%s.dll"), _A2T(pa->szProtoName));
+ mir_sntprintf(szPlugin, _countof(szPlugin), _T("%s.dll"), _A2T(pa->szProtoName));
int idx = accounts.getIndex(pa);
UnloadAccount(pa, false, false);
accounts.remove(idx);
- if (oldProto && UnloadPlugin(szPlugin, SIZEOF(szPlugin))) {
+ if (oldProto && UnloadPlugin(szPlugin, _countof(szPlugin))) {
TCHAR szNewName[MAX_PATH];
- mir_sntprintf(szNewName, SIZEOF(szNewName), _T("%s~"), szPlugin);
+ mir_sntprintf(szNewName, _countof(szNewName), _T("%s~"), szPlugin);
MoveFile(szPlugin, szNewName);
}
param->action = PRAC_ADDED;
@@ -157,10 +157,10 @@ static bool OnCreateAccount(HWND hwndDlg)
if (param->action == PRAC_ADDED) {
char buf[200];
- GetDlgItemTextA(hwndDlg, IDC_PROTOTYPECOMBO, buf, SIZEOF(buf));
+ GetDlgItemTextA(hwndDlg, IDC_PROTOTYPECOMBO, buf, _countof(buf));
char *szBaseProto = NEWSTR_ALLOCA(buf);
- GetDlgItemTextA(hwndDlg, IDC_ACCINTERNALNAME, buf, SIZEOF(buf));
+ GetDlgItemTextA(hwndDlg, IDC_ACCINTERNALNAME, buf, _countof(buf));
rtrim(buf);
pa = Proto_CreateAccount(buf, szBaseProto, tszAccName);
@@ -202,9 +202,9 @@ static INT_PTR CALLBACK AccFormDlgProc(HWND hwndDlg, UINT message, WPARAM wParam
TCHAR str[200];
if (param->action == PRAC_CHANGED) { // update
EnableWindow(GetDlgItem(hwndDlg, IDC_PROTOTYPECOMBO), FALSE);
- mir_sntprintf(str, SIZEOF(str), _T("%s: %s"), TranslateT("Editing account"), param->pa->tszAccountName);
+ mir_sntprintf(str, _countof(str), _T("%s: %s"), TranslateT("Editing account"), param->pa->tszAccountName);
}
- else mir_sntprintf(str, SIZEOF(str), _T("%s: %s"), TranslateT("Upgrading account"), param->pa->tszAccountName);
+ else mir_sntprintf(str, _countof(str), _T("%s: %s"), TranslateT("Upgrading account"), param->pa->tszAccountName);
SetWindowText(hwndDlg, str);
SetDlgItemText(hwndDlg, IDC_ACCNAME, param->pa->tszAccountName);
diff --git a/src/mir_app/src/proto_utils.cpp b/src/mir_app/src/proto_utils.cpp
index 0c2f053f8e..d00fbd27a8 100644
--- a/src/mir_app/src/proto_utils.cpp
+++ b/src/mir_app/src/proto_utils.cpp
@@ -64,7 +64,7 @@ MIR_APP_DLL(void) ProtoLogA(struct PROTO_INTERFACE *pThis, LPCSTR szFormat, va_l
MIR_APP_DLL(void) ProtoLogW(struct PROTO_INTERFACE *pThis, LPCWSTR wszFormat, va_list args)
{
WCHAR buf[4096];
- int res = _vsnwprintf(buf, SIZEOF(buf), wszFormat, args);
+ int res = _vsnwprintf(buf, _countof(buf), wszFormat, args);
CallService(MS_NETLIB_LOGW, (WPARAM)(pThis ? pThis->m_hNetlibUser : NULL), (LPARAM)((res != -1) ? buf : CMStringW().FormatV(wszFormat, args)));
}
@@ -244,10 +244,10 @@ MIR_APP_DLL(int) ProtoGetAvatarFileFormat(const TCHAR *ptszFileName)
DWORD dwBytes;
char buf[32];
- BOOL res = ReadFile(hFile, buf, SIZEOF(buf), &dwBytes, NULL);
+ BOOL res = ReadFile(hFile, buf, _countof(buf), &dwBytes, NULL);
CloseHandle(hFile);
- return (res && dwBytes == SIZEOF(buf)) ? ProtoGetBufferFormat(buf) : PA_FORMAT_UNKNOWN;
+ return (res && dwBytes == _countof(buf)) ? ProtoGetBufferFormat(buf) : PA_FORMAT_UNKNOWN;
}
/////////////////////////////////////////////////////////////////////////////////////////
diff --git a/src/mir_app/src/searchresults.cpp b/src/mir_app/src/searchresults.cpp
index 8a8ae3ea8f..b75ca7746d 100644
--- a/src/mir_app/src/searchresults.cpp
+++ b/src/mir_app/src/searchresults.cpp
@@ -150,8 +150,8 @@ int CALLBACK SearchResultsCompareFunc(LPARAM lParam1, LPARAM lParam2, LPARAM lPa
else {
TCHAR szText1[100];
TCHAR szText2[100];
- ListView_GetItemText(hList, (int)lParam1, sortCol, szText1, SIZEOF(szText1));
- ListView_GetItemText(hList, (int)lParam2, sortCol, szText2, SIZEOF(szText2));
+ ListView_GetItemText(hList, (int)lParam1, sortCol, szText1, _countof(szText1));
+ ListView_GetItemText(hList, (int)lParam2, sortCol, szText2, _countof(szText2));
return mir_tstrcmpi(szText1, szText2)*sortMultiplier;
}
return 0;
@@ -187,7 +187,7 @@ static void BeginSearchFailed(void * arg)
protoName, protoName);
mir_free((char*)arg);
}
- else mir_tstrncpy(buf, TranslateT("Could not search on any of the protocols, are you online?"), SIZEOF(buf));
+ else mir_tstrncpy(buf, TranslateT("Could not search on any of the protocols, are you online?"), _countof(buf));
MessageBox(0, buf, TranslateT("Problem with search"), MB_OK | MB_ICONERROR);
}
diff --git a/src/mir_app/src/services.cpp b/src/mir_app/src/services.cpp
index 85f6837853..3d1fdaf5c2 100644
--- a/src/mir_app/src/services.cpp
+++ b/src/mir_app/src/services.cpp
@@ -261,7 +261,7 @@ static int sttRegisterFontWorker(FontIDW *font_id, int hLangpack)
if (!mir_tstrcmp(newItem->deffontsettings.szFace, _T("MS Shell Dlg"))) {
LOGFONT lf;
SystemParametersInfo(SPI_GETICONTITLELOGFONT, sizeof(LOGFONT), &lf, FALSE);
- mir_tstrncpy(newItem->deffontsettings.szFace, lf.lfFaceName, SIZEOF(newItem->deffontsettings.szFace));
+ mir_tstrncpy(newItem->deffontsettings.szFace, lf.lfFaceName, _countof(newItem->deffontsettings.szFace));
if (!newItem->deffontsettings.size)
newItem->deffontsettings.size = lf.lfHeight;
}
@@ -292,7 +292,7 @@ static INT_PTR sttGetFontWorker(FontIDW *font_id, LOGFONT *lf)
for (int i = 0; i < font_id_list.getCount(); i++) {
FontInternal& F = font_id_list[i];
- if (!_tcsncmp(F.name, font_id->name, SIZEOF(F.name)) && !_tcsncmp(F.group, font_id->group, SIZEOF(F.group))) {
+ if (!_tcsncmp(F.name, font_id->name, _countof(F.name)) && !_tcsncmp(F.group, font_id->group, _countof(F.group))) {
if (GetFontSettingFromDB(F.dbSettingsGroup, F.prefix, lf, &colour, F.flags) && (F.flags & FIDF_DEFAULTVALID)) {
CreateFromFontSettings(&F.deffontsettings, lf);
colour = F.deffontsettings.colour;
@@ -465,7 +465,7 @@ static INT_PTR sttGetEffectWorker(EffectIDW *effect_id, FONTEFFECT *effect)
{
for (int i = 0; i < effect_id_list.getCount(); i++) {
EffectInternal& E = effect_id_list[i];
- if (!_tcsncmp(E.name, effect_id->name, SIZEOF(E.name)) && !_tcsncmp(E.group, effect_id->group, SIZEOF(E.group))) {
+ if (!_tcsncmp(E.name, effect_id->name, _countof(E.name)) && !_tcsncmp(E.group, effect_id->group, _countof(E.group))) {
FONTEFFECT temp;
UpdateEffectSettings(effect_id, &temp);
diff --git a/src/mir_app/src/skin2opts.cpp b/src/mir_app/src/skin2opts.cpp
index 4c9e7ede0e..b33c2fc876 100644
--- a/src/mir_app/src/skin2opts.cpp
+++ b/src/mir_app/src/skin2opts.cpp
@@ -49,7 +49,7 @@ static HICON ExtractIconFromPath(const TCHAR *path, int cxIcon, int cyIcon)
if (!path)
return (HICON)NULL;
- mir_tstrncpy(file, path, SIZEOF(file));
+ mir_tstrncpy(file, path, _countof(file));
comma = _tcsrchr(file, ',');
if (!comma)
n = 0;
@@ -118,7 +118,7 @@ static void __fastcall MySetCursor(TCHAR* nCursor)
static void LoadSectionIcons(TCHAR *filename, SectionItem* sectionActive)
{
TCHAR path[MAX_PATH];
- mir_sntprintf(path, SIZEOF(path), _T("%s,"), filename);
+ mir_sntprintf(path, _countof(path), _T("%s,"), filename);
size_t suffIndx = mir_tstrlen(path);
mir_cslock lck(csIconList);
@@ -250,7 +250,7 @@ static TCHAR* OpenFileDlg(HWND hParent, const TCHAR* szFile, BOOL bAll)
ofn.lpstrFilter = filter;
ofn.lpstrDefExt = _T("dll");
- mir_tstrncpy(file, szFile, SIZEOF(file));
+ mir_tstrncpy(file, szFile, _countof(file));
ofn.lpstrFile = file;
ofn.Flags = OFN_FILEMUSTEXIST | OFN_HIDEREADONLY | OFN_DONTADDTORECENT;
ofn.nMaxFile = MAX_PATH * 2;
@@ -317,7 +317,7 @@ static HTREEITEM FindNamedTreeItemAt(HWND hwndTree, HTREEITEM hItem, const TCHAR
tvi.mask = TVIF_TEXT;
tvi.pszText = str;
- tvi.cchTextMax = SIZEOF(str);
+ tvi.cchTextMax = _countof(str);
while (tvi.hItem) {
TreeView_GetItem(hwndTree, &tvi);
@@ -398,7 +398,7 @@ INT_PTR CALLBACK DlgProcIconImport(HWND hwndDlg, UINT msg, WPARAM wParam, LPARAM
ImageList_RemoveAll(hIml);
TCHAR filename[MAX_PATH], caption[64];
- GetDlgItemText(hwndDlg, IDC_ICONSET, filename, SIZEOF(filename));
+ GetDlgItemText(hwndDlg, IDC_ICONSET, filename, _countof(filename));
{
RECT rcPreview, rcGroup;
@@ -418,7 +418,7 @@ INT_PTR CALLBACK DlgProcIconImport(HWND hwndDlg, UINT msg, WPARAM wParam, LPARAM
lvi.iItem = 0;
int count = (int)_ExtractIconEx(filename, -1, 16, 16, NULL, LR_DEFAULTCOLOR);
for (int i = 0; i < count; lvi.iItem++, i++) {
- mir_sntprintf(caption, SIZEOF(caption), _T("%d"), i + 1);
+ mir_sntprintf(caption, _countof(caption), _T("%d"), i + 1);
lvi.pszText = caption;
HICON hIcon = NULL;
@@ -438,7 +438,7 @@ INT_PTR CALLBACK DlgProcIconImport(HWND hwndDlg, UINT msg, WPARAM wParam, LPARAM
case IDC_BROWSE:
{
TCHAR str[MAX_PATH], *file;
- GetDlgItemText(hwndDlg, IDC_ICONSET, str, SIZEOF(str));
+ GetDlgItemText(hwndDlg, IDC_ICONSET, str, _countof(str));
if (!(file = OpenFileDlg(GetParent(hwndDlg), str, TRUE)))
break;
SetDlgItemText(hwndDlg, IDC_ICONSET, file);
@@ -515,12 +515,12 @@ INT_PTR CALLBACK DlgProcIconImport(HWND hwndDlg, UINT msg, WPARAM wParam, LPARAM
TCHAR path[MAX_PATH], fullPath[MAX_PATH], filename[MAX_PATH];
LVITEM lvi;
- GetDlgItemText(hwndDlg, IDC_ICONSET, fullPath, SIZEOF(fullPath));
+ GetDlgItemText(hwndDlg, IDC_ICONSET, fullPath, _countof(fullPath));
PathToRelativeT(fullPath, filename);
lvi.mask = LVIF_PARAM;
lvi.iItem = dragItem; lvi.iSubItem = 0;
ListView_GetItem(hPreview, &lvi);
- mir_sntprintf(path, SIZEOF(path), _T("%s,%d"), filename, (int)lvi.lParam);
+ mir_sntprintf(path, _countof(path), _T("%s,%d"), filename, (int)lvi.lParam);
SendMessage(hwndParent, DM_CHANGEICON, dropHiLite, (LPARAM)path);
ListView_SetItemState(GetDlgItem(hwndParent, IDC_PREVIEW), dropHiLite, 0, LVIS_DROPHILITED);
}
diff --git a/src/mir_app/src/skinicons.cpp b/src/mir_app/src/skinicons.cpp
index 410b30a1d9..ccf499ef6b 100644
--- a/src/mir_app/src/skinicons.cpp
+++ b/src/mir_app/src/skinicons.cpp
@@ -229,12 +229,12 @@ MIR_APP_DLL(HICON) Skin_LoadProtoIcon(const char *szProto, int status, bool big)
caps2 = 0;
if (IsStatusConnecting(status)) {
- mir_snprintf(iconName, SIZEOF(iconName), "%s%d", mainIconsFmt, 7);
+ mir_snprintf(iconName, _countof(iconName), "%s%d", mainIconsFmt, 7);
return IcoLib_GetIcon(iconName, big);
}
int statusIndx = -1;
- for (int i = 0; i < SIZEOF(statusIcons); i++)
+ for (int i = 0; i < _countof(statusIcons); i++)
if (statusIcons[i].id == status) {
statusIndx = i;
break;
@@ -248,7 +248,7 @@ MIR_APP_DLL(HICON) Skin_LoadProtoIcon(const char *szProto, int status, bool big)
// Otherwise return the global icon. This affects the global status menu mainly.
if (accounts.getCount() == 1) {
// format: core_status_%proto%statusindex
- mir_snprintf(iconName, SIZEOF(iconName), "%s%s%d", statusIconsFmt, szProto, statusIndx);
+ mir_snprintf(iconName, _countof(iconName), "%s%s%d", statusIconsFmt, szProto, statusIndx);
HICON hIcon = IcoLib_GetIcon(iconName, big);
if (hIcon)
@@ -256,24 +256,24 @@ MIR_APP_DLL(HICON) Skin_LoadProtoIcon(const char *szProto, int status, bool big)
}
// format: core_status_%s%d
- mir_snprintf(iconName, SIZEOF(iconName), "%s%s%d", statusIconsFmt, GLOBAL_PROTO_NAME, statusIndx);
+ mir_snprintf(iconName, _countof(iconName), "%s%s%d", statusIconsFmt, GLOBAL_PROTO_NAME, statusIndx);
return IcoLib_GetIcon(iconName, big);
}
// format: core_status_%s%d
- mir_snprintf(iconName, SIZEOF(iconName), "%s%s%d", statusIconsFmt, szProto, statusIndx);
+ mir_snprintf(iconName, _countof(iconName), "%s%s%d", statusIconsFmt, szProto, statusIndx);
HICON hIcon = IcoLib_GetIcon(iconName, big);
if (hIcon == NULL && (caps2 == 0 || (caps2 & statusIcons[statusIndx].pf2))) {
PROTOACCOUNT *pa = Proto_GetAccount(szProto);
if (pa) {
TCHAR szPath[MAX_PATH], szFullPath[MAX_PATH], *str;
- GetModuleFileName(NULL, szPath, SIZEOF(szPath));
+ GetModuleFileName(NULL, szPath, _countof(szPath));
//
// Queried protocol isn't in list, adding
//
TCHAR tszSection[MAX_PATH];
- mir_sntprintf(tszSection, SIZEOF(tszSection), _T(PROTOCOLS_PREFIX)_T("/%s"), pa->tszAccountName);
+ mir_sntprintf(tszSection, _countof(tszSection), _T(PROTOCOLS_PREFIX)_T("/%s"), pa->tszAccountName);
SKINICONDESC sid = { 0 };
sid.section.t = tszSection;
@@ -282,11 +282,11 @@ MIR_APP_DLL(HICON) Skin_LoadProtoIcon(const char *szProto, int status, bool big)
str = _tcsrchr(szPath, '\\');
if (str != NULL)
*str = 0;
- mir_sntprintf(szFullPath, SIZEOF(szFullPath), _T("%s\\Icons\\proto_%S.dll"), szPath, pa->szProtoName);
+ mir_sntprintf(szFullPath, _countof(szFullPath), _T("%s\\Icons\\proto_%S.dll"), szPath, pa->szProtoName);
if (GetFileAttributes(szFullPath) != INVALID_FILE_ATTRIBUTES)
sid.defaultFile.t = szFullPath;
else {
- mir_sntprintf(szFullPath, SIZEOF(szFullPath), _T("%s\\Plugins\\%S.dll"), szPath, szProto);
+ mir_sntprintf(szFullPath, _countof(szFullPath), _T("%s\\Plugins\\%S.dll"), szPath, szProto);
if (int(ExtractIconEx(szFullPath, statusIcons[statusIndx].resource_id, NULL, &hIcon, 1)) > 0) {
DestroyIcon(hIcon);
sid.defaultFile.t = szFullPath;
@@ -308,12 +308,12 @@ MIR_APP_DLL(HICON) Skin_LoadProtoIcon(const char *szProto, int status, bool big)
if (caps2 == 0)
lowidx = statusIndx, highidx = statusIndx + 1;
else
- lowidx = 0, highidx = SIZEOF(statusIcons);
+ lowidx = 0, highidx = _countof(statusIcons);
for (int i = lowidx; i < highidx; i++)
if (caps2 == 0 || (caps2 & statusIcons[i].pf2)) {
// format: core_%s%d
- mir_snprintf(iconName, SIZEOF(iconName), "%s%s%d", statusIconsFmt, szProto, i);
+ mir_snprintf(iconName, _countof(iconName), "%s%s%d", statusIconsFmt, szProto, i);
sid.pszName = iconName;
sid.description.t = cli.pfnGetStatusModeDescription(statusIcons[i].id, 0);
sid.iDefaultIndex = statusIcons[i].resource_id;
@@ -322,14 +322,14 @@ MIR_APP_DLL(HICON) Skin_LoadProtoIcon(const char *szProto, int status, bool big)
}
// format: core_status_%s%d
- mir_snprintf(iconName, SIZEOF(iconName), "%s%s%d", statusIconsFmt, szProto, statusIndx);
+ mir_snprintf(iconName, _countof(iconName), "%s%s%d", statusIconsFmt, szProto, statusIndx);
hIcon = IcoLib_GetIcon(iconName, big);
if (hIcon)
return hIcon;
}
if (hIcon == NULL) {
- mir_snprintf(iconName, SIZEOF(iconName), "%s%s%d", statusIconsFmt, GLOBAL_PROTO_NAME, statusIndx);
+ mir_snprintf(iconName, _countof(iconName), "%s%s%d", statusIconsFmt, GLOBAL_PROTO_NAME, statusIndx);
hIcon = IcoLib_GetIcon(iconName, big);
}
@@ -338,7 +338,7 @@ MIR_APP_DLL(HICON) Skin_LoadProtoIcon(const char *szProto, int status, bool big)
MIR_APP_DLL(HANDLE) Skin_GetIconHandle(int idx)
{
- for (int i = 0; i < SIZEOF(mainIcons); i++)
+ for (int i = 0; i < _countof(mainIcons); i++)
if (idx == mainIcons[i].id)
return mainIcons[i].hIcolib;
@@ -349,9 +349,9 @@ MIR_APP_DLL(char*) Skin_GetIconName(int idx)
{
static char szIconName[100];
- for (int i = 0; i < SIZEOF(mainIcons); i++) {
+ for (int i = 0; i < _countof(mainIcons); i++) {
if (idx == mainIcons[i].id) {
- mir_snprintf(szIconName, SIZEOF(szIconName), "%s%d", mainIconsFmt, i);
+ mir_snprintf(szIconName, _countof(szIconName), "%s%d", mainIconsFmt, i);
return szIconName;
}
}
@@ -362,7 +362,7 @@ MIR_APP_DLL(HICON) Skin_LoadIcon(int idx, bool big)
{
// Query for global status icons
if (idx < SKINICON_EVENT_MESSAGE) {
- if (idx >= SIZEOF(statusIcons))
+ if (idx >= _countof(statusIcons))
return NULL;
return Skin_LoadProtoIcon(NULL, statusIcons[idx].id, big);
@@ -377,7 +377,7 @@ MIR_APP_DLL(HICON) Skin_LoadIcon(int idx, bool big)
int LoadSkinIcons(void)
{
TCHAR modulePath[MAX_PATH];
- GetModuleFileName(g_hInst, modulePath, SIZEOF(modulePath));
+ GetModuleFileName(g_hInst, modulePath, _countof(modulePath));
char iconName[MAX_PATH];
SKINICONDESC sid = { 0 };
@@ -386,8 +386,8 @@ int LoadSkinIcons(void)
sid.pszName = iconName;
// Add main icons to list
- for (int i = 0; i < SIZEOF(mainIcons); i++) {
- mir_snprintf(iconName, SIZEOF(iconName), "%s%d", mainIconsFmt, i);
+ for (int i = 0; i < _countof(mainIcons); i++) {
+ mir_snprintf(iconName, _countof(iconName), "%s%d", mainIconsFmt, i);
sid.section.a = mainIcons[i].section == NULL ? LPGEN("Main icons") : (char*)mainIcons[i].section;
sid.description.a = (char*)mainIcons[i].description;
sid.iDefaultIndex = mainIcons[i].resource_id;
@@ -399,8 +399,8 @@ int LoadSkinIcons(void)
// Asterisk is used, to avoid conflict with proto-plugins
// 'coz users can't rename it to name with '*'
- for (int i = 0; i < SIZEOF(statusIcons); i++) {
- mir_snprintf(iconName, SIZEOF(iconName), "%s%s%d", statusIconsFmt, GLOBAL_PROTO_NAME, i);
+ for (int i = 0; i < _countof(statusIcons); i++) {
+ mir_snprintf(iconName, _countof(iconName), "%s%s%d", statusIconsFmt, GLOBAL_PROTO_NAME, i);
sid.pszName = iconName;
sid.description.a = (char*)statusIcons[i].description;
sid.iDefaultIndex = statusIcons[i].resource_id;
diff --git a/src/mir_app/src/sounds.cpp b/src/mir_app/src/sounds.cpp
index 712a39441f..0fb366e812 100644
--- a/src/mir_app/src/sounds.cpp
+++ b/src/mir_app/src/sounds.cpp
@@ -307,9 +307,9 @@ INT_PTR CALLBACK DlgProcSoundOpts(HWND hwndDlg, UINT msg, WPARAM wParam, LPARAM
OPENFILENAME ofn;
memset(&ofn, 0, sizeof(ofn));
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("WAV files"), 0, 0, TranslateT("All files"), 0, 0);
+ mir_sntprintf(filter, _countof(filter), _T("%s (*.wav)%c*.wav%c%s (*)%c*%c"), TranslateT("WAV files"), 0, 0, TranslateT("All files"), 0, 0);
ofn.lStructSize = OPENFILENAME_SIZE_VERSION_400;
ofn.hwndOwner = GetParent(hwndDlg);
ofn.hInstance = NULL;
@@ -324,7 +324,7 @@ INT_PTR CALLBACK DlgProcSoundOpts(HWND hwndDlg, UINT msg, WPARAM wParam, LPARAM
str[0] = 0;
ofn.lpstrFile = str;
ofn.Flags = OFN_FILEMUSTEXIST|OFN_HIDEREADONLY|OFN_EXPLORER|OFN_LONGNAMES|OFN_NOCHANGEDIR;
- ofn.nMaxFile = SIZEOF(str);
+ ofn.nMaxFile = _countof(str);
ofn.nMaxFileTitle = MAX_PATH;
ofn.lpstrDefExt = _T("wav");
if (!GetOpenFileName(&ofn))
diff --git a/src/mir_app/src/utils.cpp b/src/mir_app/src/utils.cpp
index cba82ce12d..c78dcf7af0 100644
--- a/src/mir_app/src/utils.cpp
+++ b/src/mir_app/src/utils.cpp
@@ -298,7 +298,7 @@ static CountryListEntry countries[] = {
static INT_PTR GetCountryByNumber(WPARAM wParam, LPARAM)
{
- for (int i = 0; i < SIZEOF(countries); i++)
+ for (int i = 0; i < _countof(countries); i++)
if ((int)wParam == countries[i].id)
return (INT_PTR)countries[i].szName;
@@ -307,7 +307,7 @@ static INT_PTR GetCountryByNumber(WPARAM wParam, LPARAM)
static INT_PTR GetCountryByISOCode(WPARAM wParam, LPARAM)
{
- for (int i = 0; i < SIZEOF(countries); i++)
+ for (int i = 0; i < _countof(countries); i++)
if ( mir_strcmpi((char*)wParam, countries[i].ISOcode) == 0)
return (INT_PTR)countries[i].szName;
@@ -316,7 +316,7 @@ static INT_PTR GetCountryByISOCode(WPARAM wParam, LPARAM)
static INT_PTR GetCountryList(WPARAM wParam, LPARAM lParam)
{
- *(int*)wParam = SIZEOF(countries);
+ *(int*)wParam = _countof(countries);
*(CountryListEntry**)lParam = countries;
return 0;
}
@@ -329,12 +329,12 @@ static INT_PTR RestartMiranda(WPARAM wParam, LPARAM)
PROCESS_INFORMATION pi;
STARTUPINFO si = {0};
si.cb = sizeof(si);
- GetModuleFileName(NULL, mirandaPath, SIZEOF(mirandaPath));
+ GetModuleFileName(NULL, mirandaPath, _countof(mirandaPath));
if (wParam) {
VARST profilename( _T("%miranda_profilename%"));
- mir_sntprintf(cmdLine, SIZEOF(cmdLine), _T("\"%s\" /restart:%d /profile=%s"), mirandaPath, GetCurrentProcessId(), (TCHAR*)profilename);
+ mir_sntprintf(cmdLine, _countof(cmdLine), _T("\"%s\" /restart:%d /profile=%s"), mirandaPath, GetCurrentProcessId(), (TCHAR*)profilename);
}
- else mir_sntprintf(cmdLine, SIZEOF(cmdLine), _T("\"%s\" /restart:%d"), mirandaPath, GetCurrentProcessId());
+ else mir_sntprintf(cmdLine, _countof(cmdLine), _T("\"%s\" /restart:%d"), mirandaPath, GetCurrentProcessId());
CallService("CloseAction", 0, 0);
CreateProcess(mirandaPath, cmdLine, NULL, NULL, FALSE, 0, NULL, NULL, &si, &pi);
diff --git a/src/mir_app/src/visibility.cpp b/src/mir_app/src/visibility.cpp
index 447bac6beb..212434ec7d 100644
--- a/src/mir_app/src/visibility.cpp
+++ b/src/mir_app/src/visibility.cpp
@@ -40,7 +40,7 @@ static void SetListGroupIcons(HWND hwndList, HANDLE hFirstItem, HANDLE hParentIt
while (hItem) {
HANDLE hChildItem = (HANDLE)SendMessage(hwndList, CLM_GETNEXTITEM, CLGN_CHILD, (LPARAM)hItem);
if (hChildItem) SetListGroupIcons(hwndList, hChildItem, hItem, childCount);
- for (int i=0; i < SIZEOF(iconOn); i++)
+ for (int 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);
}
@@ -50,7 +50,7 @@ static void SetListGroupIcons(HWND hwndList, HANDLE hFirstItem, HANDLE hParentIt
else
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 iImage = SendMessage(hwndList, CLM_GETEXTRAIMAGE, (WPARAM)hItem, i);
if (iconOn[i] && iImage == 0) iconOn[i] = 0;
if (iImage != EMPTY_EXTRA_ICON)
@@ -59,7 +59,7 @@ static void SetListGroupIcons(HWND hwndList, HANDLE hFirstItem, HANDLE hParentIt
hItem = (HANDLE)SendMessage(hwndList, CLM_GETNEXTITEM, CLGN_NEXTCONTACT, (LPARAM)hItem);
}
//set icons
- for (int i=0; i < SIZEOF(iconOn); i++) {
+ for (int i=0; i < _countof(iconOn); i++) {
SendMessage(hwndList, CLM_SETEXTRAIMAGE, (WPARAM)hParentItem, MAKELPARAM(i, childCount[i]?(iconOn[i]?i+1:0):EMPTY_EXTRA_ICON));
if (groupChildCount) groupChildCount[i]+=childCount[i];
}
diff --git a/src/mir_app/src/xmlParser.cpp b/src/mir_app/src/xmlParser.cpp
index be360ea40f..8911efec03 100644
--- a/src/mir_app/src/xmlParser.cpp
+++ b/src/mir_app/src/xmlParser.cpp
@@ -402,7 +402,7 @@ XMLNode XMLNode::openFileHelper(XMLCSTR filename, XMLCSTR tag)
// create message
char message[2000], *s1 = (char*)"", *s3 = (char*)""; XMLCSTR s2 = _CXML("");
if (pResults.error == eXMLErrorFirstTagNotFound) { s1 = (char*)"First Tag should be '"; s2 = tag; s3 = (char*)"'.\n"; }
- mir_snprintf(message, SIZEOF(message),
+ mir_snprintf(message, _countof(message),
#ifdef _XMLWIDECHAR
"XML Parsing error inside file '%S'.\n%S\nAt line %i, column %i.\n%s%S%s"
#else
diff --git a/src/mir_core/src/langpack.cpp b/src/mir_core/src/langpack.cpp
index cfc656afd2..9f048b21ec 100644
--- a/src/mir_core/src/langpack.cpp
+++ b/src/mir_core/src/langpack.cpp
@@ -219,7 +219,7 @@ static void LoadLangPackFile(FILE *fp, char *line)
TCHAR *p = _tcsrchr(langPack.tszFullPath, '\\');
if (p)
*p = 0;
- mir_sntprintf(tszFileName, SIZEOF(tszFileName), _T("%s\\%S"), langPack.tszFullPath, ltrim(line + 9));
+ mir_sntprintf(tszFileName, _countof(tszFileName), _T("%s\\%S"), langPack.tszFullPath, ltrim(line + 9));
if (p)
*p = '\\';
@@ -361,9 +361,9 @@ static int LoadLangDescr(LANGPACK_INFO &lpinfo, FILE *fp, char *line, int &start
lpinfo.szAuthors = szAuthors;
- MultiByteToWideChar(lpinfo.codepage, 0, szLanguage, -1, lpinfo.tszLanguage, SIZEOF(lpinfo.tszLanguage));
+ MultiByteToWideChar(lpinfo.codepage, 0, szLanguage, -1, lpinfo.tszLanguage, _countof(lpinfo.tszLanguage));
- if (!lpinfo.tszLanguage[0] && (lpinfo.Locale == 0) || !GetLocaleInfo(lpinfo.Locale, LOCALE_SENGLANGUAGE, lpinfo.tszLanguage, SIZEOF(lpinfo.tszLanguage))) {
+ if (!lpinfo.tszLanguage[0] && (lpinfo.Locale == 0) || !GetLocaleInfo(lpinfo.Locale, LOCALE_SENGLANGUAGE, lpinfo.tszLanguage, _countof(lpinfo.tszLanguage))) {
TCHAR *p = _tcschr(lpinfo.tszFileName, '_');
_tcsncpy_s(lpinfo.tszLanguage, ((p != NULL) ? (p + 1) : lpinfo.tszFileName), _TRUNCATE);
p = _tcsrchr(lpinfo.tszLanguage, _T('.'));
@@ -380,7 +380,7 @@ MIR_CORE_DLL(int) LoadLangPack(const TCHAR *ptszLangPack)
// ensure that a lang's name is a full file name
TCHAR tszFullPath[MAX_PATH];
if (!PathIsAbsoluteT(ptszLangPack))
- mir_sntprintf(tszFullPath, SIZEOF(tszFullPath), _T("%s\\%s"), g_tszRoot, ptszLangPack);
+ mir_sntprintf(tszFullPath, _countof(tszFullPath), _T("%s\\%s"), g_tszRoot, ptszLangPack);
else
_tcsncpy_s(tszFullPath, ptszLangPack, _TRUNCATE);
@@ -527,7 +527,7 @@ MIR_CORE_DLL(void) TranslateMenu_LP(HMENU hMenu, int hLangpack)
TCHAR str[256];
mii.fMask = MIIM_TYPE | MIIM_SUBMENU;
mii.dwTypeData = (TCHAR*)str;
- mii.cch = SIZEOF(str);
+ mii.cch = _countof(str);
GetMenuItemInfo(hMenu, i, TRUE, &mii);
if (mii.cch && mii.dwTypeData) {
@@ -547,7 +547,7 @@ MIR_CORE_DLL(void) TranslateMenu_LP(HMENU hMenu, int hLangpack)
static void TranslateWindow(MUUID *pUuid, HWND hwnd)
{
TCHAR title[2048];
- GetWindowText(hwnd, title, SIZEOF(title));
+ GetWindowText(hwnd, title, _countof(title));
TCHAR *result = (TCHAR*)LangPackTranslateString(pUuid, (const char*)title, TRUE);
if (result != title)
@@ -566,7 +566,7 @@ static BOOL CALLBACK TranslateDialogEnumProc(HWND hwnd, LPARAM lParam)
MUUID *uuid = Langpack_LookupUuid(hLangpack);
TCHAR szClass[32];
- GetClassName(hwnd, szClass, SIZEOF(szClass));
+ GetClassName(hwnd, szClass, _countof(szClass));
if (!mir_tstrcmpi(szClass, _T("static")) || !mir_tstrcmpi(szClass, _T("hyperlink")) || !mir_tstrcmpi(szClass, _T("button")) || !mir_tstrcmpi(szClass, _T("MButtonClass")) || !mir_tstrcmpi(szClass, _T("MHeaderbarCtrl")))
TranslateWindow(uuid, hwnd);
else if (!mir_tstrcmpi(szClass, _T("edit"))) {
@@ -643,7 +643,7 @@ void GetDefaultLang()
// look into mirandaboot.ini
TCHAR tszPath[MAX_PATH], tszLangName[256];
PathToAbsoluteT(_T("\\mirandaboot.ini"), tszPath);
- GetPrivateProfileString(_T("Language"), _T("DefaultLanguage"), _T(""), tszLangName, SIZEOF(tszLangName), tszPath);
+ GetPrivateProfileString(_T("Language"), _T("DefaultLanguage"), _T(""), tszLangName, _countof(tszLangName), tszPath);
if (tszLangName[0]) {
if (!mir_tstrcmpi(tszLangName, _T("default"))) {
db_set_ts(NULL, "Langpack", "Current", _T("default"));
@@ -656,8 +656,8 @@ void GetDefaultLang()
}
// try to load langpack that matches UserDefaultUILanguage
- if (GetLocaleInfo(MAKELCID(GetUserDefaultUILanguage(), SORT_DEFAULT), LOCALE_SENGLANGUAGE, tszLangName, SIZEOF(tszLangName))) {
- mir_sntprintf(tszPath, SIZEOF(tszPath), _T("langpack_%s.txt"), _tcslwr(tszLangName));
+ if (GetLocaleInfo(MAKELCID(GetUserDefaultUILanguage(), SORT_DEFAULT), LOCALE_SENGLANGUAGE, tszLangName, _countof(tszLangName))) {
+ mir_sntprintf(tszPath, _countof(tszPath), _T("langpack_%s.txt"), _tcslwr(tszLangName));
if (!LoadLangPack(tszPath)) {
db_set_ts(NULL, "Langpack", "Current", tszPath);
return;
@@ -665,7 +665,7 @@ void GetDefaultLang()
}
// finally try to load first file
- mir_sntprintf(tszPath, SIZEOF(tszPath), _T("%s\\langpack_*.txt"), g_tszRoot);
+ mir_sntprintf(tszPath, _countof(tszPath), _T("%s\\langpack_*.txt"), g_tszRoot);
WIN32_FIND_DATA fd;
HANDLE hFind = FindFirstFile(tszPath, &fd);
diff --git a/src/mir_core/src/path.cpp b/src/mir_core/src/path.cpp
index e9fb81c672..051295984b 100644
--- a/src/mir_core/src/path.cpp
+++ b/src/mir_core/src/path.cpp
@@ -78,7 +78,7 @@ MIR_CORE_DLL(int) PathToAbsolute(const char *pSrc, char *pOut, const char *base)
if (pSrc[0] == '\\')
pSrc++;
mir_snprintf(buf, "%s%s", base, pSrc);
- return GetFullPathNameA(buf, SIZEOF(buf), pOut, NULL);
+ return GetFullPathNameA(buf, _countof(buf), pOut, NULL);
}
MIR_CORE_DLL(void) CreatePathToFile(char *szFilePath)
@@ -101,7 +101,7 @@ MIR_CORE_DLL(int) CreateDirectoryTree(const char *szDir)
return 1;
char szTestDir[MAX_PATH];
- mir_strncpy(szTestDir, szDir, SIZEOF(szTestDir));
+ mir_strncpy(szTestDir, szDir, _countof(szTestDir));
DWORD dwAttributes = GetFileAttributesA(szTestDir);
if (dwAttributes != INVALID_FILE_ATTRIBUTES && (dwAttributes & FILE_ATTRIBUTE_DIRECTORY))
@@ -191,7 +191,7 @@ MIR_CORE_DLL(int) CreateDirectoryTreeW(const WCHAR *szDir)
return 1;
WCHAR szTestDir[MAX_PATH];
- mir_wstrncpy(szTestDir, szDir, SIZEOF(szTestDir));
+ mir_wstrncpy(szTestDir, szDir, _countof(szTestDir));
DWORD dwAttributes = GetFileAttributesW(szTestDir);
if (dwAttributes != INVALID_FILE_ATTRIBUTES && (dwAttributes & FILE_ATTRIBUTE_DIRECTORY))
@@ -209,12 +209,12 @@ MIR_CORE_DLL(int) CreateDirectoryTreeW(const WCHAR *szDir)
int InitPathUtils(void)
{
- GetModuleFileNameA(NULL, szMirandaPath, SIZEOF(szMirandaPath));
+ GetModuleFileNameA(NULL, szMirandaPath, _countof(szMirandaPath));
char *p = strrchr(szMirandaPath, '\\');
if (p)
p[1] = 0;
- GetModuleFileNameW(NULL, szMirandaPathW, SIZEOF(szMirandaPathW));
+ GetModuleFileNameW(NULL, szMirandaPathW, _countof(szMirandaPathW));
WCHAR *tp = wcsrchr(szMirandaPathW, '\\');
if (tp)
tp[1] = 0;
diff --git a/src/mir_core/src/timezones.cpp b/src/mir_core/src/timezones.cpp
index b9510f2a71..df5958fe7b 100644
--- a/src/mir_core/src/timezones.cpp
+++ b/src/mir_core/src/timezones.cpp
@@ -130,11 +130,11 @@ void FormatTime(const SYSTEMTIME *st, const TCHAR *szFormat, TCHAR *szDest, size
if (iso)
tszTemp.AppendFormat(_T("%d-%02d-%02dT%02d:%02d:%02dZ"), st->wYear, st->wMonth, st->wDay, st->wHour, st->wMinute, st->wSecond);
else if (date) {
- GetDateFormat(LOCALE_USER_DEFAULT, fmt, st, NULL, dateTimeStr, SIZEOF(dateTimeStr));
+ GetDateFormat(LOCALE_USER_DEFAULT, fmt, st, NULL, dateTimeStr, _countof(dateTimeStr));
tszTemp.Append(dateTimeStr);
}
else {
- GetTimeFormat(LOCALE_USER_DEFAULT, fmt, st, NULL, dateTimeStr, SIZEOF(dateTimeStr));
+ GetTimeFormat(LOCALE_USER_DEFAULT, fmt, st, NULL, dateTimeStr, _countof(dateTimeStr));
tszTemp.Append(dateTimeStr);
}
}
@@ -382,7 +382,7 @@ static const ListMessages* GetListMessages(HWND hWnd, DWORD dwFlags)
if (!(dwFlags & (TZF_PLF_CB | TZF_PLF_LB))) {
TCHAR tszClassName[128];
- GetClassName(hWnd, tszClassName, SIZEOF(tszClassName));
+ GetClassName(hWnd, tszClassName, _countof(tszClassName));
if (!mir_tstrcmpi(tszClassName, _T("COMBOBOX")))
dwFlags |= TZF_PLF_CB;
else if (!mir_tstrcmpi(tszClassName, _T("LISTBOX")))
@@ -548,7 +548,7 @@ void InitTimeZones(void)
HKEY hSubKey;
TCHAR tszName[MIM_TZ_NAMELEN];
- DWORD dwSize = SIZEOF(tszName);
+ DWORD dwSize = _countof(tszName);
while (ERROR_NO_MORE_ITEMS != RegEnumKeyEx(hKey, dwIndex++, tszName, &dwSize, NULL, NULL, 0, NULL)) {
if (ERROR_SUCCESS == RegOpenKeyEx(hKey, tszName, 0, KEY_QUERY_VALUE, &hSubKey)) {
dwSize = sizeof(tszName);
@@ -569,16 +569,16 @@ void InitTimeZones(void)
tz->hash = mir_hashstrT(tszName);
tz->offset = INT_MIN;
- GetLocalizedString(hSubKey, _T("Display"), tz->szDisplay, SIZEOF(tz->szDisplay));
- GetLocalizedString(hSubKey, _T("Std"), tz->tzi.StandardName, SIZEOF(tz->tzi.StandardName));
- GetLocalizedString(hSubKey, _T("Dlt"), tz->tzi.DaylightName, SIZEOF(tz->tzi.DaylightName));
+ GetLocalizedString(hSubKey, _T("Display"), tz->szDisplay, _countof(tz->szDisplay));
+ GetLocalizedString(hSubKey, _T("Std"), tz->tzi.StandardName, _countof(tz->tzi.StandardName));
+ GetLocalizedString(hSubKey, _T("Dlt"), tz->tzi.DaylightName, _countof(tz->tzi.DaylightName));
g_timezones.insert(tz);
g_timezonesBias.insert(tz);
RegCloseKey(hSubKey);
}
- dwSize = SIZEOF(tszName);
+ dwSize = _countof(tszName);
}
RegCloseKey(hKey);
}
diff --git a/src/mir_core/src/ui_utils.cpp b/src/mir_core/src/ui_utils.cpp
index be5e6df89d..f786afe73a 100644
--- a/src/mir_core/src/ui_utils.cpp
+++ b/src/mir_core/src/ui_utils.cpp
@@ -1403,7 +1403,7 @@ HTREEITEM CCtrlTreeView::MoveItemAbove(HTREEITEM hItem, HTREEITEM hInsertAfter)
TVINSERTSTRUCT tvis = { 0 };
tvis.itemex.mask = (UINT)-1;
tvis.itemex.pszText = name;
- tvis.itemex.cchTextMax = SIZEOF(name);
+ tvis.itemex.cchTextMax = _countof(name);
tvis.itemex.hItem = hItem;
if (!GetItem(&tvis.itemex))
return NULL;
@@ -1628,7 +1628,7 @@ void CCtrlTreeView::TranslateItem(HTREEITEM hItem)
{
TVITEMEX tvi;
TCHAR buf[128];
- GetItem(hItem, &tvi, buf, SIZEOF(buf));
+ GetItem(hItem, &tvi, buf, _countof(buf));
tvi.pszText = TranslateTS(tvi.pszText);
SetItem(&tvi);
}
@@ -1672,7 +1672,7 @@ HTREEITEM CCtrlTreeView::FindNamedItem(HTREEITEM hItem, const TCHAR *name)
tvi.mask = TVIF_TEXT;
tvi.pszText = str;
- tvi.cchTextMax = SIZEOF(str);
+ tvi.cchTextMax = _countof(str);
while (tvi.hItem) {
GetItem(&tvi);
diff --git a/src/mir_core/src/winutil.cpp b/src/mir_core/src/winutil.cpp
index 0dd0a2e897..e0aeb7c803 100644
--- a/src/mir_core/src/winutil.cpp
+++ b/src/mir_core/src/winutil.cpp
@@ -31,16 +31,16 @@ MIR_CORE_DLL(int) Utils_SaveWindowPosition(HWND hwnd, MCONTACT hContact, const c
GetWindowPlacement(hwnd, &wp);
char szSettingName[64];
- mir_snprintf(szSettingName, SIZEOF(szSettingName), "%sx", szNamePrefix);
+ mir_snprintf(szSettingName, _countof(szSettingName), "%sx", szNamePrefix);
db_set_dw(hContact, szModule, szSettingName, wp.rcNormalPosition.left);
- mir_snprintf(szSettingName, SIZEOF(szSettingName), "%sy", szNamePrefix);
+ mir_snprintf(szSettingName, _countof(szSettingName), "%sy", szNamePrefix);
db_set_dw(hContact, szModule, szSettingName, wp.rcNormalPosition.top);
- mir_snprintf(szSettingName, SIZEOF(szSettingName), "%swidth", szNamePrefix);
+ mir_snprintf(szSettingName, _countof(szSettingName), "%swidth", szNamePrefix);
db_set_dw(hContact, szModule, 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, szModule, szSettingName, wp.rcNormalPosition.bottom-wp.rcNormalPosition.top);
return 0;
}
@@ -54,12 +54,12 @@ EXTERN_C MIR_CORE_DLL(int) Utils_RestoreWindowPosition(HWND hwnd, MCONTACT hCont
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);
if (x == -1)
return 1;
- mir_snprintf(szSettingName, SIZEOF(szSettingName), "%sy", szNamePrefix);
+ mir_snprintf(szSettingName, _countof(szSettingName), "%sy", szNamePrefix);
int y = (int)db_get_dw(hContact, szModule, szSettingName, -1);
if (flags & RWPF_NOSIZE)
@@ -68,10 +68,10 @@ EXTERN_C MIR_CORE_DLL(int) Utils_RestoreWindowPosition(HWND hwnd, MCONTACT hCont
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/src/mir_core/src/winver.cpp b/src/mir_core/src/winver.cpp
index ffe68b114c..bf40d2a2fa 100644
--- a/src/mir_core/src/winver.cpp
+++ b/src/mir_core/src/winver.cpp
@@ -55,7 +55,7 @@ MIR_CORE_DLL(BOOL) IsFullScreen()
HWND hWnd = GetForegroundWindow();
if (hWnd && hWnd != hWndDesktop && hWnd != hWndShell) {
TCHAR tszClassName[128] = _T("");
- GetClassName(hWnd, tszClassName, SIZEOF(tszClassName));
+ GetClassName(hWnd, tszClassName, _countof(tszClassName));
if (_tcscmp(tszClassName, _T("WorkerW"))) {
RECT rect, rectw, recti;
GetWindowRect(hWnd, &rectw);
@@ -80,7 +80,7 @@ MIR_CORE_DLL(BOOL) IsWorkstationLocked(void)
TCHAR tszName[100];
DWORD cbName;
- BOOL bLocked = (!GetUserObjectInformation(hDesk, UOI_NAME, tszName, SIZEOF(tszName), &cbName) || mir_tstrcmpi(tszName, _T("default")) != 0);
+ BOOL bLocked = (!GetUserObjectInformation(hDesk, UOI_NAME, tszName, _countof(tszName), &cbName) || mir_tstrcmpi(tszName, _T("default")) != 0);
CloseDesktop(hDesk);
return bLocked;
}