From 41a7300678e4bb3cd703e2c236e57af4a31962c7 Mon Sep 17 00:00:00 2001 From: Rozhuk Ivan Date: Mon, 1 Dec 2014 04:50:22 +0000 Subject: mir_snprintf(..., sizeof() -> SIZEOF(), ...) small fixs cleanups git-svn-id: http://svn.miranda-ng.org/main/trunk@11188 1316c22d-e87f-b044-9b9b-93d7a3e3ba9c --- plugins/QuickMessages/src/Utils.cpp | 51 ++++++++++++++++++++----------------- 1 file changed, 27 insertions(+), 24 deletions(-) (limited to 'plugins/QuickMessages/src/Utils.cpp') diff --git a/plugins/QuickMessages/src/Utils.cpp b/plugins/QuickMessages/src/Utils.cpp index 3a9cc46681..2e2d8ec2b7 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,SIZEOF(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,SIZEOF(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,SIZEOF(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,SIZEOF(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,SIZEOF(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,SIZEOF(szMEntry),"ButtonName_%u",buttonnum); db_unset(NULL, PLGNAME,szMEntry); - mir_snprintf(szMEntry,sizeof(szMEntry),"ButtonValue_%u",buttonnum); + mir_snprintf(szMEntry,SIZEOF(szMEntry),"ButtonValue_%u",buttonnum); db_unset(NULL, PLGNAME,szMEntry); - mir_snprintf(szMEntry,sizeof(szMEntry),"RCEntryIsServiceName_%u",buttonnum); + mir_snprintf(szMEntry,SIZEOF(szMEntry),"RCEntryIsServiceName_%u",buttonnum); db_unset(NULL, PLGNAME,szMEntry); } - mir_snprintf(szMEntry,sizeof(szMEntry),"EntryName_%u_%u",buttonnum,from); + mir_snprintf(szMEntry,SIZEOF(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,SIZEOF(szMEntry),"EntryValue_%u_%u",buttonnum,from); db_unset(NULL, PLGNAME,szMEntry); - mir_snprintf(szMEntry,sizeof(szMEntry),"EntryRel_%u_%u",buttonnum,from); + mir_snprintf(szMEntry,SIZEOF(szMEntry),"EntryRel_%u_%u",buttonnum,from); db_unset(NULL, PLGNAME,szMEntry); - mir_snprintf(szMEntry,sizeof(szMEntry),"EntryToQMenu_%u_%u",buttonnum,from); + mir_snprintf(szMEntry,SIZEOF(szMEntry),"EntryToQMenu_%u_%u",buttonnum,from); db_unset(NULL, PLGNAME,szMEntry); - mir_snprintf(szMEntry,sizeof(szMEntry),"EntryIsServiceName_%u_%u",buttonnum,from); + mir_snprintf(szMEntry,SIZEOF(szMEntry),"EntryIsServiceName_%u_%u",buttonnum,from); db_unset(NULL, PLGNAME,szMEntry); - mir_snprintf(szMEntry,sizeof(szMEntry),"EntryName_%u_%u",buttonnum,++from); + mir_snprintf(szMEntry,SIZEOF(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, SIZEOF(szMEntry), "EntryToQMenu_%u_%u", buttonnum, entrynum); break; case 1: - mir_snprintf(szMEntry, sizeof(szMEntry), "EntryRel_%u_%u", buttonnum, entrynum); + mir_snprintf(szMEntry, SIZEOF(szMEntry), "EntryRel_%u_%u", buttonnum, entrynum); break; case 2: - mir_snprintf(szMEntry, sizeof(szMEntry), "EntryIsServiceName_%u_%u", buttonnum, entrynum); + mir_snprintf(szMEntry, SIZEOF(szMEntry), "EntryIsServiceName_%u_%u", buttonnum, entrynum); break; case 3: - mir_snprintf(szMEntry, sizeof(szMEntry), "RCEntryIsServiceName_%u", buttonnum); + mir_snprintf(szMEntry, SIZEOF(szMEntry), "RCEntryIsServiceName_%u", buttonnum); break; } return db_get_b(NULL, PLGNAME, szMEntry, 0); @@ -343,21 +343,24 @@ void DestructButtonsList() TCHAR* getMenuEntry(int buttonnum, int entrynum, BYTE mode) { TCHAR* buffer = NULL; - char szMEntry[256] = {'\0'}; - DBVARIANT dbv = {0}; + char szMEntry[256]; + DBVARIANT dbv; switch (mode) { case 0: - mir_snprintf(szMEntry, sizeof(szMEntry), "EntryName_%u_%u", buttonnum, entrynum); + mir_snprintf(szMEntry, SIZEOF(szMEntry), "EntryName_%u_%u", buttonnum, entrynum); break; case 1: - mir_snprintf(szMEntry, sizeof(szMEntry), "EntryValue_%u_%u", buttonnum, entrynum); + mir_snprintf(szMEntry, SIZEOF(szMEntry), "EntryValue_%u_%u", buttonnum, entrynum); break; case 2: - mir_snprintf(szMEntry, sizeof(szMEntry), "ButtonValue_%u", buttonnum); + mir_snprintf(szMEntry, SIZEOF(szMEntry), "ButtonValue_%u", buttonnum); break; case 3: - mir_snprintf(szMEntry, sizeof(szMEntry), "ButtonName_%u", buttonnum); + mir_snprintf(szMEntry, SIZEOF(szMEntry), "ButtonName_%u", buttonnum); + break; + default: + szMEntry[0] = 0; break; } -- cgit v1.2.3