diff options
80 files changed, 416 insertions, 495 deletions
diff --git a/plugins/BasicHistory/src/EventList.cpp b/plugins/BasicHistory/src/EventList.cpp index 75d835c288..0b6c983a06 100644 --- a/plugins/BasicHistory/src/EventList.cpp +++ b/plugins/BasicHistory/src/EventList.cpp @@ -650,7 +650,7 @@ static void GetAuthRequestDescription( DBEVENTINFO *dbei, TCHAR* buf, int cbBuf  		allName += _T(", ");
  	}
 -	_sntprintf_s(buf, cbBuf, _TRUNCATE, TranslateT("Authorisation request by %s (%s%d): %s"),
 +	mir_sntprintf(buf, cbBuf, TranslateT("Authorisation request by %s (%s%d): %s"),
  		(newNick[0] == 0 ? (TCHAR*)CallService(MS_CLIST_GETCONTACTDISPLAYNAME, (WPARAM) hContact, GCDNF_TCHAR) : newNick),
  		allName.c_str(), uin, newReason);
  	mir_free( newNick );
 @@ -824,7 +824,7 @@ void EventList::AddImporter(HANDLE hContact, IImport::ImportType type, const std  {
  	EnterCriticalSection(&criticalSection);
  	TCHAR buf[32];
 -	_stprintf_s(buf, _T("%016llx"), (unsigned long long int)hContact);
 +	mir_sntprintf(buf, SIZEOF(buf), _T("%016llx"), (unsigned long long int)hContact);
  	std::wstring internalFile = contactFileDir;
  	ImportDiscData data;
  	data.file = contactFileDir + buf;
 diff --git a/plugins/BasicHistory/src/HistoryWindow.cpp b/plugins/BasicHistory/src/HistoryWindow.cpp index 5902dc3de8..ccadabfe9e 100644 --- a/plugins/BasicHistory/src/HistoryWindow.cpp +++ b/plugins/BasicHistory/src/HistoryWindow.cpp @@ -2289,7 +2289,7 @@ void HistoryWindow::Delete(int what)  	if(what == 2)
  		_tcscpy_s(message, TranslateT("This operation will PERMANENTLY REMOVE all history for this contact.\nAre you sure you want to do this?"));
  	else
 -		_stprintf_s(message, TranslateT("Number of history items to delete: %d.\nAre you sure you want to do this?"), toDelete);
 +		mir_sntprintf(message, SIZEOF(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 8e3d159289..cacab1deee 100644 --- a/plugins/BasicHistory/src/Options.cpp +++ b/plugins/BasicHistory/src/Options.cpp @@ -258,7 +258,7 @@ void Options::Load(void)  		fid.deffontsettings.colour = g_FontOptionsList[i].defColour;
  		fid.deffontsettings.style = g_FontOptionsList[i].defStyle;
  		fid.deffontsettings.charset = DEFAULT_CHARSET;
 -		sprintf_s(fid.prefix, SIZEOF(fid.prefix), "Font%d", i);
 +		mir_snprintf(fid.prefix, SIZEOF(fid.prefix), "Font%d", i);
  		_tcsncpy_s(fid.name, g_FontOptionsList[i].szDescr, SIZEOF(fid.name));
  		_tcsncpy_s(fid.backgroundName, g_FontOptionsList[i].szBackgroundName, SIZEOF(fid.name));
  		fid.flags = FIDF_DEFAULTVALID | FIDF_CLASSGENERAL | g_FontOptionsList[i].flags;
 @@ -270,7 +270,7 @@ void Options::Load(void)  	for(int i = 0; i < g_colorsSize; ++i)
  	{
  		_tcsncpy_s(cid.name, g_ColorOptionsList[i].tszName, SIZEOF(cid.name));
 -		sprintf_s(cid.setting, SIZEOF(cid.setting), "Color%d", i);
 +		mir_snprintf(cid.setting, SIZEOF(cid.setting), "Color%d", i);
  		cid.order = i;
  		cid.defcolour = g_ColorOptionsList[i].def;
  		ColourRegisterT(&cid);
 @@ -325,7 +325,7 @@ void Options::Load(void)  	{
  		char buf[256];
  		FilterOptions fo;
 -		sprintf_s(buf, "filterName_%d", i);
 +		mir_snprintf(buf, SIZEOF(buf), "filterName_%d", i);
  		DBVARIANT nameV;
  		if(!db_get_ws(0, MODULE, buf, &nameV))
  		{
 @@ -333,13 +333,13 @@ void Options::Load(void)  			db_free(&nameV);
  		}
  		else break;
 -		sprintf_s(buf, "filterInOut_%d", i);
 +		mir_snprintf(buf, SIZEOF(buf), "filterInOut_%d", i);
  		int inOut = db_get_b(0, MODULE, buf, 0);
  		if(inOut == 1)
  			fo.onlyIncomming = true;
  		else if(inOut == 2)
  			fo.onlyOutgoing = true;
 -		sprintf_s(buf, "filterEvents_%d", i);
 +		mir_snprintf(buf, SIZEOF(buf), "filterEvents_%d", i);
  		DBVARIANT eventsV;
  		if(!db_get_s(0, MODULE, buf, &eventsV))
  		{
 @@ -505,9 +505,9 @@ void Options::Save()  	for(int i = 0 ; i < (int)customFilters.size(); ++i)
  	{
  		char buf[256];
 -		sprintf_s(buf, "filterName_%d", i);
 +		mir_snprintf(buf, SIZEOF(buf), "filterName_%d", i);
  		db_set_ws(0, MODULE, buf, customFilters[i].name.c_str());
 -		sprintf_s(buf, "filterInOut_%d", i);
 +		mir_snprintf(buf, SIZEOF(buf), "filterInOut_%d", i);
  		db_set_b(0, MODULE, buf, customFilters[i].onlyIncomming ? 1 : (customFilters[i].onlyOutgoing ? 2 : 0));
  		std::string events;
  		for(std::vector<int>::iterator it = customFilters[i].events.begin(); it != customFilters[i].events.end(); ++it)
 @@ -517,7 +517,7 @@ void Options::Save()  			events += ";";
  		}
 -		sprintf_s(buf, "filterEvents_%d", i);
 +		mir_snprintf(buf, SIZEOF(buf), "filterEvents_%d", i);
  		db_set_s(0, MODULE, buf, events.c_str());
  	}
 @@ -551,54 +551,54 @@ void Options::SaveTasks(std::list<TaskOptions>* tasks)  	char buf[256];
  	for(std::list<TaskOptions>::iterator it = tasks->begin(); it != tasks->end(); ++it)
  	{
 -		sprintf_s(buf, "Task_compress_%d", i);
 +		mir_snprintf(buf, SIZEOF(buf), "Task_compress_%d", i);
  		db_set_b(0, MODULE, buf, it->compress);
 -		sprintf_s(buf, "Task_useFtp_%d", i);
 +		mir_snprintf(buf, SIZEOF(buf), "Task_useFtp_%d", i);
  		db_set_b(0, MODULE, buf, it->useFtp);
 -		sprintf_s(buf, "Task_isSystem_%d", i);
 +		mir_snprintf(buf, SIZEOF(buf), "Task_isSystem_%d", i);
  		db_set_b(0, MODULE, buf, it->isSystem);
 -		sprintf_s(buf, "Task_active_%d", i);
 +		mir_snprintf(buf, SIZEOF(buf), "Task_active_%d", i);
  		db_set_b(0, MODULE, buf, it->active);
 -		sprintf_s(buf, "Task_exportImported_%d", i);
 +		mir_snprintf(buf, SIZEOF(buf), "Task_exportImported_%d", i);
  		db_set_b(0, MODULE, buf, it->exportImported);
 -		sprintf_s(buf, "Task_type_%d", i);
 +		mir_snprintf(buf, SIZEOF(buf), "Task_type_%d", i);
  		db_set_b(0, MODULE, buf, it->type);
 -		sprintf_s(buf, "Task_eventUnit_%d", i);
 +		mir_snprintf(buf, SIZEOF(buf), "Task_eventUnit_%d", i);
  		db_set_b(0, MODULE, buf, it->eventUnit);
 -		sprintf_s(buf, "Task_trigerType_%d", i);
 +		mir_snprintf(buf, SIZEOF(buf), "Task_trigerType_%d", i);
  		db_set_b(0, MODULE, buf, it->trigerType);
 -		sprintf_s(buf, "Task_exportType_%d", i);
 +		mir_snprintf(buf, SIZEOF(buf), "Task_exportType_%d", i);
  		db_set_b(0, MODULE, buf, it->exportType);
 -		sprintf_s(buf, "Task_importType_%d", i);
 +		mir_snprintf(buf, SIZEOF(buf), "Task_importType_%d", i);
  		db_set_b(0, MODULE, buf, it->importType);
 -		sprintf_s(buf, "Task_eventDeltaTime_%d", i);
 +		mir_snprintf(buf, SIZEOF(buf), "Task_eventDeltaTime_%d", i);
  		db_set_dw(0, MODULE, buf, it->eventDeltaTime);
 -		sprintf_s(buf, "Task_filterId_%d", i);
 +		mir_snprintf(buf, SIZEOF(buf), "Task_filterId_%d", i);
  		db_set_dw(0, MODULE, buf, it->filterId);
 -		sprintf_s(buf, "Task_dayTime_%d", i);
 +		mir_snprintf(buf, SIZEOF(buf), "Task_dayTime_%d", i);
  		db_set_dw(0, MODULE, buf, it->dayTime);
 -		sprintf_s(buf, "Task_dayOfWeek_%d", i);
 +		mir_snprintf(buf, SIZEOF(buf), "Task_dayOfWeek_%d", i);
  		db_set_dw(0, MODULE, buf, it->dayOfWeek);
 -		sprintf_s(buf, "Task_dayOfMonth_%d", i);
 +		mir_snprintf(buf, SIZEOF(buf), "Task_dayOfMonth_%d", i);
  		db_set_dw(0, MODULE, buf, it->dayOfMonth);
 -		sprintf_s(buf, "Task_deltaTime_%d", i);
 +		mir_snprintf(buf, SIZEOF(buf), "Task_deltaTime_%d", i);
  		db_set_dw(0, MODULE, buf, it->deltaTime);
 -		sprintf_s(buf, "Task_lastExport_low_%d", i);
 +		mir_snprintf(buf, SIZEOF(buf), "Task_lastExport_low_%d", i);
  		db_set_dw(0, MODULE, buf, (int)it->lastExport);
 -		sprintf_s(buf, "Task_lastExport_hi_%d", i);
 +		mir_snprintf(buf, SIZEOF(buf), "Task_lastExport_hi_%d", i);
  		db_set_dw(0, MODULE, buf, ((unsigned long long int)it->lastExport) >> 32);
 -		sprintf_s(buf, "Task_ftpName_%d", i);
 +		mir_snprintf(buf, SIZEOF(buf), "Task_ftpName_%d", i);
  		db_set_ws(0, MODULE, buf, it->ftpName.c_str());
 -		sprintf_s(buf, "Task_filterName_%d", i);
 +		mir_snprintf(buf, SIZEOF(buf), "Task_filterName_%d", i);
  		db_set_ws(0, MODULE, buf, it->filterName.c_str());
 -		sprintf_s(buf, "Task_filePath_%d", i);
 +		mir_snprintf(buf, SIZEOF(buf), "Task_filePath_%d", i);
  		db_set_ws(0, MODULE, buf, it->filePath.c_str());
 -		sprintf_s(buf, "Task_taskName_%d", i);
 +		mir_snprintf(buf, SIZEOF(buf), "Task_taskName_%d", i);
  		db_set_ws(0, MODULE, buf, it->taskName.c_str());
 -		sprintf_s(buf, "Task_zipPassword_%d", i);
 +		mir_snprintf(buf, SIZEOF(buf), "Task_zipPassword_%d", i);
  		db_set_s(0, MODULE, buf, it->zipPassword.c_str());
 -		sprintf_s(buf, "IsInTask_%d", i);
 +		mir_snprintf(buf, SIZEOF(buf), "IsInTask_%d", i);
  		for (HANDLE hContact = db_find_first(); hContact; hContact = db_find_next(hContact))
  			db_unset(hContact, MODULE, buf);
 @@ -613,48 +613,48 @@ void Options::SaveTasks(std::list<TaskOptions>* tasks)  	for(i = (int)tasks->size(); i < oldTaskNr; ++i)
  	{
 -		sprintf_s(buf, "Task_compress_%d", i);
 +		mir_snprintf(buf, SIZEOF(buf), "Task_compress_%d", i);
  		db_unset(NULL, MODULE, buf);
 -		sprintf_s(buf, "Task_useFtp_%d", i);
 +		mir_snprintf(buf, SIZEOF(buf), "Task_useFtp_%d", i);
  		db_unset(NULL, MODULE, buf);
 -		sprintf_s(buf, "Task_isSystem_%d", i);
 +		mir_snprintf(buf, SIZEOF(buf), "Task_isSystem_%d", i);
  		db_unset(NULL, MODULE, buf);
 -		sprintf_s(buf, "Task_active_%d", i);
 +		mir_snprintf(buf, SIZEOF(buf), "Task_active_%d", i);
  		db_unset(NULL, MODULE, buf);
 -		sprintf_s(buf, "Task_type_%d", i);
 +		mir_snprintf(buf, SIZEOF(buf), "Task_type_%d", i);
  		db_unset(NULL, MODULE, buf);
 -		sprintf_s(buf, "Task_eventUnit_%d", i);
 +		mir_snprintf(buf, SIZEOF(buf), "Task_eventUnit_%d", i);
  		db_unset(NULL, MODULE, buf);
 -		sprintf_s(buf, "Task_trigerType_%d", i);
 +		mir_snprintf(buf, SIZEOF(buf), "Task_trigerType_%d", i);
  		db_unset(NULL, MODULE, buf);
 -		sprintf_s(buf, "Task_exportType_%d", i);
 +		mir_snprintf(buf, SIZEOF(buf), "Task_exportType_%d", i);
  		db_unset(NULL, MODULE, buf);
 -		sprintf_s(buf, "Task_eventDeltaTime_%d", i);
 +		mir_snprintf(buf, SIZEOF(buf), "Task_eventDeltaTime_%d", i);
  		db_unset(NULL, MODULE, buf);
 -		sprintf_s(buf, "Task_filterId_%d", i);
 +		mir_snprintf(buf, SIZEOF(buf), "Task_filterId_%d", i);
  		db_unset(NULL, MODULE, buf);
 -		sprintf_s(buf, "Task_dayTime_%d", i);
 +		mir_snprintf(buf, SIZEOF(buf), "Task_dayTime_%d", i);
  		db_unset(NULL, MODULE, buf);
 -		sprintf_s(buf, "Task_dayOfWeek_%d", i);
 +		mir_snprintf(buf, SIZEOF(buf), "Task_dayOfWeek_%d", i);
  		db_unset(NULL, MODULE, buf);
 -		sprintf_s(buf, "Task_dayOfMonth_%d", i);
 +		mir_snprintf(buf, SIZEOF(buf), "Task_dayOfMonth_%d", i);
  		db_unset(NULL, MODULE, buf);
 -		sprintf_s(buf, "Task_deltaTime_%d", i);
 +		mir_snprintf(buf, SIZEOF(buf), "Task_deltaTime_%d", i);
  		db_unset(NULL, MODULE, buf);
 -		sprintf_s(buf, "Task_lastExport_low_%d", i);
 +		mir_snprintf(buf, SIZEOF(buf), "Task_lastExport_low_%d", i);
  		db_unset(NULL, MODULE, buf);
 -		sprintf_s(buf, "Task_lastExport_hi_%d", i);
 +		mir_snprintf(buf, SIZEOF(buf), "Task_lastExport_hi_%d", i);
  		db_unset(NULL, MODULE, buf);
 -		sprintf_s(buf, "Task_ftpName_%d", i);
 +		mir_snprintf(buf, SIZEOF(buf), "Task_ftpName_%d", i);
  		db_unset(NULL, MODULE, buf);
 -		sprintf_s(buf, "Task_filterName_%d", i);
 +		mir_snprintf(buf, SIZEOF(buf), "Task_filterName_%d", i);
  		db_unset(NULL, MODULE, buf);
 -		sprintf_s(buf, "Task_filePath_%d", i);
 +		mir_snprintf(buf, SIZEOF(buf), "Task_filePath_%d", i);
  		db_unset(NULL, MODULE, buf);
 -		sprintf_s(buf, "Task_taskName_%d", i);
 +		mir_snprintf(buf, SIZEOF(buf), "Task_taskName_%d", i);
  		db_unset(NULL, MODULE, buf);
 -		sprintf_s(buf, "IsInTask_%d", i);
 +		mir_snprintf(buf, SIZEOF(buf), "IsInTask_%d", i);
  		for (HANDLE hContact = db_find_first(); hContact; hContact = db_find_next(hContact))
  			db_unset(hContact, MODULE, buf);
  	}
 @@ -666,9 +666,9 @@ void Options::SaveTaskTime(TaskOptions& to)  {
  	int i = to.orderNr;
  	char buf[256];
 -	sprintf_s(buf, "Task_lastExport_low_%d", i);
 +	mir_snprintf(buf, SIZEOF(buf), "Task_lastExport_low_%d", i);
  	db_set_dw(0, MODULE, buf, (int)to.lastExport);
 -	sprintf_s(buf, "Task_lastExport_hi_%d", i);
 +	mir_snprintf(buf, SIZEOF(buf), "Task_lastExport_hi_%d", i);
  	db_set_dw(0, MODULE, buf, ((unsigned long long int)to.lastExport) >> 32);
  }
 @@ -679,76 +679,76 @@ void Options::LoadTasks()  	for(int i = 0; i < taskCount; ++i)
  	{
  		TaskOptions to;
 -		sprintf_s(buf, "Task_compress_%d", i);
 +		mir_snprintf(buf, SIZEOF(buf), "Task_compress_%d", i);
  		to.compress = db_get_b(0, MODULE, buf, to.compress) != 0;
 -		sprintf_s(buf, "Task_useFtp_%d", i);
 +		mir_snprintf(buf, SIZEOF(buf), "Task_useFtp_%d", i);
  		to.useFtp = db_get_b(0, MODULE, buf, to.useFtp) != 0;
 -		sprintf_s(buf, "Task_isSystem_%d", i);
 +		mir_snprintf(buf, SIZEOF(buf), "Task_isSystem_%d", i);
  		to.isSystem = db_get_b(0, MODULE, buf, to.isSystem) != 0;
 -		sprintf_s(buf, "Task_active_%d", i);
 +		mir_snprintf(buf, SIZEOF(buf), "Task_active_%d", i);
  		to.active = db_get_b(0, MODULE, buf, to.active) != 0;
 -		sprintf_s(buf, "Task_exportImported_%d", i);
 +		mir_snprintf(buf, SIZEOF(buf), "Task_exportImported_%d", i);
  		to.exportImported = db_get_b(0, MODULE, buf, to.exportImported) != 0;
 -		sprintf_s(buf, "Task_type_%d", i);
 +		mir_snprintf(buf, SIZEOF(buf), "Task_type_%d", i);
  		to.type = (TaskOptions::TaskType)db_get_b(0, MODULE, buf, to.type);
 -		sprintf_s(buf, "Task_eventUnit_%d", i);
 +		mir_snprintf(buf, SIZEOF(buf), "Task_eventUnit_%d", i);
  		to.eventUnit = (TaskOptions::EventUnit)db_get_b(0, MODULE, buf, to.eventUnit);
 -		sprintf_s(buf, "Task_trigerType_%d", i);
 +		mir_snprintf(buf, SIZEOF(buf), "Task_trigerType_%d", i);
  		to.trigerType = (TaskOptions::TrigerType)db_get_b(0, MODULE, buf, to.trigerType);
 -		sprintf_s(buf, "Task_exportType_%d", i);
 +		mir_snprintf(buf, SIZEOF(buf), "Task_exportType_%d", i);
  		to.exportType = (IExport::ExportType)db_get_b(0, MODULE, buf, to.exportType);
 -		sprintf_s(buf, "Task_importType_%d", i);
 +		mir_snprintf(buf, SIZEOF(buf), "Task_importType_%d", i);
  		to.importType = (IImport::ImportType)db_get_b(0, MODULE, buf, to.importType);
 -		sprintf_s(buf, "Task_eventDeltaTime_%d", i);
 +		mir_snprintf(buf, SIZEOF(buf), "Task_eventDeltaTime_%d", i);
  		to.eventDeltaTime = db_get_dw(0, MODULE, buf, to.eventDeltaTime);
 -		sprintf_s(buf, "Task_filterId_%d", i);
 +		mir_snprintf(buf, SIZEOF(buf), "Task_filterId_%d", i);
  		to.filterId = db_get_dw(0, MODULE, buf, to.filterId);
 -		sprintf_s(buf, "Task_dayTime_%d", i);
 +		mir_snprintf(buf, SIZEOF(buf), "Task_dayTime_%d", i);
  		to.dayTime = db_get_dw(0, MODULE, buf, to.dayTime);
 -		sprintf_s(buf, "Task_dayOfWeek_%d", i);
 +		mir_snprintf(buf, SIZEOF(buf), "Task_dayOfWeek_%d", i);
  		to.dayOfWeek = db_get_dw(0, MODULE, buf, to.dayOfWeek);
 -		sprintf_s(buf, "Task_dayOfMonth_%d", i);
 +		mir_snprintf(buf, SIZEOF(buf), "Task_dayOfMonth_%d", i);
  		to.dayOfMonth = db_get_dw(0, MODULE, buf, to.dayOfMonth);
 -		sprintf_s(buf, "Task_deltaTime_%d", i);
 +		mir_snprintf(buf, SIZEOF(buf), "Task_deltaTime_%d", i);
  		to.deltaTime = db_get_dw(0, MODULE, buf, to.deltaTime);
  		unsigned long long int le = to.lastExport;
 -		sprintf_s(buf, "Task_lastExport_low_%d", i);
 +		mir_snprintf(buf, SIZEOF(buf), "Task_lastExport_low_%d", i);
  		to.lastExport = db_get_dw(0, MODULE, buf, (int)le) & 0xffffffff;
 -		sprintf_s(buf, "Task_lastExport_hi_%d", i);
 +		mir_snprintf(buf, SIZEOF(buf), "Task_lastExport_hi_%d", i);
  		to.lastExport |= ((unsigned long long int)db_get_dw(0, MODULE, buf, le >> 32)) << 32;
 -		sprintf_s(buf, "Task_ftpName_%d", i);
 +		mir_snprintf(buf, SIZEOF(buf), "Task_ftpName_%d", i);
  		DBVARIANT var;
  		if(!db_get_ws(0, MODULE, buf, &var))
  		{
  			to.ftpName = var.ptszVal;
  			db_free(&var);
  		}
 -		sprintf_s(buf, "Task_filterName_%d", i);
 +		mir_snprintf(buf, SIZEOF(buf), "Task_filterName_%d", i);
  		if(!db_get_ws(0, MODULE, buf, &var))
  		{
  			to.filterName = var.ptszVal;
  			db_free(&var);
  		}
 -		sprintf_s(buf, "Task_filePath_%d", i);
 +		mir_snprintf(buf, SIZEOF(buf), "Task_filePath_%d", i);
  		if(!db_get_ws(0, MODULE, buf, &var))
  		{
  			to.filePath = var.ptszVal;
  			db_free(&var);
  		}
 -		sprintf_s(buf, "Task_taskName_%d", i);
 +		mir_snprintf(buf, SIZEOF(buf), "Task_taskName_%d", i);
  		if(!db_get_ws(0, MODULE, buf, &var))
  		{
  			to.taskName = var.ptszVal;
  			db_free(&var);
  		}
 -		sprintf_s(buf, "Task_zipPassword_%d", i);
 +		mir_snprintf(buf, SIZEOF(buf), "Task_zipPassword_%d", i);
  		if(!db_get_s(0, MODULE, buf, &var))
  		{
  			to.zipPassword = var.pszVal;
  			db_free(&var);
  		}
 -		sprintf_s(buf, "IsInTask_%d", i);
 +		mir_snprintf(buf, SIZEOF(buf), "IsInTask_%d", i);
  		for (HANDLE hContact = db_find_first(); hContact; hContact = db_find_next(hContact))
  			if(db_get_b(hContact, MODULE, buf, 0) == 1)
  				to.contacts.push_back(hContact);
 @@ -778,7 +778,7 @@ void SetEventCB(HWND hwndCB, int eventId)  	if(selCpIdx == -1)
  	{
  		TCHAR buf[24];
 -		_stprintf_s(buf, 24, _T("%d"), eventId);
 +		mir_sntprintf(buf, SIZEOF(buf), _T("%d"), eventId);
  		ComboBox_SetText(hwndCB, buf);	
  	}
  	else
 @@ -844,7 +844,7 @@ void ReloadEventLB(HWND hwndLB, const FilterOptions &sel)  		if(selCpIdx == -1)
  		{
  			TCHAR buf[24];
 -			_stprintf_s(buf, 24, _T("%d"), *it);
 +			mir_sntprintf(buf, SIZEOF(buf), _T("%d"), *it);
  			ListBox_AddString(hwndLB, buf);	
  		}
  		else
 @@ -876,9 +876,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);
 -	_stprintf_s(filter, TranslateT("%s Files (*.%s)"), extUpper, ext);
 +	mir_sntprintf(filter, SIZEOF(filter), TranslateT("%s Files (*.%s)"), extUpper, ext);
  	size_t len = _tcslen(filter) + 1;
 -	_stprintf_s(filter + len, 1024 - len, _T("*.%s"), ext);
 +	mir_sntprintf(filter + len, 1024 - len, _T("*.%s"), ext);
  	len += _tcslen(filter + len) + 1;
  	_tcscpy_s(filter + len, 1024 - len, TranslateT("All Files (*.*)"));
  	len += _tcslen(filter + len) + 1;
 @@ -1409,7 +1409,7 @@ void InitCodepageCB(HWND hwndCB, unsigned int codepage, const std::wstring& name  	if(selCpIdx == -1)
  	{
  		TCHAR buf[300];
 -		_stprintf_s(buf, 300, _T("%d;%s"), codepage, name.c_str());
 +		mir_sntprintf(buf, 300, _T("%d;%s"), codepage, name.c_str());
  		ComboBox_SetText(hwndCB, buf);	
  	}
  	else
 @@ -1893,7 +1893,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];
 -				_stprintf_s(timeFormat, _T("HH%cmm"), sep);
 +				mir_sntprintf(timeFormat, SIZEOF(timeFormat), _T("HH%cmm"), sep);
  			}
  			SYSTEMTIME st;
 @@ -1944,7 +1944,7 @@ INT_PTR CALLBACK Options::DlgProcOptsTask(HWND hwndDlg, UINT msg, WPARAM wParam,  					if(!isOK)
  					{
  						TCHAR msg[256];
 -						_stprintf_s(msg, TranslateT("Invalid '%s' value."), TranslateT("Events older than"));
 +						mir_sntprintf(msg, SIZEOF(msg), TranslateT("Invalid '%s' value."), TranslateT("Events older than"));
  						MessageBox(hwndDlg, msg, TranslateT("Error"), MB_ICONERROR);
  						break;
  					}
 @@ -1977,7 +1977,7 @@ INT_PTR CALLBACK Options::DlgProcOptsTask(HWND hwndDlg, UINT msg, WPARAM wParam,  						if(toCp.trigerType == TaskOptions::Monthly)
  						{
  							TCHAR msg[256];
 -							_stprintf_s(msg, TranslateT("Invalid '%s' value."), TranslateT("Day"));
 +							mir_sntprintf(msg, SIZEOF(msg), TranslateT("Invalid '%s' value."), TranslateT("Day"));
  							MessageBox(hwndDlg, msg, TranslateT("Error"), MB_ICONERROR);
  							break;
  						}
 @@ -1990,7 +1990,7 @@ INT_PTR CALLBACK Options::DlgProcOptsTask(HWND hwndDlg, UINT msg, WPARAM wParam,  						if(toCp.trigerType == TaskOptions::DeltaMin || toCp.trigerType == TaskOptions::DeltaHour)
  						{
  							TCHAR msg[256];
 -							_stprintf_s(msg, TranslateT("Invalid '%s' value."), TranslateT("Delta time"));
 +							mir_sntprintf(msg, SIZEOF(msg), TranslateT("Invalid '%s' value."), TranslateT("Delta time"));
  							MessageBox(hwndDlg, msg, TranslateT("Error"), MB_ICONERROR);
  							break;
  						}
 @@ -2010,11 +2010,11 @@ INT_PTR CALLBACK Options::DlgProcOptsTask(HWND hwndDlg, UINT msg, WPARAM wParam,  							_tcscpy_s(msg, TranslateT("Some value is invalid"));
  						else if(errDescr.empty())
  						{
 -							_stprintf_s(msg, TranslateT("Invalid '%s' value."), err.c_str());
 +							mir_sntprintf(msg, SIZEOF(msg), TranslateT("Invalid '%s' value."), err.c_str());
  						}
  						else
  						{
 -							_stprintf_s(msg, TranslateT("Invalid '%s' value.\n%s"), err.c_str(), errDescr.c_str());
 +							mir_sntprintf(msg, SIZEOF(msg), TranslateT("Invalid '%s' value.\n%s"), err.c_str(), errDescr.c_str());
  						}
  						MessageBox(hwndDlg, msg, TranslateT("Error"), MB_ICONERROR);
 diff --git a/plugins/BasicHistory/src/Scheduler.cpp b/plugins/BasicHistory/src/Scheduler.cpp index dcc35024fd..b1c617e5a0 100644 --- a/plugins/BasicHistory/src/Scheduler.cpp +++ b/plugins/BasicHistory/src/Scheduler.cpp @@ -269,11 +269,11 @@ bool DoTask(TaskOptions& to)  			_tcscpy_s(msg, TranslateT("Some value is invalid"));
  		else if(errDescr.empty())
  		{
 -			_stprintf_s(msg, TranslateT("Invalid '%s' value."), err.c_str());
 +			mir_sntprintf(msg, SIZEOF(msg), TranslateT("Invalid '%s' value."), err.c_str());
  		}
  		else
  		{
 -			_stprintf_s(msg, TranslateT("Invalid '%s' value.\n%s"), err.c_str(), errDescr.c_str());
 +			mir_sntprintf(msg, SIZEOF(msg), TranslateT("Invalid '%s' value.\n%s"), err.c_str(), errDescr.c_str());
  		}
  		DoError(to, msg);
  		return true;
 @@ -467,7 +467,7 @@ bool DoTask(TaskOptions& to)  					TCHAR msg[1024];
 -					_stprintf_s(msg, TranslateT("Incorrect file format: %s."), GetName(*it).c_str());
 +					mir_sntprintf(msg, SIZEOF(msg), TranslateT("Incorrect file format: %s."), GetName(*it).c_str());
  					errorStr += msg;
  				}
  				else
 @@ -479,7 +479,7 @@ bool DoTask(TaskOptions& to)  					TCHAR msg[1024];
 -					_stprintf_s(msg, TranslateT("Unknown contact in file: %s."), GetName(*it).c_str());
 +					mir_sntprintf(msg, SIZEOF(msg), TranslateT("Unknown contact in file: %s."), GetName(*it).c_str());
  					errorStr += msg;
  				}
  			}
 @@ -551,7 +551,7 @@ bool DoTask(TaskOptions& to)  				TCHAR msg[1024];
 -				_stprintf_s(msg, TranslateT("Cannot export history for contact: %s."),  exp->GetContactName().c_str());
 +				mir_sntprintf(msg, SIZEOF(msg), TranslateT("Cannot export history for contact: %s."),  exp->GetContactName().c_str());
  				errorStr += msg;
  			}
 @@ -582,7 +582,7 @@ bool DoTask(TaskOptions& to)  					TCHAR msg[1024];
 -					_stprintf_s(msg, TranslateT("Cannot export history for contact: %s."),  exp->GetContactName().c_str());
 +					mir_sntprintf(msg, SIZEOF(msg), TranslateT("Cannot export history for contact: %s."),  exp->GetContactName().c_str());
  					errorStr += msg;
  					break;
  				}
 @@ -717,7 +717,7 @@ std::wstring GetFileName(const std::wstring &baseName, std::wstring contactName,  		TCHAR time[256];
  		SYSTEMTIME st;
  		GetLocalTime(&st);
 -		_stprintf_s(time, _T("%d-%02d-%02d %02d%02d"), st.wYear, st.wMonth, st.wDay, st.wHour, st.wMinute);
 +		mir_sntprintf(time, SIZEOF(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);
 @@ -1009,11 +1009,11 @@ bool ExecuteCurrentTask(time_t now)  				TCHAR* name = new TCHAR[size];
  				if(error)
  				{
 -					_stprintf_s(name, size, TranslateT("Task '%s' execution failed"), to.taskName.c_str());
 +					mir_sntprintf(name, size, TranslateT("Task '%s' execution failed"), to.taskName.c_str());
  				}
  				else
  				{
 -					_stprintf_s(name, size, TranslateT("Task '%s' finished successfully"), to.taskName.c_str());
 +					mir_sntprintf(name, size, TranslateT("Task '%s' finished successfully"), to.taskName.c_str());
  				}
  				QueueUserAPC(DoTaskFinishInMainAPCFunc, g_hMainThread, (ULONG_PTR) name);
 @@ -1355,7 +1355,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];
 -			_stprintf_s(cmdLine, _T("\"%s\" /nointeractiveinput /log=\"%s\" /script=script.sc"), Options::instance->ftpExePath.c_str(), log.c_str());
 +			mir_sntprintf(cmdLine, SIZEOF(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);
 @@ -1466,7 +1466,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];
 -		_stprintf_s(cmdLine, _T("\"%s\" /nointeractiveinput /log=\"%s\" /script=script.sc"), Options::instance->ftpExePath.c_str(), log.c_str());
 +		mir_sntprintf(cmdLine, SIZEOF(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);
 @@ -1535,7 +1535,7 @@ INT_PTR ExecuteTaskService(WPARAM wParam, LPARAM lParam)  void DoError(const TaskOptions& to, const std::wstring _error)
  {
  	TCHAR msg[256];
 -	_stprintf_s(msg, TranslateT("Task '%s' execution failed:"), to.taskName.c_str());
 +	mir_sntprintf(msg, SIZEOF(msg), TranslateT("Task '%s' execution failed:"), to.taskName.c_str());
  	if(Options::instance->schedulerHistoryAlerts)
  	{
  		std::wstring error = msg;
 diff --git a/plugins/Clist_blind/src/cluiopts.cpp b/plugins/Clist_blind/src/cluiopts.cpp index 4c71790871..0a55e9f298 100644 --- a/plugins/Clist_blind/src/cluiopts.cpp +++ b/plugins/Clist_blind/src/cluiopts.cpp @@ -146,9 +146,9 @@ static INT_PTR CALLBACK DlgProcCluiOpts(HWND hwndDlg, UINT msg, WPARAM wParam, L  	case WM_HSCROLL:
  		{
  			char str[10];
 -			wsprintfA(str, "%d%%", 100 * SendDlgItemMessage(hwndDlg, IDC_TRANSINACTIVE, TBM_GETPOS, 0, 0) / 255);
 +			mir_snprintf(str, SIZEOF(str), "%d%%", 100 * SendDlgItemMessage(hwndDlg, IDC_TRANSINACTIVE, TBM_GETPOS, 0, 0) / 255);
  			SetDlgItemTextA(hwndDlg, IDC_INACTIVEPERC, str);
 -			wsprintfA(str, "%d%%", 100 * SendDlgItemMessage(hwndDlg, IDC_TRANSACTIVE, TBM_GETPOS, 0, 0) / 255);
 +			mir_snprintf(str, SIZEOF(str), "%d%%", 100 * SendDlgItemMessage(hwndDlg, IDC_TRANSACTIVE, TBM_GETPOS, 0, 0) / 255);
  			SetDlgItemTextA(hwndDlg, IDC_ACTIVEPERC, str);
  		}
  		if (wParam != 0x12345678)
 diff --git a/plugins/Clist_modern/src/modern_skinopt.cpp b/plugins/Clist_modern/src/modern_skinopt.cpp index 4e3f81af69..8f0b01ddce 100644 --- a/plugins/Clist_modern/src/modern_skinopt.cpp +++ b/plugins/Clist_modern/src/modern_skinopt.cpp @@ -135,12 +135,12 @@ INT_PTR CALLBACK DlgSkinOpts(HWND hwndDlg, UINT msg, WPARAM wParam, LPARAM lPara  						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 );
 -						_sntprintf( text, SIZEOF( 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 );
 +						mir_sntprintf(text, SIZEOF(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);
  					}
  					else
  					{
 -						_sntprintf( text, SIZEOF( text ), TranslateT("%s\n\n%s\n\nAuthor(s): %s\nContact:\t %s\nWeb:\t %s\n\nFile:\t %s"),
 +						mir_sntprintf(text, SIZEOF(text), TranslateT("%s\n\n%s\n\nAuthor(s): %s\nContact:\t %s\nWeb:\t %s\n\nFile:\t %s"),
  							TranslateT("reVista for Modern v0.5"),
  							TranslateT("This is second default Modern Contact list skin in Vista Aero style"),
  							TranslateT("Angeli-Ka (graphics), FYR (template)"),
 @@ -289,7 +289,7 @@ INT_PTR CALLBACK DlgSkinOpts(HWND hwndDlg, UINT msg, WPARAM wParam, LPARAM lPara  						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 );
  						IniParser::GetSkinFolder( sd->File, skinfolder );
 -						_sntprintf( prfn, SIZEOF( prfn ), _T("%s\\%s"), skinfolder, imfn );
 +						mir_sntprintf(prfn, SIZEOF(prfn), _T("%s\\%s"), skinfolder, imfn);
  						PathToAbsoluteT(prfn, imfn);
  						hPreviewBitmap = ske_LoadGlyphImage(imfn);
 @@ -317,12 +317,12 @@ INT_PTR CALLBACK DlgSkinOpts(HWND hwndDlg, UINT msg, WPARAM wParam, LPARAM lPara  								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 );
 -								_sntprintf( text, SIZEOF( 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 );
 +								mir_sntprintf(text, SIZEOF(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);
  							}
  							else
  							{
 -								_sntprintf( text, SIZEOF( text ), TranslateT("%s\n\n%s\n\nAUTHORS:\n%s\n\nCONTACT:\n%s\n\nWEB:\n%s\n\n\n"),
 +								mir_sntprintf(text, SIZEOF(text), TranslateT("%s\n\n%s\n\nAUTHORS:\n%s\n\nCONTACT:\n%s\n\nWEB:\n%s\n\n\n"),
  									TranslateT("reVista for Modern v0.5"),
  									TranslateT("This is second default Modern Contact list skin in Vista Aero style"),
  									TranslateT("graphics by Angeli-Ka\ntemplate by FYR"),
 @@ -371,7 +371,7 @@ int SearchSkinFiles( HWND hwndDlg, TCHAR * Folder )  	struct _tfinddata_t fd = {0};
  	TCHAR mask[MAX_PATH];
  	long hFile;
 -	_sntprintf( mask, SIZEOF( mask ), _T("%s\\*.msf"), Folder );
 +	mir_sntprintf(mask, SIZEOF(mask), _T("%s\\*.msf"), Folder);
  	//fd.attrib = _A_SUBDIR;
  	hFile = _tfindfirst( mask, &fd );
  	if ( hFile != -1 )
 @@ -382,14 +382,14 @@ int SearchSkinFiles( HWND hwndDlg, TCHAR * Folder )  			while ( !_tfindnext( hFile, &fd ));
  		_findclose( hFile );
  	}
 -	_sntprintf( mask, SIZEOF( mask ), _T("%s\\*"), Folder );
 +	mir_sntprintf(mask, SIZEOF(mask), _T("%s\\*"), Folder);
  	hFile = _tfindfirst( mask, &fd );
  	{
  		do {
  			if ( fd.attrib&_A_SUBDIR && !( _tcsicmp( fd.name, _T("."))  == 0  || _tcsicmp( fd.name, _T("..")) == 0 ))
  			{//Next level of subfolders
  				TCHAR path[MAX_PATH];
 -				_sntprintf( path, SIZEOF( path ), _T("%s\\%s"), Folder, fd.name );
 +				mir_sntprintf(path, SIZEOF(path), _T("%s\\%s"), Folder, fd.name);
  				SearchSkinFiles( hwndDlg, path );
  			}
  		}while ( !_tfindnext( hFile, &fd ));
 @@ -453,8 +453,8 @@ HTREEITEM AddSkinToList( HWND hwndDlg, TCHAR * path, TCHAR* file )  	memmove(defskinname, file, (_tcslen( file )-4) * sizeof(TCHAR));
  	defskinname[_tcslen( file )+1] = _T('\0');
  	if ( !file || _tcschr( file, _T('%'))) {
 -		_sntprintf( sd->File, MAX_PATH, _T("%%Default Skin%%"));
 -		_sntprintf( sd->Name, 100, TranslateT("%Default Skin%"));
 +		mir_sntprintf(sd->File, MAX_PATH, _T("%%Default Skin%%"));
 +		mir_sntprintf(sd->Name, 100, TranslateT("%Default Skin%"));
  		_tcsncpy(fullName, TranslateT("Default Skin"), SIZEOF(fullName));
  	}
  	else {
 @@ -571,7 +571,7 @@ INT_PTR SvcPreviewSkin(WPARAM wParam, LPARAM lParam)  		TCHAR skinfolder[MAX_PATH] = {0};
  		GetPrivateProfileString( _T("Skin_Description_Section"), _T("Preview"), _T(""), imfn, SIZEOF( imfn ), (LPCTSTR)lParam);
  		IniParser::GetSkinFolder((LPCTSTR)lParam, skinfolder );
 -		_sntprintf( prfn, SIZEOF( prfn ), _T("%s\\%s"), skinfolder, imfn );
 +		mir_sntprintf(prfn, SIZEOF(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 654a42b01e..6b8a71e8c4 100644 --- a/plugins/Clist_modern/src/modern_skinselector.cpp +++ b/plugins/Clist_modern/src/modern_skinselector.cpp @@ -39,11 +39,12 @@ char * ModernMaskToString(MODERNMASK *mm, char * buf, UINT bufsize)  	{
  		if (mm->pl_Params[i].bMaskParamFlag)
  		{
 -			if (i>0) _snprintf(buf,bufsize,"%s%%",buf);
 +			if (i>0)
 +				mir_snprintf(buf, bufsize, "%s%%", buf);
  			if (mm->pl_Params[i].bMaskParamFlag &MPF_DIFF)
 -				_snprintf(buf,bufsize,"%s = %s",mm->pl_Params[i].szName,mm->pl_Params[i].szValue);
 +				mir_snprintf(buf, bufsize, "%s = %s", mm->pl_Params[i].szName, mm->pl_Params[i].szValue);
  			else
 -				_snprintf(buf,bufsize,"%s^%s",mm->pl_Params[i].szName,mm->pl_Params[i].szValue);
 +				mir_snprintf(buf, bufsize, "%s^%s", mm->pl_Params[i].szName, mm->pl_Params[i].szValue);
  		}
  		else break;
  	}
 diff --git a/plugins/Clist_mw/src/cluiopts.cpp b/plugins/Clist_mw/src/cluiopts.cpp index 3838380564..5b8b277b11 100644 --- a/plugins/Clist_mw/src/cluiopts.cpp +++ b/plugins/Clist_mw/src/cluiopts.cpp @@ -112,7 +112,7 @@ static INT_PTR CALLBACK DlgProcCluiOpts(HWND hwndDlg, UINT msg, WPARAM wParam, L  		}
  		SendDlgItemMessage(hwndDlg,IDC_TITLETEXT,CB_ADDSTRING,0,(LPARAM)MIRANDANAME);
 -		wsprintfA(szUin,"%u",db_get_dw(NULL,"ICQ","UIN",0));
 +		mir_snprintf(szUin, SIZEOF(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)) {
 @@ -192,9 +192,9 @@ static INT_PTR CALLBACK DlgProcCluiOpts(HWND hwndDlg, UINT msg, WPARAM wParam, L  	case WM_HSCROLL:
  		{	char str[10];
 -		wsprintfA(str,"%d%%",100*SendDlgItemMessage(hwndDlg,IDC_TRANSINACTIVE,TBM_GETPOS,0,0)/255);
 +		mir_snprintf(str, SIZEOF(str), "%d%%", 100 * SendDlgItemMessage(hwndDlg, IDC_TRANSINACTIVE, TBM_GETPOS, 0, 0) / 255);
  		SetDlgItemTextA(hwndDlg,IDC_INACTIVEPERC,str);
 -		wsprintfA(str,"%d%%",100*SendDlgItemMessage(hwndDlg,IDC_TRANSACTIVE,TBM_GETPOS,0,0)/255);
 +		mir_snprintf(str, SIZEOF(str), "%d%%", 100 * SendDlgItemMessage(hwndDlg, IDC_TRANSACTIVE, TBM_GETPOS, 0, 0) / 255);
  		SetDlgItemTextA(hwndDlg,IDC_ACTIVEPERC,str);
  		}
  		if (wParam != 0x12345678) SendMessage(GetParent(hwndDlg), PSM_CHANGED, 0, 0);
 diff --git a/plugins/Clist_nicer/src/Include/commonheaders.h b/plugins/Clist_nicer/src/Include/commonheaders.h index 7dafdfee0a..b18d89fae1 100644 --- a/plugins/Clist_nicer/src/Include/commonheaders.h +++ b/plugins/Clist_nicer/src/Include/commonheaders.h @@ -188,12 +188,8 @@ extern ImageItem *g_glyphItem;  */
 -#define MAX_REGS(_A_) (sizeof(_A_)/sizeof(_A_[0]))
 -
  typedef  int  (__cdecl *pfnDrawAvatar)(HDC hdcOrig, HDC hdcMem, RECT *rc, ClcContact *contact, int y, struct ClcData *dat, int selected, WORD cstatus, int rowHeight);
 -#define safe_sizeof(a) (sizeof((a)) / sizeof((a)[0]))
 -
  BOOL __forceinline GetItemByStatus(int status, StatusItems_t *retitem);
  void DrawAlpha(HDC hdcwnd, PRECT rc, DWORD basecolor, int alpha, DWORD basecolor2, BOOL transparent, BYTE FLG_GRADIENT, BYTE FLG_CORNER, DWORD BORDERSTYLE, ImageItem *item);
 diff --git a/plugins/Clist_nicer/src/clc.cpp b/plugins/Clist_nicer/src/clc.cpp index 93811cec7d..9c764b1048 100644 --- a/plugins/Clist_nicer/src/clc.cpp +++ b/plugins/Clist_nicer/src/clc.cpp @@ -415,7 +415,7 @@ LBL_Def:  		ClcContact *contact;
  		if ( !FindItem(hwnd, dat, (HANDLE)wParam, &contact, NULL, NULL))
  			break;
 -		lstrcpyn(contact->szText, pcli->pfnGetContactDisplayName((HANDLE)wParam, 0), safe_sizeof(contact->szText));
 +		lstrcpyn(contact->szText, pcli->pfnGetContactDisplayName((HANDLE)wParam, 0), SIZEOF(contact->szText));
  		RTL_DetectAndSet(contact, 0);
 @@ -499,7 +499,7 @@ LBL_Def:  		contact->proto = GetContactProto((HANDLE)wParam);
  		CallService(MS_CLIST_INVALIDATEDISPLAYNAME, wParam, 0);
 -		lstrcpyn(contact->szText, pcli->pfnGetContactDisplayName((HANDLE)wParam, 0), safe_sizeof(contact->szText));
 +		lstrcpyn(contact->szText, pcli->pfnGetContactDisplayName((HANDLE)wParam, 0), SIZEOF(contact->szText));
  		RTL_DetectAndSet(contact, 0);
 diff --git a/plugins/Clist_nicer/src/clcitems.cpp b/plugins/Clist_nicer/src/clcitems.cpp index 0952f744e7..2783641b9e 100644 --- a/plugins/Clist_nicer/src/clcitems.cpp +++ b/plugins/Clist_nicer/src/clcitems.cpp @@ -506,7 +506,7 @@ int __fastcall CLVM_GetContactHiddenStatus(HANDLE hContact, char *szProto, struc  	}
  	if (cfg::dat.bFilterEffective & CLVM_FILTER_GROUPS) {
  		if ( !cfg::getTString(hContact, "CList", "Group", &dbv)) {
 -			_sntprintf(szGroupMask, safe_sizeof(szGroupMask), _T("%s|"), &dbv.ptszVal[1]);
 +			mir_sntprintf(szGroupMask, SIZEOF(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/cluiopts.cpp b/plugins/Clist_nicer/src/cluiopts.cpp index 82513b0b05..1efd0b020e 100644 --- a/plugins/Clist_nicer/src/cluiopts.cpp +++ b/plugins/Clist_nicer/src/cluiopts.cpp @@ -160,9 +160,9 @@ INT_PTR CALLBACK DlgProcCluiOpts(HWND hwndDlg, UINT msg, WPARAM wParam, LPARAM l  	case WM_HSCROLL:
  		{
  			char str[10];
 -			wsprintfA(str, "%d%%", 100 * SendDlgItemMessage(hwndDlg, IDC_TRANSINACTIVE, TBM_GETPOS, 0, 0) / 255);
 +			mir_snprintf(str, SIZEOF(str), "%d%%", 100 * SendDlgItemMessage(hwndDlg, IDC_TRANSINACTIVE, TBM_GETPOS, 0, 0) / 255);
  			SetDlgItemTextA(hwndDlg, IDC_INACTIVEPERC, str);
 -			wsprintfA(str, "%d%%", 100 * SendDlgItemMessage(hwndDlg, IDC_TRANSACTIVE, TBM_GETPOS, 0, 0) / 255);
 +			mir_snprintf(str, SIZEOF(str), "%d%%", 100 * SendDlgItemMessage(hwndDlg, IDC_TRANSACTIVE, TBM_GETPOS, 0, 0) / 255);
  			SetDlgItemTextA(hwndDlg, IDC_ACTIVEPERC, str);
  		}
  		if (wParam != 0x12345678) {
 diff --git a/plugins/Clist_nicer/src/extBackg.cpp b/plugins/Clist_nicer/src/extBackg.cpp index cf31a0747e..7093cc95df 100644 --- a/plugins/Clist_nicer/src/extBackg.cpp +++ b/plugins/Clist_nicer/src/extBackg.cpp @@ -704,12 +704,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));
 -	_snprintf(def_color, 15, "%6.6x", clr);
 +	mir_snprintf(def_color, 15, "%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));
 -	_snprintf(def_color, 15, "%6.6x", clr);
 +	mir_snprintf(def_color, 15, "%6.6x", clr);
  	GetPrivateProfileStringA(szItem, "Color2", def_color, buffer, 400, file);
  	this_item->COLOR2 = HexStringToLong(buffer);
 diff --git a/plugins/Clist_nicer/src/init.cpp b/plugins/Clist_nicer/src/init.cpp index 6a1852e33e..7b8b31de25 100644 --- a/plugins/Clist_nicer/src/init.cpp +++ b/plugins/Clist_nicer/src/init.cpp @@ -123,7 +123,7 @@ void _DebugTraceW(const wchar_t *fmt, ...)  	lstrcpyW(debug, L"CLN: ");
 -    _vsnwprintf(&debug[5], ibsize - 10, fmt, va);
 +    mir_vsnwprintf(&debug[5], ibsize - 10, fmt, va);
      OutputDebugStringW(debug);
  #endif
  }
 @@ -137,7 +137,7 @@ void _DebugTraceA(const char *fmt, ...)      va_start(va, fmt);
  	lstrcpyA(debug, "CLN: ");
 -	_vsnprintf(&debug[5], ibsize - 10, fmt, va);
 +	mir_vsnprintf(&debug[5], ibsize - 10, fmt, va);
  #ifdef _DEBUG
      OutputDebugStringA(debug);
  #else
 diff --git a/plugins/Clist_nicer/src/rowheight_funcs.cpp b/plugins/Clist_nicer/src/rowheight_funcs.cpp index d3c9d52589..b2460204d3 100644 --- a/plugins/Clist_nicer/src/rowheight_funcs.cpp +++ b/plugins/Clist_nicer/src/rowheight_funcs.cpp @@ -105,7 +105,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 < MAX_REGS(contact_fonts) ; i++)
 +    for (i = 0 ; i < SIZEOF(contact_fonts) ; i++)
      {
          if (max_height < dat->fontInfo[contact_fonts[i]].fontHeight)
              max_height = dat->fontInfo[contact_fonts[i]].fontHeight;
 @@ -115,7 +115,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 < MAX_REGS(other_fonts) ; i++) {
 +    for (i = 0 ; i < SIZEOF(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/viewmodes.cpp b/plugins/Clist_nicer/src/viewmodes.cpp index 29a816f5e5..acf7e07cda 100644 --- a/plugins/Clist_nicer/src/viewmodes.cpp +++ b/plugins/Clist_nicer/src/viewmodes.cpp @@ -1079,8 +1079,8 @@ void ApplyViewMode(const char *name)  	mir_snprintf(szSetting, 256, "%c%s_GF", 246, name);
  	if ( !cfg::getTString(NULL, CLVM_MODULE, szSetting, &dbv)) {
  		if (lstrlen(dbv.ptszVal) >= 2) {
 -			_tcsncpy(cfg::dat.groupFilter, dbv.ptszVal, safe_sizeof(cfg::dat.groupFilter));
 -			cfg::dat.groupFilter[safe_sizeof(cfg::dat.groupFilter) - 1] = 0;
 +			_tcsncpy(cfg::dat.groupFilter, dbv.ptszVal, SIZEOF(cfg::dat.groupFilter));
 +			cfg::dat.groupFilter[SIZEOF(cfg::dat.groupFilter) - 1] = 0;
  			cfg::dat.bFilterEffective |= CLVM_FILTER_GROUPS;
  		}
  		mir_free(dbv.ptszVal);
 diff --git a/plugins/ConnectionNotify/src/ConnectionNotify.cpp b/plugins/ConnectionNotify/src/ConnectionNotify.cpp index b1d8f294ac..8bc6f5f6d5 100644 --- a/plugins/ConnectionNotify/src/ConnectionNotify.cpp +++ b/plugins/ConnectionNotify/src/ConnectionNotify.cpp @@ -1,42 +1,4 @@ -#include <windows.h>
 -//#include <stdio.h>
 -#include <tchar.h>
 -#include <Commctrl.h>
 -#include <assert.h>
 -#include "pid2name.h"
 -
 -
 -#ifdef _DEBUG
 -#include "debug.h"
 -#endif
 -
 -#include "resource.h"
 -
 -
 -#include <newpluginapi.h>
 -
 -#include <m_clist.h>
 -#include <m_skin.h>
 -#include <m_database.h>
 -#include <m_langpack.h>
 -//#include <m_plugins.h>
 -#include <m_options.h>
 -#include <m_popup.h>
 -#include <m_utils.h>
 -#include <m_protomod.h>
 -#include <m_protosvc.h>
 -#include <m_system.h>
 -//#include <m_updater.h>
 -
  #include "ConnectionNotify.h"
 -#include "netstat.h"
 -#include "filter.h"
 -#include "version.h"
 -
 -#define MAX_SETTING_STR 512
 -#define PLUGINNAME "ConnectionNotify"
 -
 -#define STATUS_COUNT 9
  HINSTANCE hInst;
 @@ -77,6 +39,7 @@ struct CONNECTION *connCurrentEditModal=NULL;  int currentStatus = ID_STATUS_OFFLINE,diffstat=0;
  BOOL bOptionsOpen=FALSE;
  TCHAR *tcpStates[]={_T("CLOSED"),_T("LISTEN"),_T("SYN_SENT"),_T("SYN_RCVD"),_T("ESTAB"),_T("FIN_WAIT1"),_T("FIN_WAIT2"),_T("CLOSE_WAIT"),_T("CLOSING"),_T("LAST_ACK"),_T("TIME_WAIT"),_T("DELETE_TCB")};
 +
  PLUGININFOEX pluginInfo={
  	sizeof(PLUGININFOEX),
  	PLUGINNAME,
 diff --git a/plugins/ConnectionNotify/src/ConnectionNotify.h b/plugins/ConnectionNotify/src/ConnectionNotify.h index d60e8d0cef..3bf10c9ba4 100644 --- a/plugins/ConnectionNotify/src/ConnectionNotify.h +++ b/plugins/ConnectionNotify/src/ConnectionNotify.h @@ -1,9 +1,44 @@ +#include <windows.h>
 +#include <Commctrl.h>
 +#include <assert.h>
 +#include <iphlpapi.h>
 +#include <Tlhelp32.h>
 +
 +#include <newpluginapi.h>
 +#include <m_core.h>
 +#include <m_clist.h>
 +#include <m_skin.h>
 +#include <m_database.h>
 +#include <m_langpack.h>
 +#include <m_options.h>
 +#include <m_popup.h>
 +#include <m_utils.h>
 +#include <m_protomod.h>
 +#include <m_protosvc.h>
 +#include <m_system.h>
 +
 +#ifdef _DEBUG
 +#include "debug.h"
 +#endif
 +#include "resource.h"
 +#include "netstat.h"
 +#include "filter.h"
 +#include "version.h"
 +#include "pid2name.h"
 +
 +#define MAX_SETTING_STR 512
 +#define PLUGINNAME "ConnectionNotify"
 +#define MAX_LENGTH 512
 +#define STATUS_COUNT 9
  #if !defined(MIID_CONNECTIONNOTIFY)
  	#define MIID_CONNECTIONNOTIFY  {0x4bb5b4aa, 0xc364, 0x4f23, { 0x97, 0x46, 0xd5, 0xb7, 0x8, 0xa2, 0x86, 0xa5 } }
  #endif
  // 4BB5B4AA-C364-4F23-9746-D5B708A286A5
 +// Note: could also use malloc() and free()
 +#define MALLOC(x) HeapAlloc(GetProcessHeap(), 0, (x))
 +#define FREE(x) HeapFree(GetProcessHeap(), 0, (x))
  void showMsg(TCHAR *pName,DWORD pid,TCHAR *intIp,TCHAR *extIp,int intPort,int extPort,int state);
  //int __declspec(dllexport) Load(PLUGINLINK *link);
 diff --git a/plugins/ConnectionNotify/src/debug.cpp b/plugins/ConnectionNotify/src/debug.cpp index d6bff90fe1..0400b3a673 100644 --- a/plugins/ConnectionNotify/src/debug.cpp +++ b/plugins/ConnectionNotify/src/debug.cpp @@ -1,7 +1,4 @@ -#include "debug.h"
 -
 -#define MAX_LENGTH 512
 -
 +#include "ConnectionNotify.h"
  void _OutputDebugString(TCHAR* lpOutputString, ... )
  {
 @@ -36,7 +33,7 @@ void _OutputDebugString(TCHAR* lpOutputString, ... )          case 's':
              {
                  TCHAR* s = va_arg( argptr, TCHAR * );
 -                _stprintf(OutMsg,format,s);
 +                mir_sntprintf(OutMsg, SIZEOF(OutMsg), format, s);
                  _tcsncpy(format,OutMsg,_countof(OutMsg));
                  j = _tcslen(format);
                  _tcscat(format,_T(" "));
 @@ -46,7 +43,7 @@ void _OutputDebugString(TCHAR* lpOutputString, ... )          case 'c':
              {
                  char c = (char) va_arg( argptr, int );
 -                _stprintf(OutMsg,format,c);
 +                mir_sntprintf(OutMsg, SIZEOF(OutMsg), format, c);
                  _tcsncpy(format,OutMsg,_countof(OutMsg));
                  j = _tcslen(format);
                  _tcscat(format,_T(" "));
 @@ -56,7 +53,7 @@ void _OutputDebugString(TCHAR* lpOutputString, ... )          case 'd':
              {
                  int d = va_arg( argptr, int );
 -                _stprintf(OutMsg,format,d);
 +                mir_sntprintf(OutMsg, SIZEOF(OutMsg), format, d);
                  _tcsncpy(format,OutMsg,_countof(OutMsg));
                  j = _tcslen(format);
                  _tcscat(format,_T(" "));
 diff --git a/plugins/ConnectionNotify/src/netstat.cpp b/plugins/ConnectionNotify/src/netstat.cpp index 2dd190c823..36a8302571 100644 --- a/plugins/ConnectionNotify/src/netstat.cpp +++ b/plugins/ConnectionNotify/src/netstat.cpp @@ -1,18 +1,4 @@ -// GetTcpTable.cpp : Defines the entry point for the console application.
 -//
 -
 -// Link to Ws2_32.lib
 -//#include <winsock2.h>
 -#include <ws2tcpip.h>
 -// Link to Iphlpapi.lib
 -#include <iphlpapi.h>
 -#include <stdio.h>
 -#include <tchar.h>
 -#include <m_core.h>
 -#include "netstat.h"
 -// Note: could also use malloc() and free()
 -#define MALLOC(x) HeapAlloc(GetProcessHeap(), 0, (x))
 -#define FREE(x) HeapFree(GetProcessHeap(), 0, (x))
 +#include "ConnectionNotify.h"
  struct CONNECTION* GetConnectionsTable()
  {
 @@ -176,10 +162,10 @@ void getDnsName(TCHAR *strIp,TCHAR *strHostName)  	iaHost.s_addr = inet_addr(mir_t2a(strIp));
  	if ((h = gethostbyaddr ((char *)&iaHost, sizeof(struct in_addr), AF_INET))== NULL)
  		{  // get the host info error
 -			_stprintf(strHostName,_T("%s"), strIp);
 +			_stprintf(strHostName,_T("%s"), strIp); //!!!!!!!!!!!
              return;
          }
 -	_stprintf(strHostName,_T("%s"),mir_a2t(h->h_name));
 +	_stprintf(strHostName,_T("%s"),mir_a2t(h->h_name)); //!!!!!!!!!!!!!
  	//_tcsncpy_s(strHostName,128, h->h_name,_tcslen(h->h_name));
  }
 diff --git a/plugins/ConnectionNotify/src/pid2name.cpp b/plugins/ConnectionNotify/src/pid2name.cpp index 46c51202c7..e3365a574f 100644 --- a/plugins/ConnectionNotify/src/pid2name.cpp +++ b/plugins/ConnectionNotify/src/pid2name.cpp @@ -1,12 +1,4 @@ -#include <Windows.h>
 -// one can also use Winternl.h if needed
 -//#include <Winternl.h> // for UNICODE_STRING and SYSTEM_INFORMATION_CLASS
 -#include <stdio.h>
 -#include <tchar.h>
 -//#include <stdlib.h>
 -
 -#include <Tlhelp32.h>
 -#include "pid2name.h"
 +#include "ConnectionNotify.h"
  void pid2name(DWORD procid,TCHAR* buffer)
  {
 @@ -23,7 +15,7 @@ void pid2name(DWORD procid,TCHAR* buffer)      {
  		if(ProcessStruct.th32ProcessID==procid)
  		{
 -			_stprintf(buffer,_T("%s"),ProcessStruct.szExeFile);
 +			_stprintf(buffer,_T("%s"),ProcessStruct.szExeFile); //!!!!!!!!!!!!
              break;
          }
      }
 diff --git a/plugins/ContactsPlus/src/main.cpp b/plugins/ContactsPlus/src/main.cpp index 5ec4620b46..3cfdef9d1a 100644 --- a/plugins/ContactsPlus/src/main.cpp +++ b/plugins/ContactsPlus/src/main.cpp @@ -83,7 +83,7 @@ static int HookDBEventAdded(WPARAM wParam, LPARAM lParam)      cle.pszService = MS_CONTACTS_RECEIVE;
      WCHAR tmp[MAX_PATH];
 -    _snprintfT(caToolTip, 64, "%s %s", SRCTranslateT("Contacts received from", tmp), (TCHAR*)GetContactDisplayNameT(hContact));
 +    mir_sntprintf(caToolTip, SIZEOF(caToolTip), "%s %s", SRCTranslateT("Contacts received from", tmp), (TCHAR*)GetContactDisplayNameT(hContact));
      cle.ptszTooltip = caToolTip;
      cle.flags |= CLEF_UNICODE;
 diff --git a/plugins/ContactsPlus/src/utils.cpp b/plugins/ContactsPlus/src/utils.cpp index 6c3ac3d073..6490407faf 100644 --- a/plugins/ContactsPlus/src/utils.cpp +++ b/plugins/ContactsPlus/src/utils.cpp @@ -189,7 +189,7 @@ void UpdateDialogTitle(HWND hwndDlg, HANDLE hContact, char* pszTitleStart)          SetDlgItemTextT(hwndDlg, IDC_NAME, uid?uid:contactName);
        szStatus = MirandaStatusToStringT(szProto==NULL ? ID_STATUS_OFFLINE:db_get_w(hContact,szProto,"Status",ID_STATUS_OFFLINE));
 -      _snprintfT(newtitle, 256, "%s %s (%s)", SRCTranslateT(pszTitleStart, str), contactName, szStatus);
 +      mir_sntprintf(newtitle, 256, "%s %s (%s)", SRCTranslateT(pszTitleStart, str), contactName, szStatus);
        SAFE_FREE((void**)&uid);
        SAFE_FREE((void**)&oldTitle);
 @@ -339,22 +339,6 @@ TCHAR* __fastcall strcatT(TCHAR* dest, const TCHAR* src)  	return dest;
  }
 -int _snprintfT(TCHAR *buffer, size_t count, const char* fmt, ...)
 -{
 -	va_list va;
 -	int len;
 -
 -	va_start(va, fmt);
 -	TCHAR* wfmt = ansi_to_tchar(fmt);
 -
 -	len = _vsnwprintf((WCHAR*)buffer, count-1, (WCHAR*)wfmt, va);
 -	((WCHAR*)buffer)[count-1] = 0;
 -	SAFE_FREE((void**)&wfmt);
 -
 -	va_end(va);
 -	return len;
 -}
 -
  TCHAR* __fastcall SRCTranslateT(const char* src, const WCHAR* unibuf)
  { // this takes Ascii strings only!!!
    char* szRes = NULL;
 diff --git a/plugins/ContactsPlus/src/utils.h b/plugins/ContactsPlus/src/utils.h index ecc0df3349..cc21980207 100644 --- a/plugins/ContactsPlus/src/utils.h +++ b/plugins/ContactsPlus/src/utils.h @@ -60,7 +60,6 @@ int __fastcall strcmpT(const TCHAR *string1, const TCHAR *string2);  TCHAR* __fastcall strcpyT(TCHAR* dest, const TCHAR* src);
  TCHAR* __fastcall strncpyT(TCHAR* dest, const TCHAR* src, size_t len);
  TCHAR* __fastcall strcatT(TCHAR* dest, const TCHAR* src);
 -int _snprintfT(TCHAR *buffer, size_t count, const char* fmt, ...);
  LRESULT SendMessageT(HWND hWnd, UINT Msg, WPARAM wParam, LPARAM lParam);
  TCHAR* GetWindowTextT(HWND hWnd);
 diff --git a/plugins/CountryFlags/src/extraimg.cpp b/plugins/CountryFlags/src/extraimg.cpp index f511ee0cf5..11dfeb9470 100644 --- a/plugins/CountryFlags/src/extraimg.cpp +++ b/plugins/CountryFlags/src/extraimg.cpp @@ -55,7 +55,7 @@ static void CALLBACK SetExtraImage(HANDLE hContact)  		ExtraIcon_Clear(hExtraIcon, hContact);
  	else {
  		char szId[20];
 -		wsprintfA(szId, (countryNumber == 0xFFFF) ? "%s0x%X" : "%s%i", "flags_", countryNumber);
 +		mir_snprintf(szId, SIZEOF(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 5724db6a8b..93354139ae 100644 --- a/plugins/CountryFlags/src/icons.cpp +++ b/plugins/CountryFlags/src/icons.cpp @@ -146,7 +146,7 @@ HICON __fastcall LoadFlagIcon(int countryNumber)  		szCountry = (char*)CallService(MS_UTILS_GETCOUNTRYBYNUMBER, countryNumber = 0xFFFF, 0);
  	char szId[20];
 -	wsprintfA(szId, (countryNumber == 0xFFFF) ? "%s0x%X" : "%s%i", "flags_", countryNumber); /* buffer safe */
 +	mir_snprintf(szId, SIZEOF(szId), (countryNumber == 0xFFFF) ? "%s0x%X" : "%s%i", "flags_", countryNumber); /* buffer safe */
  	return Skin_GetIcon(szId);
  }
 @@ -245,7 +245,7 @@ void InitIcons(void)  				sid.pszDescription = (char*)countries[i].szName;
  				/* create identifier */
 -				wsprintfA(szId,(countries[i].id == 0xFFFF) ? "%s0x%X" : "%s%i","flags_", countries[i].id); /* buffer safe */
 +				mir_snprintf(szId, SIZEOF(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/CrashDumper/src/crshdmp.cpp b/plugins/CrashDumper/src/crshdmp.cpp index 7bb5e53445..beccc35107 100644 --- a/plugins/CrashDumper/src/crshdmp.cpp +++ b/plugins/CrashDumper/src/crshdmp.cpp @@ -70,7 +70,7 @@ INT_PTR StoreVersionInfoToFile(WPARAM, LPARAM lParam)  	CreateDirectoryTree(VersionInfoFolder);
  	TCHAR path[MAX_PATH];
 -	crs_sntprintf(path, MAX_PATH, TEXT("%s\\VersionInfo.txt"), VersionInfoFolder);
 +	mir_sntprintf(path, MAX_PATH, TEXT("%s\\VersionInfo.txt"), VersionInfoFolder);
  	HANDLE hDumpFile = CreateFile(path, GENERIC_WRITE, 0, NULL,
  		CREATE_ALWAYS, FILE_ATTRIBUTE_NORMAL, NULL);
 @@ -235,8 +235,8 @@ static int ModulesLoaded(WPARAM, LPARAM)  	else
  		profpath = Utils_ReplaceVarsT(_T("%miranda_userdata%"));
 -	crs_sntprintf(CrashLogFolder, MAX_PATH, TEXT("%s\\CrashLog"), profpath);
 -	crs_sntprintf(VersionInfoFolder, MAX_PATH, TEXT("%s"), profpath);
 +	mir_sntprintf(CrashLogFolder, MAX_PATH, TEXT("%s\\CrashLog"), profpath);
 +	mir_sntprintf(VersionInfoFolder, MAX_PATH, TEXT("%s"), profpath);
  	SetExceptionHandler();
 diff --git a/plugins/CrashDumper/src/dumper.cpp b/plugins/CrashDumper/src/dumper.cpp index 3e9afe3d28..6aebac5e05 100644 --- a/plugins/CrashDumper/src/dumper.cpp +++ b/plugins/CrashDumper/src/dumper.cpp @@ -184,7 +184,7 @@ static void GetPluginsString(bkstring& buffer, unsigned& flags)  	LPTSTR fname = _tcsrchr(path, TEXT('\\'));
  	if (fname == NULL) fname = path;
 -	crs_sntprintf(fname, MAX_PATH-(fname-path), TEXT("\\plugins\\*.dll"));
 +	mir_sntprintf(fname, MAX_PATH-(fname-path), TEXT("\\plugins\\*.dll"));
  	WIN32_FIND_DATA FindFileData;
  	HANDLE hFind = FindFirstFile(path, &FindFileData);
 @@ -202,7 +202,7 @@ static void GetPluginsString(bkstring& buffer, unsigned& flags)  	do 
  	{
  		bool loaded = false;
 -		crs_sntprintf(fname, MAX_PATH-(fname-path), TEXT("\\plugins\\%s"), FindFileData.cFileName);
 +		mir_sntprintf(fname, MAX_PATH-(fname-path), TEXT("\\plugins\\%s"), FindFileData.cFileName);
  		HMODULE hModule = GetModuleHandle(path);
  		if (hModule == NULL && servicemode) 
  		{
 @@ -375,7 +375,7 @@ static void GetWeatherStrings(bkstring& buffer, unsigned flags)  	LPTSTR fname = _tcsrchr(path, TEXT('\\'));
  	if (fname == NULL) fname = path;
 -	crs_sntprintf(fname, MAX_PATH-(fname-path), TEXT("\\plugins\\weather\\*.ini"));
 +	mir_sntprintf(fname, MAX_PATH-(fname-path), TEXT("\\plugins\\weather\\*.ini"));
  	WIN32_FIND_DATA FindFileData;
  	HANDLE hFind = FindFirstFile(path, &FindFileData);
 @@ -385,7 +385,7 @@ static void GetWeatherStrings(bkstring& buffer, unsigned flags)  	{
  		if (FindFileData.dwFileAttributes & FILE_ATTRIBUTE_DIRECTORY) continue;
 -		crs_sntprintf(fname, MAX_PATH-(fname-path), TEXT("\\plugins\\weather\\%s"), FindFileData.cFileName);
 +		mir_sntprintf(fname, MAX_PATH-(fname-path), TEXT("\\plugins\\weather\\%s"), FindFileData.cFileName);
  		HANDLE hDumpFile = CreateFile(path, GENERIC_READ, FILE_SHARE_READ, NULL,
  			OPEN_EXISTING, FILE_ATTRIBUTE_NORMAL, NULL);
 @@ -449,7 +449,7 @@ static void GetIconStrings(bkstring& buffer)  	LPTSTR fname = _tcsrchr(path, TEXT('\\'));
  	if (fname == NULL) fname = path;
 -	crs_sntprintf(fname, MAX_PATH-(fname-path), TEXT("\\Icons\\*.*"));
 +	mir_sntprintf(fname, MAX_PATH-(fname-path), TEXT("\\Icons\\*.*"));
  	WIN32_FIND_DATA FindFileData;
  	HANDLE hFind = FindFirstFile(path, &FindFileData);
 @@ -506,7 +506,7 @@ void PrintVersionInfo(bkstring& buffer, unsigned flags)  	buffer.appendfmt(TEXT("Build time: %s\r\n"), mirtime); 
  	TCHAR profpn[MAX_PATH];
 -	crs_sntprintf(profpn, SIZEOF(profpn), TEXT("%s\\%s"), profpathfull, profname);
 +	mir_sntprintf(profpn, SIZEOF(profpn), TEXT("%s\\%s"), profpathfull, profname);
  	buffer.appendfmt(TEXT("Profile: %s\r\n"), profpn);
 diff --git a/plugins/CrashDumper/src/exhndlr.cpp b/plugins/CrashDumper/src/exhndlr.cpp index 16320f2170..7876389280 100644 --- a/plugins/CrashDumper/src/exhndlr.cpp +++ b/plugins/CrashDumper/src/exhndlr.cpp @@ -73,14 +73,14 @@ void myfilterWorker(PEXCEPTION_POINTERS exc_ptr, bool notify)  	{
  		if (dtsubfldr)
  		{
 -			crs_sntprintf(path, MAX_PATH, TEXT("%s\\%02d.%02d.%02d"), CrashLogFolder, st.wYear, st.wMonth, st.wDay);
 +			mir_sntprintf(path, MAX_PATH, TEXT("%s\\%02d.%02d.%02d"), CrashLogFolder, st.wYear, st.wMonth, st.wDay);
  			CreateDirectory(path, NULL);
 -			crs_sntprintf(path, MAX_PATH, TEXT("%s\\%02d.%02d.%02d\\crash%02d%02d%02d%02d%02d%02d.mdmp"), CrashLogFolder, 
 +			mir_sntprintf(path, MAX_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
  		{
 -			crs_sntprintf(path, MAX_PATH, TEXT("%s\\crash%02d%02d%02d%02d%02d%02d.mdmp"), CrashLogFolder, 
 +			mir_sntprintf(path, MAX_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);
 @@ -101,19 +101,19 @@ void myfilterWorker(PEXCEPTION_POINTERS exc_ptr, bool notify)  	{
  		if (dtsubfldr)
  		{
 -			crs_sntprintf(path, MAX_PATH, TEXT("%s\\%02d.%02d.%02d"), CrashLogFolder, st.wYear, st.wMonth, st.wDay);
 +			mir_sntprintf(path, MAX_PATH, TEXT("%s\\%02d.%02d.%02d"), CrashLogFolder, st.wYear, st.wMonth, st.wDay);
  			CreateDirectory(path, NULL);
 -			crs_sntprintf(path, MAX_PATH, TEXT("%s\\%02d.%02d.%02d\\crash%02d%02d%02d%02d%02d%02d.txt"), CrashLogFolder, 
 +			mir_sntprintf(path, MAX_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
  		{
 -			crs_sntprintf(path, MAX_PATH, TEXT("%s\\crash%02d%02d%02d%02d%02d%02d.txt"), CrashLogFolder, 
 +			mir_sntprintf(path, MAX_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);
 -		crs_sntprintf(path, MAX_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, MAX_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 e9563cd127..d2eb282b3f 100644 --- a/plugins/CrashDumper/src/ui.cpp +++ b/plugins/CrashDumper/src/ui.cpp @@ -287,7 +287,7 @@ LRESULT CALLBACK DlgProcPopup(HWND hWnd, UINT msg, WPARAM wParam, LPARAM lParam)  		case 3:
  			TCHAR path[MAX_PATH];
 -			crs_sntprintf(path, MAX_PATH, TEXT("%s\\VersionInfo.txt"), VersionInfoFolder);
 +			mir_sntprintf(path, MAX_PATH, TEXT("%s\\VersionInfo.txt"), VersionInfoFolder);
  			ShellExecute(NULL, TEXT("open"), path, NULL, NULL, SW_SHOW);
  			break;
 @@ -310,7 +310,7 @@ void ShowMessage(int type, const TCHAR* format, ...)  	va_list va;
  	va_start(va, format);
 -	int len = _vsntprintf(pi.lptzText, SIZEOF(pi.lptzText)-1, format, va);
 +	int len = mir_vsntprintf(pi.lptzText, SIZEOF(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 1bb3b770aa..f7d1e5d8a1 100644 --- a/plugins/CrashDumper/src/utils.cpp +++ b/plugins/CrashDumper/src/utils.cpp @@ -329,7 +329,7 @@ void GetISO8061Time(SYSTEMTIME* stLocal, LPTSTR lpszString, DWORD dwSize)  		int offset = GetTZOffset();
  		// Build a string showing the date and time.
 -		crs_sntprintf(lpszString, dwSize, TEXT("%d-%02d-%02d %02d:%02d:%02d%+03d%02d"), 
 +		mir_sntprintf(lpszString, dwSize, TEXT("%d-%02d-%02d %02d:%02d:%02d%+03d%02d"), 
  			stLocal->wYear, stLocal->wMonth, stLocal->wDay, 
  			stLocal->wHour, stLocal->wMinute, stLocal->wSecond,
  			offset / 60, offset % 60);
 @@ -695,14 +695,14 @@ void GetLanguagePackString(bkstring& buffer)  		LPTSTR fname = _tcsrchr(path, TEXT('\\'));
  		if (fname == NULL) fname = path;
 -		crs_sntprintf(fname, MAX_PATH-(fname-path), TEXT("\\langpack_*.txt"));
 +		mir_sntprintf(fname, MAX_PATH-(fname-path), TEXT("\\langpack_*.txt"));
  		WIN32_FIND_DATA FindFileData;
  		HANDLE hFind = FindFirstFile(path, &FindFileData);
  		if (hFind == INVALID_HANDLE_VALUE) return;
  		FindClose(hFind);
 -		crs_sntprintf(fname, MAX_PATH-(fname-path), TEXT("\\%s"), FindFileData.cFileName);
 +		mir_sntprintf(fname, MAX_PATH-(fname-path), TEXT("\\%s"), FindFileData.cFileName);
  		HANDLE hDumpFile = CreateFile(path, GENERIC_READ, FILE_SHARE_READ, NULL,
  			OPEN_EXISTING, FILE_ATTRIBUTE_NORMAL, NULL);
 @@ -768,18 +768,6 @@ bool CreateDirectoryTree(LPTSTR szDir)  	return res;
  }
 -int crs_sntprintf(TCHAR *buffer, size_t count, const TCHAR* fmt, ...)
 -{
 -	va_list va;
 -	va_start(va, fmt);
 -
 -	int len = _vsntprintf(buffer, count-1, fmt, va);
 -	buffer[len] = 0;
 -
 -	va_end(va);
 -	return len;
 -}
 -
  void GetVersionInfo(HMODULE hLib, bkstring& buffer)
  {
  	HRSRC hVersion = FindResource(hLib, MAKEINTRESOURCE(VS_VERSION_INFO), RT_VERSION);
 diff --git a/plugins/CrashDumper/src/utils.h b/plugins/CrashDumper/src/utils.h index 0399c28bb3..50ac39470f 100644 --- a/plugins/CrashDumper/src/utils.h +++ b/plugins/CrashDumper/src/utils.h @@ -46,8 +46,6 @@ along with this program.  If not, see <http://www.gnu.org/licenses/>.  #define MS_PROTO_ENUMPROTOS        "Proto/EnumProtos"
 -int  crs_sntprintf(TCHAR *buffer, size_t count, const TCHAR* fmt, ...);
 -
  #define crsi_u2a(dst, src) \
  { \
  	int cbLen = WideCharToMultiByte(CP_ACP, 0, src, -1, NULL, 0, NULL, NULL); \
 diff --git a/plugins/Exchange/src/MirandaExchange.cpp b/plugins/Exchange/src/MirandaExchange.cpp index b0fad31eb1..4424014d2d 100644 --- a/plugins/Exchange/src/MirandaExchange.cpp +++ b/plugins/Exchange/src/MirandaExchange.cpp @@ -558,8 +558,6 @@ HRESULT CMirandaExchange::InitializeAndLogin( LPCTSTR szUsername, LPCTSTR szPass  HRESULT CMirandaExchange::CreateProfile( LPTSTR szProfileName )
  {
 -	//TCHAR sz[200];_stprintf(sz, "Create Profile('%s', '%s', '%s')", szProfileName, m_szUsername, m_szExchangeServer);Log(sz);
 -	
  	HRESULT			hr				=	S_OK;
  	CMAPIInterface<LPPROFADMIN>		pProfAdmin		=	NULL;
  	CMAPIInterface<LPSERVICEADMIN>	pMsgSvcAdmin	=	NULL;
 diff --git a/plugins/FavContacts/src/http_api.cpp b/plugins/FavContacts/src/http_api.cpp index 0806cddcd9..18bae918ee 100644 --- a/plugins/FavContacts/src/http_api.cpp +++ b/plugins/FavContacts/src/http_api.cpp @@ -104,7 +104,7 @@ public:  	void Send(int i)
  	{
  		char buf[32];
 -		wsprintfA(buf, "%d", i);
 +		mir_snprintf(buf, SIZEOF(buf), "%d", i);
  		Send(buf);
  	}
 diff --git a/plugins/FavContacts/src/main.cpp b/plugins/FavContacts/src/main.cpp index f49a580c55..2350138fdd 100644 --- a/plugins/FavContacts/src/main.cpp +++ b/plugins/FavContacts/src/main.cpp @@ -355,7 +355,7 @@ static bool sttIsGroup(int id)  	DBVARIANT dbv = {0};
  	char buf[32];
 -	wsprintfA(buf, "%d", (int)(id-2));
 +	mir_snprintf(buf, SIZEOF(buf), "%d", (int)(id - 2));
  	if (!db_get_ts(NULL, "CListGroups", buf, &dbv))
  	{
  		db_free(&dbv);
 @@ -375,7 +375,7 @@ static TCHAR *sttGetGroupName(int id)  	DBVARIANT dbv = {0};
  	char buf[32];
 -	wsprintfA(buf, "%d", (int)(id-2));
 +	mir_snprintf(buf, SIZEOF(buf), "%d", (int)(id - 2));
  	if (!db_get_ts(NULL, "CListGroups", buf, &dbv))
  	{
  		TCHAR *res = mir_tstrdup(dbv.ptszVal+1);
 @@ -391,7 +391,7 @@ static int sttGetGroupId(TCHAR *name)  	{
  		DBVARIANT dbv = {0};
  		char buf[32];
 -		wsprintfA(buf, "%d", (int)i);
 +		mir_snprintf(buf, SIZEOF(buf), "%d", (int)i);
  		if (!db_get_ts(NULL, "CListGroups", buf, &dbv))
  		{
  			if (!lstrcmp(dbv.ptszVal+1, name))
 diff --git a/plugins/FlashAvatars/src/cflash.cpp b/plugins/FlashAvatars/src/cflash.cpp index 25dcfb5856..87961b5c0b 100644 --- a/plugins/FlashAvatars/src/cflash.cpp +++ b/plugins/FlashAvatars/src/cflash.cpp @@ -182,7 +182,7 @@ static void __cdecl loadFlash_Thread(void *p) {  		}
  		CreateDirectory(path, NULL); // create directory if it doesn't exist
 -		_sntprintf(name, MAX_PATH, _T("%s\\%s.swf"), path, th.toBase32(tth));
 +		mir_sntprintf(name, MAX_PATH, _T("%s\\%s.swf"), path, th.toBase32(tth));
  		// download remote file if it doesn't exist
  		if (GetFileAttributes(name) == 0xFFFFFFFF) {
 @@ -446,7 +446,7 @@ static INT_PTR setBkColor(WPARAM wParam, LPARAM lParam)  		IShockwaveFlash* flash = item->pFlash;
  		char buf[10];
 -		_snprintf(buf, sizeof(buf), "%02X%02X%02X", LOBYTE(LOWORD(clr)), HIBYTE(LOWORD(clr)), LOBYTE(HIWORD(clr)));
 +		mir_snprintf(buf, sizeof(buf), "%02X%02X%02X", LOBYTE(LOWORD(clr)), HIBYTE(LOWORD(clr)), LOBYTE(HIWORD(clr)));
  		flash->put_BGColor(_bstr_t(buf));
  	}
  	return 0;
 diff --git a/plugins/FlashAvatars/src/stdafx.h b/plugins/FlashAvatars/src/stdafx.h index fb175de920..f571759135 100644 --- a/plugins/FlashAvatars/src/stdafx.h +++ b/plugins/FlashAvatars/src/stdafx.h @@ -58,7 +58,7 @@ inline void _cdecl debugTrace(const char* format, ...)  	char buf[512];
 -	_vsnprintf(buf, sizeof(buf), format, args);
 +	mir_vsnprintf(buf, sizeof(buf), format, args);
  	OutputDebugStringA(buf);
  	va_end(args);
  }
 diff --git a/plugins/FloatingContacts/src/options.cpp b/plugins/FloatingContacts/src/options.cpp index 0ec7c56a44..be3a659c47 100644 --- a/plugins/FloatingContacts/src/options.cpp +++ b/plugins/FloatingContacts/src/options.cpp @@ -200,7 +200,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);
 -			wsprintfA(szPercent, "%d%%", btOpacity);
 +			mir_snprintf(szPercent, SIZEOF(szPercent), "%d%%", btOpacity);
  			SetDlgItemTextA(hwndDlg, IDC_OPACITY, szPercent);
  			EnableWindow(GetDlgItem(hwndDlg, IDC_SLIDER_OPACITY), pSetLayeredWindowAttributes != 0);
 @@ -231,7 +231,7 @@ static INT_PTR APIENTRY OptSknWndProc(HWND hwndDlg, UINT uMsg, WPARAM wParam, LP  			fcOpt.thumbAlpha = (BYTE)(( nPos * 255 ) / 100 );
  			SetThumbsOpacity(fcOpt.thumbAlpha);
 -			wsprintfA(szPercent, "%d%%", nPos);
 +			mir_snprintf(szPercent, SIZEOF(szPercent), "%d%%", nPos);
  			SetDlgItemTextA(hwndDlg, IDC_OPACITY, szPercent);
  			SendMessage(GetParent(hwndDlg), PSM_CHANGED, 0, 0);
  		}
 diff --git a/plugins/HTTPServer/src/HttpUser.cpp b/plugins/HTTPServer/src/HttpUser.cpp index e64656d93e..428a5cb087 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, sizeof(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, sizeof(szBuff),
  	    "HTTP/1.1 %i %s\r\n"
  	    "Date: %s\r\n"
  	    "Server: MirandaWeb/%s\r\n"
 @@ -616,11 +616,11 @@ bool CLHttpUser::bProcessGetRequest(char * pszRequest, bool bIsGetCommand) {  				    "Last-Modified: %s\r\n"
  				    "\r\n";
 -				dwBytesToWrite = mir_snprintf(szBuf, sizeof(szBuf), szHttpPartial ,
 -				    szCurTime ,
 +				dwBytesToWrite = mir_snprintf(szBuf, sizeof(szBuf), szHttpPartial,
 +				    szCurTime,
  				    PLUGIN_MAKE_VERSION(__MAJOR_VERSION, __MINOR_VERSION, __RELEASE_NUM, __BUILD_NUM),
 -				    szETag ,
 -				    dwDataToSend ,
 +				    szETag,
 +				    dwDataToSend,
  				    pszGetMimeType(pszRealPath),
  				    dwFileStart,
  				    (dwFileStart + dwDataToSend - 1),
 @@ -638,11 +638,11 @@ bool CLHttpUser::bProcessGetRequest(char * pszRequest, bool bIsGetCommand) {  				    "Last-Modified: %s\r\n"
  				    "\r\n";
 -				dwBytesToWrite = mir_snprintf(szBuf, sizeof(szBuf), szHttpOk ,
 -				    szCurTime ,
 +				dwBytesToWrite = mir_snprintf(szBuf, sizeof(szBuf), szHttpOk,
 +				    szCurTime,
  				    PLUGIN_MAKE_VERSION(__MAJOR_VERSION, __MINOR_VERSION, __RELEASE_NUM, __BUILD_NUM),
 -				    szETag ,
 -				    nDataSize ,
 +				    szETag,
 +				    nDataSize,
  				    pszGetMimeType(pszRealPath),
  				    szFileTime);
  			}
 @@ -671,11 +671,7 @@ bool CLHttpUser::bProcessGetRequest(char * pszRequest, bool bIsGetCommand) {  				for (;;) {
  					{
  						DWORD dwCurTick = GetTickCount();
 -						if (dwCurTick - dwLastUpdate >= 1000) {/*
 -						 char szTmp[200];
 -						 _snprintf( szTmp, sizeof( szTmp ), "Bytes tr %d Time %d Tick %d\n", dwCurrentDL - dwLastCurrentDL, dwCurTick - dwLastUpdate, dwCurTick );
 -						 OutputDebugString( szTmp );
 -						 */
 +						if (dwCurTick - dwLastUpdate >= 1000) {
  							dwSpeed = ((dwCurrentDL - dwLastCurrentDL) * 1000) / (dwCurTick - dwLastUpdate);
  							dwLastUpdate = dwCurTick;
  							dwLastCurrentDL = dwCurrentDL;
 @@ -723,11 +719,6 @@ bool CLHttpUser::bProcessGetRequest(char * pszRequest, bool bIsGetCommand) {  						dwLastResetTime = GetTickCount();
  						nMaxBytesToSend = nMaxUploadSpeed / nThreadCount;
  					}
 -					/*
 -					char szTmp[200];
 -					_snprintf( szTmp, sizeof( szTmp ), "Current status : %d %% pos %d size %d\n", (dwCurrentDL * 100) / dwTotalSize, dwCurrentDL , dwTotalSize );
 -					OutputDebugString( szTmp );
 -					*/
  				}
  				// file is always closed in destructor 
 @@ -738,13 +729,6 @@ bool CLHttpUser::bProcessGetRequest(char * pszRequest, bool bIsGetCommand) {  					DeleteFile(szTempfile);
  				}
 -				/*
 -				{
 -				char szBuf[200];
 -				_snprintf( szBuf, sizeof( szBuf ), "File Transfer stoped %d transfer complete %d\n", GetTickCount(), dwCurrentDL == nDataSize);
 -				OutputDebugString( szBuf );
 -				}
 -				*/
  				clCritSection.Lock();
  				nThreadCount--;
 diff --git a/plugins/HTTPServer/src/main.cpp b/plugins/HTTPServer/src/main.cpp index f71fe47ac0..3e476d40b8 100644 --- a/plugins/HTTPServer/src/main.cpp +++ b/plugins/HTTPServer/src/main.cpp @@ -602,10 +602,6 @@ static int nProtoAck(WPARAM /*wParam*/, LPARAM lParam) {  		return 0;
  	bIsOnline = ((int)ack->lParam != ID_STATUS_AWAY && (int)ack->lParam != ID_STATUS_NA);
 -	/*
 -	char szTmp[200];
 -	_snprintf( szTmp, sizeof( szTmp ), "%s New status %d\n" ,ack->szModule, (int)bIsOnline);
 -	OutputDebugString( szTmp );*/
  	return 0;
  }
 diff --git a/plugins/IEView/src/HistoryHTMLBuilder.cpp b/plugins/IEView/src/HistoryHTMLBuilder.cpp index 5d454b7f54..6ba7cbd57e 100644 --- a/plugins/IEView/src/HistoryHTMLBuilder.cpp +++ b/plugins/IEView/src/HistoryHTMLBuilder.cpp @@ -98,34 +98,34 @@ void HistoryHTMLBuilder::loadMsgDlgFont(const char *dbSetting, LOGFONTA * lf, CO  	int style;
  	DBVARIANT dbv;
  	if (bkgColour) {
 -		wsprintfA(str, "Back.%s", dbSetting);
 +		mir_snprintf(str, SIZEOF(str), "Back.%s", dbSetting);
  		*bkgColour = db_get_dw(NULL, HPPMOD, str, 0xFFFFFF);
  	}
  	if (colour) {
 -		wsprintfA(str, "Font.%s.Color", dbSetting);
 +		mir_snprintf(str, SIZEOF(str), "Font.%s.Color", dbSetting);
  		*colour = db_get_dw(NULL, HPPMOD, str, 0x000000);
  	}
  	if (lf) {
 -		wsprintfA(str, "Font.%s.Size", dbSetting);
 +		mir_snprintf(str, SIZEOF(str), "Font.%s.Size", dbSetting);
  		lf->lfHeight = (char) db_get_b(NULL, HPPMOD, str, 10);
  		lf->lfWidth = 0;
  		lf->lfEscapement = 0;
  		lf->lfOrientation = 0;
 -		wsprintfA(str, "Font.%s.Style.Bold", dbSetting);
 +		mir_snprintf(str, SIZEOF(str), "Font.%s.Style.Bold", dbSetting);
  		style = db_get_b(NULL, HPPMOD, str, 0);
  		lf->lfWeight = style & FONTF_BOLD ? FW_BOLD : FW_NORMAL;
 -		wsprintfA(str, "Font.%s.Style.Italic", dbSetting);
 +		mir_snprintf(str, SIZEOF(str), "Font.%s.Style.Italic", dbSetting);
  		style = db_get_b(NULL, HPPMOD, str, 0) << 1;
  		lf->lfItalic = style & FONTF_ITALIC ? 1 : 0;
  		lf->lfUnderline = style & FONTF_UNDERLINE ? 1 : 0;
  		lf->lfStrikeOut = 0;
 -		wsprintfA(str, "Font.%s.Charset", dbSetting);
 +		mir_snprintf(str, SIZEOF(str), "Font.%s.Charset", dbSetting);
  		lf->lfCharSet = db_get_b(NULL, HPPMOD, str, DEFAULT_CHARSET);
  		lf->lfOutPrecision = OUT_DEFAULT_PRECIS;
  		lf->lfClipPrecision = CLIP_DEFAULT_PRECIS;
  		lf->lfQuality = DEFAULT_QUALITY;
  		lf->lfPitchAndFamily = DEFAULT_PITCH | FF_DONTCARE;
 -		wsprintfA(str, "Font.%s.Name", dbSetting);
 +		mir_snprintf(str, SIZEOF(str), "Font.%s.Name", dbSetting);
  		if (db_get(NULL, HPPMOD, str, &dbv))
  			lstrcpyA(lf->lfFaceName, "Verdana");
  		else {
 diff --git a/plugins/IEView/src/IEView.cpp b/plugins/IEView/src/IEView.cpp index edecd1e419..1925a59f98 100644 --- a/plugins/IEView/src/IEView.cpp +++ b/plugins/IEView/src/IEView.cpp @@ -894,7 +894,7 @@ void IEView::writef(const char *fmt, ...)  	int strsize;
  	va_start(vararg, fmt);
  	str = (char *) malloc(strsize=2048);
 -	while (_vsnprintf(str, strsize, fmt, vararg) == -1)
 +	while (mir_vsnprintf(str, strsize, fmt, vararg) == -1)
  		str = (char *) realloc(str, strsize+=2048);
  	va_end(vararg);
  	write(str);
 diff --git a/plugins/IEView/src/MUCCHTMLBuilder.cpp b/plugins/IEView/src/MUCCHTMLBuilder.cpp index e6feaa0761..51e8f7f628 100644 --- a/plugins/IEView/src/MUCCHTMLBuilder.cpp +++ b/plugins/IEView/src/MUCCHTMLBuilder.cpp @@ -44,29 +44,29 @@ void MUCCHTMLBuilder::loadMsgDlgFont(int i, LOGFONTA * lf, COLORREF * colour) {  	int style;
  	DBVARIANT dbv;
  	if (colour) {
 -		wsprintfA(str, "Font%dCol", i);
 +		mir_snprintf(str, SIZEOF(str), "Font%dCol", i);
  		*colour = db_get_dw(NULL, MUCCMOD, str, 0x000000);
  	}
  	if (lf) {
 -		wsprintfA(str, "Font%dSize", i);
 +		mir_snprintf(str, SIZEOF(str), "Font%dSize", i);
  		lf->lfHeight = (char) db_get_b(NULL, MUCCMOD, str, 10);
  		lf->lfHeight = abs(lf->lfHeight);
  		lf->lfWidth = 0;
  		lf->lfEscapement = 0;
  		lf->lfOrientation = 0;
 -		wsprintfA(str, "Font%dStyle", i);
 +		mir_snprintf(str, SIZEOF(str), "Font%dStyle", i);
  		style = db_get_b(NULL, MUCCMOD, str, 0);
  		lf->lfWeight = style & FONTF_BOLD ? FW_BOLD : FW_NORMAL;
  		lf->lfItalic = style & FONTF_ITALIC ? 1 : 0;
  		lf->lfUnderline = style & FONTF_UNDERLINE ? 1 : 0;
  		lf->lfStrikeOut = 0;
 -		wsprintfA(str, "Font%dSet", i);
 +		mir_snprintf(str, SIZEOF(str), "Font%dSet", i);
  		lf->lfCharSet = db_get_b(NULL, MUCCMOD, str, DEFAULT_CHARSET);
  		lf->lfOutPrecision = OUT_DEFAULT_PRECIS;
  		lf->lfClipPrecision = CLIP_DEFAULT_PRECIS;
  		lf->lfQuality = DEFAULT_QUALITY;
  		lf->lfPitchAndFamily = DEFAULT_PITCH | FF_DONTCARE;
 -		wsprintfA(str, "Font%dFace", i);
 +		mir_snprintf(str, SIZEOF(str), "Font%dFace", i);
  		if (db_get(NULL, MUCCMOD, str, &dbv))
  			lstrcpyA(lf->lfFaceName, "Verdana");
  		else {
 diff --git a/plugins/IEView/src/ScriverHTMLBuilder.cpp b/plugins/IEView/src/ScriverHTMLBuilder.cpp index 642b2083ad..af97c04504 100644 --- a/plugins/IEView/src/ScriverHTMLBuilder.cpp +++ b/plugins/IEView/src/ScriverHTMLBuilder.cpp @@ -88,29 +88,29 @@ void ScriverHTMLBuilder::loadMsgDlgFont(int i, LOGFONTA * lf, COLORREF * colour)  	int style;
  	DBVARIANT dbv;
  	if (colour) {
 -		wsprintfA(str, "SRMFont%dCol", i);
 +		mir_snprintf(str, SIZEOF(str), "SRMFont%dCol", i);
  		*colour = db_get_dw(NULL, SRMMMOD, str, 0x000000);
  	}
  	if (lf) {
 -		wsprintfA(str, "SRMFont%dSize", i);
 +		mir_snprintf(str, SIZEOF(str), "SRMFont%dSize", i);
  		lf->lfHeight = (char) db_get_b(NULL, SRMMMOD, str, 10);
  		lf->lfHeight = abs(lf->lfHeight);
  		lf->lfWidth = 0;
  		lf->lfEscapement = 0;
  		lf->lfOrientation = 0;
 -		wsprintfA(str, "SRMFont%dSty", i);
 +		mir_snprintf(str, SIZEOF(str), "SRMFont%dSty", i);
  		style = db_get_b(NULL, SRMMMOD, str, 0);
  		lf->lfWeight = style & FONTF_BOLD ? FW_BOLD : FW_NORMAL;
  		lf->lfItalic = style & FONTF_ITALIC ? 1 : 0;
  		lf->lfUnderline = style & FONTF_UNDERLINE ? 1 : 0;
  		lf->lfStrikeOut = 0;
 -		wsprintfA(str, "SRMFont%dSet", i);
 +		mir_snprintf(str, SIZEOF(str), "SRMFont%dSet", i);
  		lf->lfCharSet = db_get_b(NULL, SRMMMOD, str, DEFAULT_CHARSET);
  		lf->lfOutPrecision = OUT_DEFAULT_PRECIS;
  		lf->lfClipPrecision = CLIP_DEFAULT_PRECIS;
  		lf->lfQuality = DEFAULT_QUALITY;
  		lf->lfPitchAndFamily = DEFAULT_PITCH | FF_DONTCARE;
 -		wsprintfA(str, "SRMFont%d", i);
 +		mir_snprintf(str, SIZEOF(str), "SRMFont%d", i);
  		if (db_get(NULL, SRMMMOD, str, &dbv))
  			lstrcpyA(lf->lfFaceName, "Verdana");
  		else {
 diff --git a/plugins/IEView/src/TabSRMMHTMLBuilder.cpp b/plugins/IEView/src/TabSRMMHTMLBuilder.cpp index 120024509c..7326240b77 100644 --- a/plugins/IEView/src/TabSRMMHTMLBuilder.cpp +++ b/plugins/IEView/src/TabSRMMHTMLBuilder.cpp @@ -115,12 +115,12 @@ void TabSRMMHTMLBuilder::loadMsgDlgFont(int i, LOGFONTA * lf, COLORREF * colour)  	int style;
  	DBVARIANT dbv;
  	if (colour) {
 -		wsprintfA(str, "Font%dCol", i);
 +		mir_snprintf(str, SIZEOF(str), "Font%dCol", i);
  		*colour = db_get_dw(NULL, TABSRMM_FONTMODULE, str, 0x000000);
  	}
  	if (lf) {
  		HDC hdc = GetDC(NULL);
 -		wsprintfA(str, "Font%dSize", i);
 +		mir_snprintf(str, SIZEOF(str), "Font%dSize", i);
  //		if(i == H_MSGFONTID_DIVIDERS)
    //		  lf->lfHeight = 5;
  	 //   else {
 @@ -131,19 +131,19 @@ void TabSRMMHTMLBuilder::loadMsgDlgFont(int i, LOGFONTA * lf, COLORREF * colour)  		lf->lfWidth = 0;
  		lf->lfEscapement = 0;
  		lf->lfOrientation = 0;
 -		wsprintfA(str, "Font%dSty", i);
 +		mir_snprintf(str, SIZEOF(str), "Font%dSty", i);
  		style = db_get_b(NULL, TABSRMM_FONTMODULE, str, 0);
  		lf->lfWeight = style & FONTF_BOLD ? FW_BOLD : FW_NORMAL;
  		lf->lfItalic = style & FONTF_ITALIC ? 1 : 0;
  		lf->lfUnderline = style & FONTF_UNDERLINE ? 1 : 0;
  		lf->lfStrikeOut = 0;
 -		wsprintfA(str, "Font%dSet", i);
 +		mir_snprintf(str, SIZEOF(str), "Font%dSet", i);
  		lf->lfCharSet = db_get_b(NULL, TABSRMM_FONTMODULE, str, DEFAULT_CHARSET);
  		lf->lfOutPrecision = OUT_DEFAULT_PRECIS;
  		lf->lfClipPrecision = CLIP_DEFAULT_PRECIS;
  		lf->lfQuality = DEFAULT_QUALITY;
  		lf->lfPitchAndFamily = DEFAULT_PITCH | FF_DONTCARE;
 -		wsprintfA(str, "Font%d", i);
 +		mir_snprintf(str, SIZEOF(str), "Font%d", i);
  		if (db_get(NULL, TABSRMM_FONTMODULE, str, &dbv))
  			lstrcpyA(lf->lfFaceName, "Verdana");
  		else {
 diff --git a/plugins/IEView/src/Utils.cpp b/plugins/IEView/src/Utils.cpp index 85a4f07be6..4c7b0ddf8d 100644 --- a/plugins/IEView/src/Utils.cpp +++ b/plugins/IEView/src/Utils.cpp @@ -74,7 +74,7 @@ void Utils::appendText(char **str, int *sizeAlloced, const char *fmt, ...)  	}
  	p = *str + len;
  	va_start(vararg, fmt);
 -	while (_vsnprintf(p, size  - 1, fmt, vararg) == -1) {
 +	while (mir_vsnprintf(p, size  - 1, fmt, vararg) == -1) {
  		size += 2048;
  		(*sizeAlloced) += 2048;
  		*str = (char *) realloc(*str, *sizeAlloced);
 @@ -109,7 +109,7 @@ void Utils::appendText(wchar_t **str, int *sizeAlloced, const wchar_t *fmt, ...)  	}
  	p = *str + len;
  	va_start(vararg, fmt);
 -	while (_vsnwprintf(p, size / sizeof(wchar_t) - 1, fmt, vararg) == -1) {
 +	while (mir_vsnwprintf(p, size / sizeof(wchar_t) - 1, fmt, vararg) == -1) {
  		size += 2048;
  		(*sizeAlloced) += 2048;
  		*str = (wchar_t *) realloc(*str, *sizeAlloced);
 diff --git a/plugins/KeyboardNotify/src/main.cpp b/plugins/KeyboardNotify/src/main.cpp index 6de02d77ee..afe5bb1cca 100644 --- a/plugins/KeyboardNotify/src/main.cpp +++ b/plugins/KeyboardNotify/src/main.cpp @@ -630,8 +630,8 @@ INT_PTR NormalizeSequenceService(WPARAM wParam, LPARAM lParam)  {
  	TCHAR strAux[MAX_PATH+1], *strIn = (TCHAR *)lParam;
 -	_snwprintf(strAux, MAX_PATH, _T("%s"), strIn);
 -	_snwprintf(strIn, MAX_PATH, _T("%s"), normalizeCustomString(strAux));
 +	mir_sntprintf(strAux, MAX_PATH, _T("%s"), strIn);
 +	mir_sntprintf(strIn, MAX_PATH, _T("%s"), normalizeCustomString(strAux));
  	return (int)strIn;
  }
 diff --git a/plugins/LotusNotify/src/debug.cpp b/plugins/LotusNotify/src/debug.cpp index e27f291817..94e45edb6f 100644 --- a/plugins/LotusNotify/src/debug.cpp +++ b/plugins/LotusNotify/src/debug.cpp @@ -39,9 +39,9 @@ void log_p(const wchar_t* szText, ...){  	va_list args;
  	va_start(args, szText);
 -	int len = _vscwprintf(szText, args ) + 1; // _vscprintf doesn't count terminating '\0'
 +	int len = _vscwprintf(szText, args ) + 1; // _vscprintf doesn't count terminating '\0' //!!!!!!!!!!!!!!!!
  	wchar_t* buffer = new wchar_t[len * sizeof(wchar_t)];
 -	vswprintf_s(buffer, len, szText, args);
 +	mir_sntprintf(buffer, len, szText, args);
  	va_end(args);
  	log(buffer);
  	delete buffer;
 diff --git a/plugins/MirOTR/MirOTR/src/utils.cpp b/plugins/MirOTR/MirOTR/src/utils.cpp index 1f9a035942..d6daabb294 100644 --- a/plugins/MirOTR/MirOTR/src/utils.cpp +++ b/plugins/MirOTR/MirOTR/src/utils.cpp @@ -92,7 +92,7 @@ void otrl_privkey_hash_to_humanT(TCHAR human[45], const unsigned char hash[20])  	for(word=0; word<5; ++word) {
  	for(byte=0; byte<4; ++byte) {
 -		_stprintf(p, _T("%02X"), hash[word*4+byte]);
 +		_stprintf(p, _T("%02X"), hash[word*4+byte]); //!!!!!!!!!!!!!!
  		p += 2;
  	}
  	*(p++) = ' ';
 @@ -154,11 +154,12 @@ void ShowPopup(const TCHAR* line1, const TCHAR* line2, int timeout, const HANDLE  	if ( !options.bHavePopups) {	
  		TCHAR title[256];
 -		_stprintf(title, _T("%s Message"), _T(MODULENAME));
 +		mir_sntprintf(title, SIZEOF(title), _T("%s Message"), _T(MODULENAME));
  		if(line1 && line2) {
 -			TCHAR *message = new TCHAR[_tcslen(line1) + _tcslen(line2) + 3]; // newline and null terminator
 -			_stprintf(message, _T("%s\r\n%s"), line1, line2);
 +			int size = _tcslen(line1) + _tcslen(line2) + 3;
 +			TCHAR *message = new TCHAR[size]; // newline and null terminator
 +			mir_sntprintf(message, size, _T("%s\r\n%s"), line1, line2);
  			MessageBox( NULL, message, title, MB_OK | MB_ICONINFORMATION );
  			delete message;
  		} else if(line1) {
 @@ -207,15 +208,18 @@ 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;
 -	_stprintf(buffer, _T("%s Warning"), _T(MODULENAME));
 +	mir_sntprintf(buffer, SIZEOF(buffer), _T("%s Warning"), _T(MODULENAME));
  	TCHAR *message;
  	switch(disp) {
  		case ED_POP:
 -			message = new TCHAR[_tcslen(msg) + 515]; // newline and null terminator
 -			_stprintf(message, _T("%s\r\n%s"), buffer, msg);
 -			PUShowMessageT(message, SM_WARNING);
 -			delete message;
 +			{
 +				int size = _tcslen(msg) + 515;
 +				message = new TCHAR[size]; // newline and null terminator
 +				mir_sntprintf(message, size, _T("%s\r\n%s"), buffer, msg);
 +				PUShowMessageT(message, SM_WARNING);
 +				delete message;
 +			}
  			break;
  		case ED_MB:
  			MessageBox(0, msg, buffer, MB_OK | MB_ICONWARNING);
 @@ -250,16 +254,19 @@ 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;
 -	_stprintf(buffer, _T("%s Error"), _T(MODULENAME));
 +	mir_sntprintf(buffer, SIZEOF(buffer), _T("%s Error"), _T(MODULENAME));
  	TCHAR *message;
  	switch(disp) {
  		case ED_POP:
 -			message = new TCHAR[_tcslen(msg) + 515]; // newline and null terminator
 -			_stprintf(message, _T("%s\r\n%s"), buffer, msg);
 -			PUShowMessageT(message, SM_WARNING);
 -			delete message;
 +			{
 +				int size = _tcslen(msg) + 515;
 +				message = new TCHAR[size]; // newline and null terminator
 +				mir_sntprintf(message, size, _T("%s\r\n%s"), buffer, msg);
 +				PUShowMessageT(message, SM_WARNING);
 +				delete message;
 +			}
  			break;
  		case ED_MB:
  			MessageBox(0, msg, buffer, MB_OK | MB_ICONERROR);
 diff --git a/plugins/Msg_Export/src/options.cpp b/plugins/Msg_Export/src/options.cpp index ca57895617..8b2dea52b3 100755 --- a/plugins/Msg_Export/src/options.cpp +++ b/plugins/Msg_Export/src/options.cpp @@ -366,7 +366,7 @@ BOOL bApplyChanges( HWND hwndDlg )  	int nTmp = GetDlgItemInt(hwndDlg, IDC_MAX_CLOUMN_WIDTH, &bTrans, TRUE );
  	if ( !bTrans || nTmp < 5 )
  	{
 -		_sntprintf(szTemp, sizeof(szTemp), TranslateT("Max line width must be at least %d"), 5);
 +		mir_sntprintf(szTemp, SIZEOF(szTemp), TranslateT("Max line width must be at least %d"), 5);
  		MessageBox(hwndDlg, szTemp, MSG_BOX_TITEL, MB_OK);
  		bRet = false;
  	}
 @@ -722,7 +722,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];
 -					_sntprintf( szTmp, sizeof(szTmp),_T("%d"), dwUIN );
 +					mir_sntprintf(szTmp, SIZEOF(szTmp),_T("%d"), dwUIN);
  					sItem.iSubItem = 3;
  					sItem.pszText = szTmp;
  					ListView_SetItem( hMapUser, &sItem );
 diff --git a/plugins/NewEventNotify/src/popup.cpp b/plugins/NewEventNotify/src/popup.cpp index b98b4f969e..81edaf7c90 100644 --- a/plugins/NewEventNotify/src/popup.cpp +++ b/plugins/NewEventNotify/src/popup.cpp @@ -267,7 +267,7 @@ static TCHAR* GetEventPreview(DBEVENTINFO *dbei)  			char *pszLast = pszFirst + strlen(pszFirst) + 1;
  			char *pszEmail = pszLast + strlen(pszLast) + 1;
 -			_snprintf(szUin, 16, "%d", *((DWORD*)dbei->pBlob));
 +			mir_snprintf(szUin, 16, "%d", *((DWORD*)dbei->pBlob));
  			if (strlen(pszNick) > 0) {
  				if (dbei->flags & DBEF_UTF)
  					szNick = mir_utf8decodeT(pszNick);
 @@ -303,7 +303,7 @@ static TCHAR* GetEventPreview(DBEVENTINFO *dbei)  			char *pszLast  = pszFirst + strlen(pszFirst) + 1;
  			char *pszEmail = pszLast + strlen(pszLast) + 1;
 -			_snprintf(szUin, 16, "%d", *((DWORD*)dbei->pBlob));
 +			mir_snprintf(szUin, 16, "%d", *((DWORD*)dbei->pBlob));
  			if (strlen(pszNick) > 0) {
  				if (dbei->flags & DBEF_UTF)
  					szNick = mir_utf8decodeT(pszNick);
 diff --git a/plugins/Non-IM Contact/src/contactinfo.cpp b/plugins/Non-IM Contact/src/contactinfo.cpp index 36fdb3c339..daf3f96ce4 100644 --- a/plugins/Non-IM Contact/src/contactinfo.cpp +++ b/plugins/Non-IM Contact/src/contactinfo.cpp @@ -157,7 +157,7 @@ INT_PTR CALLBACK DlgProcOtherStuff(HWND hwnd, UINT msg, WPARAM wParam, LPARAM lP  			/* group*/
  			while (i != -1) {
  				char str[3];
 -				wsprintfA(str, "%d", i);
 +				mir_snprintf(str, SIZEOF(str), "%d", i);
  				if (!db_get_ts(NULL, "CListGroups", str, &dbv)) {
  					SendMessage(GetDlgItem(hwnd, IDC_GROUP), CB_INSERTSTRING,0, LPARAM(dbv.ptszVal+1));
  					db_free(&dbv);
 @@ -186,7 +186,7 @@ INT_PTR CALLBACK DlgProcOtherStuff(HWND hwnd, UINT msg, WPARAM wParam, LPARAM lP  				if (!db_get_w(NULL, MODNAME ,"Timer", 1))
  					SetDlgItemTextA(hwnd,IDC_TIMER_INTERVAL_MSG, "Non-IM Contact protocol timer is Disabled");
  				else {
 -					_snprintf(string, sizeof(string), "Timer intervals... Non-IM Contact Protocol timer is %d seconds",db_get_w(NULL, MODNAME ,"Timer", 1));
 +					mir_snprintf(string, sizeof(string), "Timer intervals... Non-IM Contact Protocol timer is %d seconds",db_get_w(NULL, MODNAME ,"Timer", 1));
  					SetDlgItemTextA(hwnd,IDC_TIMER_INTERVAL_MSG, string);
  				}
  			}
 @@ -233,7 +233,7 @@ INT_PTR CALLBACK DlgProcOtherStuff(HWND hwnd, UINT msg, WPARAM wParam, LPARAM lP  			{
  				char szFileName[512];
  				if (BrowseForFolder(hwnd, szFileName)) {
 -					wsprintfA(szFileName, "%s ,/e", szFileName);
 +					mir_snprintf(szFileName, SIZEOF(szFileName), "%s ,/e", szFileName);
  					SetDlgItemTextA(hwnd, IDC_LINK, "explorer.exe");
  					SetDlgItemTextA(hwnd, IDC_PARAMS, szFileName);
  				}
 @@ -595,8 +595,9 @@ INT_PTR ImportContacts(WPARAM wParam, LPARAM lParam)  		}
  		else if (contactDone && !strcmp(line,"[/Non-IM Contact]\r\n")) {
  			if (!name) continue;
 -			char *msg = (char*)malloc(strlen(name) + strlen("Do you want to import this Non-IM Contact?\r\n\r\nName: \r\n") + 1);
 -			wsprintfA(msg, "Do you want to import this Non-IM Contact?\r\n\r\nName: %s\r\n", name);
 +			int size = strlen(name) + strlen("Do you want to import this Non-IM Contact?\r\n\r\nName: \r\n") + 1;
 +			char *msg = (char*)malloc(size);
 +			mir_snprintf(msg, size, "Do you want to import this Non-IM Contact?\r\n\r\nName: %s\r\n", name);
  			if (program) {
  				msg = (char*)realloc(msg, strlen(msg) + strlen(program) +strlen("Program: \r\n") +1);
  				strcat(msg, "Program: ");
 @@ -624,23 +625,23 @@ INT_PTR ImportContacts(WPARAM wParam, LPARAM lParam)  			if (icon) {
  				char tmp[64];
  				if (icon == ID_STATUS_ONLINE)
 -					wsprintfA(tmp, "Icon: Online\r\n");
 +					mir_snprintf(tmp, SIZEOF(tmp), "Icon: Online\r\n");
  				else if (icon == ID_STATUS_AWAY)
 -					wsprintfA(tmp, "Icon: Away\r\n");
 +					mir_snprintf(tmp, SIZEOF(tmp), "Icon: Away\r\n");
  				else if (icon == ID_STATUS_NA)
 -					wsprintfA(tmp, "Icon: NA\r\n");
 +					mir_snprintf(tmp, SIZEOF(tmp), "Icon: NA\r\n");
  				else if (icon == ID_STATUS_DND)
 -					wsprintfA(tmp, "Icon: DND\r\n");
 +					mir_snprintf(tmp, SIZEOF(tmp), "Icon: DND\r\n");
  				else if (icon == ID_STATUS_OCCUPIED)
 -					wsprintfA(tmp, "Icon: Occupied\r\n");
 +					mir_snprintf(tmp, SIZEOF(tmp), "Icon: Occupied\r\n");
  				else if (icon == ID_STATUS_FREECHAT)
 -					wsprintfA(tmp, "Icon: Free For Chat\r\n");
 +					mir_snprintf(tmp, SIZEOF(tmp), "Icon: Free For Chat\r\n");
  				else if (icon == ID_STATUS_INVISIBLE)
 -					wsprintfA(tmp, "Icon: Invisible\r\n");
 +					mir_snprintf(tmp, SIZEOF(tmp), "Icon: Invisible\r\n");
  				else if (icon == ID_STATUS_ONTHEPHONE)
 -					wsprintfA(tmp, "Icon: On The Phone\r\n");
 +					mir_snprintf(tmp, SIZEOF(tmp), "Icon: On The Phone\r\n");
  				else if (icon == ID_STATUS_OUTTOLUNCH)
 -					wsprintfA(tmp, "Icon: Out To Lunch\r\n");
 +					mir_snprintf(tmp, SIZEOF(tmp), "Icon: Out To Lunch\r\n");
  				msg = (char*)realloc(msg, strlen(msg) + strlen(tmp) +1);
  				strcat(msg,tmp);
  			}
 @@ -649,7 +650,7 @@ INT_PTR ImportContacts(WPARAM wParam, LPARAM lParam)  				if (minutes)
  					strcpy(tmp2,"Minutes");
  				else strcpy(tmp2,"Seconds");
 -				wsprintfA(tmp, "UseTimer: Yes\r\nTimer: %d %s",timer, tmp2);
 +				mir_snprintf(tmp, SIZEOF(tmp), "UseTimer: Yes\r\nTimer: %d %s",timer, tmp2);
  				msg = (char*)realloc(msg, strlen(msg) + strlen(tmp) +1);
  				strcat(msg,tmp);
  			}
 diff --git a/plugins/Non-IM Contact/src/dialog.cpp b/plugins/Non-IM Contact/src/dialog.cpp index 168caa6482..c457ab1ed6 100644 --- a/plugins/Non-IM Contact/src/dialog.cpp +++ b/plugins/Non-IM Contact/src/dialog.cpp @@ -191,15 +191,15 @@ INT_PTR CALLBACK TestWindowDlgProc(HWND hwnd, UINT msg, WPARAM wParam, LPARAM lP  				GetDlgItemTextA(hwnd, IDC_STRING, str2replace, MAX_STRING_LENGTH);
  				switch (stringReplacer(str2replace, replacedString, NULL)) {
  				case ERROR_NO_LINE_AFTER_VAR_F:
 -					wsprintfA(replacedString, "ERROR: no %s","%line or %wholeline or %lastline after %fn");
 +					mir_snprintf(replacedString, SIZEOF(replacedString), "ERROR: no %s","%line or %wholeline or %lastline after %fn");
  					error = 1;
  					break;
  				case ERROR_LINE_NOT_READ:
 -					wsprintfA(replacedString, "ERROR: file couldnt be opened ");
 +					mir_snprintf(replacedString, SIZEOF(replacedString), "ERROR: file couldnt be opened ");
  					error = 1;
  					break;
  				case ERROR_NO_FILE:
 -					wsprintfA(replacedString, "ERROR: no file specified in settings");
 +					mir_snprintf(replacedString, SIZEOF(replacedString), "ERROR: no file specified in settings");
  					error = 1;
  					break;
  				default:
 @@ -298,7 +298,7 @@ void DoPropertySheet(HANDLE hContact, HINSTANCE hInst)  	psh.hInstance = hInst;
  	psh.pszIcon = MAKEINTRESOURCEA(IDI_MAIN);
  	db_get_static(hContact, MODNAME, "Nick", nick);
 -	wsprintfA(title, "Edit Non-IM Contact \"%s\"", nick);
 +	mir_snprintf(title, SIZEOF(title), "Edit Non-IM Contact \"%s\"", nick);
  	psh.pszCaption = title;
  	psh.nPages = SIZEOF(psp);
  	psh.ppsp = (LPCPROPSHEETPAGEA)&psp;
 diff --git a/plugins/Non-IM Contact/src/files.cpp b/plugins/Non-IM Contact/src/files.cpp index d559fc6df8..fc3174e7ad 100644 --- a/plugins/Non-IM Contact/src/files.cpp +++ b/plugins/Non-IM Contact/src/files.cpp @@ -77,7 +77,7 @@ void reloadFiles(HWND fileList)  	SendMessage(fileList,CB_RESETCONTENT, 0,0);
  	for (i=0; ;i++)
  	{
 -		wsprintfA(fn, "fn%d", i);
 +		mir_snprintf(fn, SIZEOF(fn), "fn%d", i);
  		if (db_get_static(NULL, MODNAME, fn, file)) {
  			index = SendMessageA(fileList, CB_ADDSTRING,0, (LPARAM)(char*)file);
  			SendMessage(fileList, CB_SETITEMDATA, index,  (LPARAM)(int)i);
 @@ -108,14 +108,14 @@ void readFile(HWND hwnd)  	char temp[MAX_STRING_LENGTH], szFileName[512], temp1[MAX_STRING_LENGTH], fn[8];
  	FILE* filen;
  	int fileNumber = SendMessage(GetDlgItem(hwnd, IDC_FILE_LIST),CB_GETCURSEL, 0,0);
 -	wsprintfA(fn, "fn%d", fileNumber);
 +	mir_snprintf(fn, SIZEOF(fn), "fn%d", fileNumber);
  	if (!db_get_static(NULL, MODNAME, fn, szFileName)) {
  		msg(Translate("File couldn't be opened"),fn);
  		return;
  	}
  	if ( (!strncmp("http://", szFileName, strlen("http://"))) || (!strncmp("https://", szFileName, strlen("https://"))) )
 -		wsprintfA(szFileName,"%s\\plugins\\fn%d.html",getMimDir(temp), fileNumber);
 +		mir_snprintf(szFileName, SIZEOF(szFileName), "%s\\plugins\\fn%d.html", getMimDir(temp), fileNumber);
  	filen = fopen(szFileName,"r");
  	if (!filen) {
 @@ -132,7 +132,7 @@ void readFile(HWND hwnd)  		else if (temp[strlen(temp)-1]=='\n') 
  			temp[strlen(temp)-1]='\0';
          else temp[strlen(temp)]='\0';
 -		wsprintfA( temp1, Translate("line(%-3d) = | %s"), lineNumber, temp);
 +		mir_snprintf(temp1, SIZEOF(temp1), Translate("line(%-3d) = | %s"), lineNumber, temp);
  		SendMessageA(GetDlgItem(hwnd, IDC_FILE_CONTENTS),LB_ADDSTRING,0,(LPARAM)(char*)temp1);
  		lineNumber++;
  		fileLength++;
 @@ -154,7 +154,7 @@ INT_PTR CALLBACK DlgProcFiles(HWND hwnd, UINT msg, WPARAM wParam, LPARAM lParam)  			char fn[MAX_PATH], string[MAX_STRING_LENGTH], tmp[MAX_STRING_LENGTH];
  			reloadFiles(GetDlgItem(hwnd, IDC_FILE_LIST));
  			int i = SendMessage(GetDlgItem(hwnd, IDC_FILE_LIST),CB_GETCURSEL, 0 ,0);
 -			wsprintfA(fn , "fn%d", i);
 +			mir_snprintf(fn, SIZEOF(fn), "fn%d", i);
  			SendMessage(GetDlgItem(hwnd, IDC_FILE_CONTENTS),LB_RESETCONTENT, 0,0);
  			if (db_get_static(NULL, MODNAME, fn, string) )
  			{
 @@ -189,14 +189,14 @@ INT_PTR CALLBACK DlgProcFiles(HWND hwnd, UINT msg, WPARAM wParam, LPARAM lParam)  					{
  						for (i=0; ;i++)
  						{
 -							wsprintfA(fn, "fn%d", i);
 +							mir_snprintf(fn, SIZEOF(fn), "fn%d", i);
  							if (!db_get_static(NULL, MODNAME, fn, text))
  								break;
  						}
 -						wsprintfA(szFileName,"%s\\plugins\\%s.html",getMimDir(temp), fn);
 +						mir_snprintf(szFileName, SIZEOF(szFileName), "%s\\plugins\\%s.html", getMimDir(temp), fn);
  						if (savehtml(szFileName))
  						{
 -							wsprintfA(fn, "fn%d", i);
 +							mir_snprintf(fn, SIZEOF(fn), "fn%d", i);
  							db_set_s(NULL, MODNAME, fn, url);
  							if (!GetWindowTextLength(GetDlgItem(hwnd,IDC_WWW_TIMER))) 
  								timer = 60;
 @@ -222,7 +222,7 @@ INT_PTR CALLBACK DlgProcFiles(HWND hwnd, UINT msg, WPARAM wParam, LPARAM lParam)  				char file[MAX_PATH], fn[6];
  				for (i=0; ;i++)
  				{
 -					wsprintfA(fn, "fn%d", i);
 +					mir_snprintf(fn, SIZEOF(fn), "fn%d", i);
  					if (!db_get_static(NULL, MODNAME, fn, file))
  						break;
  				}
 @@ -233,7 +233,7 @@ INT_PTR CALLBACK DlgProcFiles(HWND hwnd, UINT msg, WPARAM wParam, LPARAM lParam)  					SendMessage(GetDlgItem(hwnd, IDC_FILE_LIST),CB_SETITEMDATA,index,(LPARAM)(int)i);
  					SendMessage(GetDlgItem(hwnd, IDC_FILE_LIST),CB_SETCURSEL, index ,0);
  					SetDlgItemTextA(hwnd, IDC_FN, _itoa(i, fn, 10));
 -					wsprintfA(fn , "fn%d", index);
 +					mir_snprintf(fn, SIZEOF(fn), "fn%d", index);
  					readFile(hwnd);
  				}
 @@ -246,7 +246,7 @@ INT_PTR CALLBACK DlgProcFiles(HWND hwnd, UINT msg, WPARAM wParam, LPARAM lParam)  				int count = SendMessage(GetDlgItem(hwnd, IDC_FILE_LIST),CB_GETCOUNT, 0,0) -1;
  				if (index == count)
  				{
 -					wsprintfA(fn, "fn%d", index);
 +					mir_snprintf(fn, SIZEOF(fn), "fn%d", index);
  					db_unset(NULL, MODNAME, fn);
  					SendMessage(GetDlgItem(hwnd, IDC_FILE_LIST),CB_DELETESTRING, index ,0);
  					SendMessage(hwnd, WM_RELOADWINDOW, 0,0);
 @@ -258,14 +258,14 @@ INT_PTR CALLBACK DlgProcFiles(HWND hwnd, UINT msg, WPARAM wParam, LPARAM lParam)  				}
  				else
  				{
 -					wsprintfA(fn, "fn%d", i);
 +					mir_snprintf(fn, SIZEOF(fn), "fn%d", i);
  					while (db_get_static(NULL, MODNAME, fn,tmp))
  					{
 -						wsprintfA(fn1, "fn%d", i-1);
 +						mir_snprintf(fn1, SIZEOF(fn1), "fn%d", i-1);
  						db_set_s(NULL, MODNAME, fn1 , tmp);
 -						wsprintfA(fn, "fn%d", ++i);
 +						mir_snprintf(fn, SIZEOF(fn), "fn%d", ++i);
  					}
 -					wsprintfA(fn, "fn%d", --i);
 +					mir_snprintf(fn, SIZEOF(fn), "fn%d", --i);
  					db_unset(NULL, MODNAME, fn);
  					SendMessage(GetDlgItem(hwnd, IDC_FILE_LIST),CB_DELETESTRING, index ,0);
  					SendMessage(hwnd, WM_RELOADWINDOW, 0,0);
 @@ -281,7 +281,7 @@ INT_PTR CALLBACK DlgProcFiles(HWND hwnd, UINT msg, WPARAM wParam, LPARAM lParam)  				int index = SendMessage(GetDlgItem(hwnd, IDC_FILE_LIST),CB_GETCURSEL, 0,0);
  				char fn[6], tmp[MAX_PATH];
  				SetDlgItemTextA(hwnd, IDC_FN, _itoa(index, fn, 10));
 -				wsprintfA(fn, "fn%d", index);
 +				mir_snprintf(fn, SIZEOF(fn), "fn%d", index);
  				if (db_get_static(NULL, MODNAME, fn, tmp) )
  				{
  					if (!strncmp("http://", tmp, strlen("http://")) || !strncmp("https://", tmp, strlen("https://")))
 @@ -311,8 +311,8 @@ INT_PTR CALLBACK DlgProcFiles(HWND hwnd, UINT msg, WPARAM wParam, LPARAM lParam)  			case PSN_APPLY:
  				int i = SendMessage(GetDlgItem(hwnd, IDC_FILE_LIST),CB_GETCURSEL, 0 ,0);
  				int timer;
 -				char fn[MAX_PATH], string[1000];;
 -				wsprintfA(fn , "fn%d", i);
 +				char fn[MAX_PATH], string[1000];
 +				mir_snprintf(fn, SIZEOF(fn), "fn%d", i);
  				if (GetWindowTextLength(GetDlgItem(hwnd,IDC_WWW_TIMER))) {
  					char text[5];
  					GetDlgItemTextA(hwnd,IDC_WWW_TIMER,text,sizeof(text));
 diff --git a/plugins/Non-IM Contact/src/http.cpp b/plugins/Non-IM Contact/src/http.cpp index 502d34e585..f4b8b006d8 100644 --- a/plugins/Non-IM Contact/src/http.cpp +++ b/plugins/Non-IM Contact/src/http.cpp @@ -70,7 +70,7 @@ int InternetDownloadFile (CHAR *szUrl)  				if (!lstrcmpA(nlhrReply->headers[i].szName, "Location")) {
  					szData = (char *)malloc(512);
  					// add "Moved/Location:" in front of the new URL for identification
 -					wsprintfA(szData, "Moved/Location: %s\n", nlhrReply->headers[i].szValue);
 +					mir_snprintf(szData, 512, "Moved/Location: %s\n", nlhrReply->headers[i].szValue);
  					break;
  				}
  			}
 diff --git a/plugins/PasteIt/src/Options.cpp b/plugins/PasteIt/src/Options.cpp index a5c4fb5359..41b3b14c07 100644 --- a/plugins/PasteIt/src/Options.cpp +++ b/plugins/PasteIt/src/Options.cpp @@ -726,7 +726,7 @@ void Options::InitCodepageCB(HWND hwndCB, unsigned int codepage)  	if(selCpIdx == -1)
  	{
  		TCHAR buf[10];
 -		_stprintf_s(buf, 10, _T("%d"), codepage);
 +		mir_sntprintf(buf, 10, _T("%d"), codepage);
  		ComboBox_SetText(hwndCB, buf);	
  	}
  	else
 @@ -750,7 +750,7 @@ void Options::SetCodepageCB(HWND hwndCB, unsigned int codepage)  	if(selCpIdx == -1)
  	{
  		TCHAR buf[10];
 -		_stprintf_s(buf, 10, _T("%d"), codepage);
 +		mir_sntprintf(buf, 10, _T("%d"), codepage);
  		ComboBox_SetText(hwndCB, buf);	
  	}
  	else
 diff --git a/plugins/PluginUpdater/src/Notifications.cpp b/plugins/PluginUpdater/src/Notifications.cpp index b054f76a04..b6ad025454 100644 --- a/plugins/PluginUpdater/src/Notifications.cpp +++ b/plugins/PluginUpdater/src/Notifications.cpp @@ -227,7 +227,7 @@ bool PrepareEscalation()  	// Elevate the process. Create a pipe for a stub first
  	TCHAR tszPipeName[MAX_PATH];
 -	_stprintf_s(tszPipeName, MAX_PATH, _T("\\\\.\\pipe\\Miranda_Pu_%d"), GetCurrentProcessId());
 +	mir_sntprintf(tszPipeName, MAX_PATH, _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;
 diff --git a/plugins/Popup/src/skin.cpp b/plugins/Popup/src/skin.cpp index 865912ca29..9fffea5a7f 100644 --- a/plugins/Popup/src/skin.cpp +++ b/plugins/Popup/src/skin.cpp @@ -234,7 +234,7 @@ void PopupSkin::measure(HDC hdc, PopupWnd2 *wnd, int maxw, POPUPOPTIONS *options  	for (int i=0; i < 32; ++i)
  	{
  		char buf[10];
 -		wsprintfA(buf, "opt%d", i);
 +		mir_snprintf(buf, SIZEOF(buf), "opt%d", i);
  		wnd->getArgs()->add(buf, (m_flags&(1L<<i)) ? 1 : 0);
  	}
 diff --git a/plugins/Scriver/src/chat/clist.cpp b/plugins/Scriver/src/chat/clist.cpp index 4cb3d46be0..64fe7dfd7f 100644 --- a/plugins/Scriver/src/chat/clist.cpp +++ b/plugins/Scriver/src/chat/clist.cpp @@ -260,7 +260,7 @@ BOOL CList_AddEvent(HANDLE hContact, HICON Icon, HANDLE event, int type, TCHAR*  	TCHAR* szBuf = (TCHAR*)alloca(4096 * sizeof(TCHAR));
  	va_list marker;
  	va_start(marker, fmt);
 -	_vsntprintf(szBuf, 4096, fmt, marker);
 +	mir_vsntprintf(szBuf, 4096, fmt, marker);
  	va_end(marker);
  	CLISTEVENT cle = { sizeof(cle) };
 diff --git a/plugins/Scriver/src/chat/tools.cpp b/plugins/Scriver/src/chat/tools.cpp index 122a869fcc..a3ab13a391 100644 --- a/plugins/Scriver/src/chat/tools.cpp +++ b/plugins/Scriver/src/chat/tools.cpp @@ -113,7 +113,7 @@ static int ShowPopup (HANDLE hContact, SESSION_INFO *si, HICON hIcon, char* pszP  	va_list marker;
  	va_start(marker, fmt);
 -	_vsntprintf(szBuf, 4096, fmt, marker);
 +	mir_vsntprintf(szBuf, 4096, fmt, marker);
  	va_end(marker);
  	POPUPDATAT pd = {0};
 diff --git a/plugins/Scriver/src/msgwindow.cpp b/plugins/Scriver/src/msgwindow.cpp index d7763423c4..5b9ea9d56e 100644 --- a/plugins/Scriver/src/msgwindow.cpp +++ b/plugins/Scriver/src/msgwindow.cpp @@ -868,14 +868,14 @@ INT_PTR CALLBACK DlgProcParentWindow(HWND hwndDlg, UINT msg, WPARAM wParam, LPAR  			char *szNamePrefix = (!savePerContact && dat->isChat) ? "chat" : "";
  			if (!dat->windowWasCascaded) {
 -				wsprintfA(szSettingName,"%sx",szNamePrefix);
 +				mir_snprintf(szSettingName, SIZEOF(szSettingName), "%sx", szNamePrefix);
  				db_set_dw(hContact, SRMMMOD, szSettingName, wp.rcNormalPosition.left);
 -				wsprintfA(szSettingName,"%sy",szNamePrefix);
 +				mir_snprintf(szSettingName, SIZEOF(szSettingName), "%sy", szNamePrefix);
  				db_set_dw(hContact, SRMMMOD, szSettingName, wp.rcNormalPosition.top);
  			}
 -			wsprintfA(szSettingName,"%swidth",szNamePrefix);
 +			mir_snprintf(szSettingName, SIZEOF(szSettingName), "%swidth", szNamePrefix);
  			db_set_dw(hContact, SRMMMOD, szSettingName, wp.rcNormalPosition.right - wp.rcNormalPosition.left);
 -			wsprintfA(szSettingName,"%sheight",szNamePrefix);
 +			mir_snprintf(szSettingName, SIZEOF(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)
 @@ -1550,9 +1550,9 @@ int ScriverRestoreWindowPosition(HWND hwnd,HANDLE hContact,const char *szModule,  //	SystemParametersInfo(SPI_GETWORKAREA, 0, &rcDesktop, 0);
  	wp.length=sizeof(wp);
  	GetWindowPlacement(hwnd,&wp);
 -	wsprintfA(szSettingName,"%sx",szNamePrefix);
 +	mir_snprintf(szSettingName, SIZEOF(szSettingName), "%sx", szNamePrefix);
  	x=db_get_dw(hContact,szModule,szSettingName,-1);
 -	wsprintfA(szSettingName,"%sy",szNamePrefix);
 +	mir_snprintf(szSettingName, SIZEOF(szSettingName), "%sy", szNamePrefix);
  	y=(int)db_get_dw(hContact,szModule,szSettingName,-1);
  	if (x==-1) return 1;
  	if (flags&RWPF_NOSIZE) {
 @@ -1560,9 +1560,9 @@ int ScriverRestoreWindowPosition(HWND hwnd,HANDLE hContact,const char *szModule,  	} else {
  		wp.rcNormalPosition.left=x;
  		wp.rcNormalPosition.top=y;
 -		wsprintfA(szSettingName,"%swidth",szNamePrefix);
 +		mir_snprintf(szSettingName, SIZEOF(szSettingName), "%swidth", szNamePrefix);
  		wp.rcNormalPosition.right=wp.rcNormalPosition.left+db_get_dw(hContact,szModule,szSettingName,-1);
 -		wsprintfA(szSettingName,"%sheight",szNamePrefix);
 +		mir_snprintf(szSettingName, SIZEOF(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 5d92d914f6..3ef388b7f8 100644 --- a/plugins/Scriver/src/utils.cpp +++ b/plugins/Scriver/src/utils.cpp @@ -76,7 +76,7 @@ void logInfo(const char *fmt, ...) {  		GetLocalTime(&time);
      	va_start(vararg, fmt);
      	str = (char*) malloc(strsize=2048);
 -    	while (_vsnprintf(str, strsize, fmt, vararg) == -1)
 +    	while (mir_vsnprintf(str, strsize, fmt, vararg) == -1)
      		str = (char*) realloc(str, strsize+=2048);
      	va_end(vararg);
      	fprintf(flog,"%04d-%02d-%02d %02d:%02d:%02d,%03d [%s]",time.wYear,time.wMonth,time.wDay,time.wHour,time.wMinute,time.wSecond,time.wMilliseconds, "INFO");
 @@ -281,7 +281,7 @@ void AppendToBuffer(char **buffer, int *cbBufferEnd, int *cbBufferAlloced, const  	va_start(va, fmt);
  	for (;;) {
 -		charsDone = _vsnprintf(*buffer + *cbBufferEnd, *cbBufferAlloced - *cbBufferEnd, fmt, va);
 +		charsDone = mir_vsnprintf(*buffer + *cbBufferEnd, *cbBufferAlloced - *cbBufferEnd, fmt, va);
  		if (charsDone >= 0)
  			break;
  		*cbBufferAlloced += 1024;
 diff --git a/plugins/StatusPlugins/AdvancedAutoAway/advancedautoaway.cpp b/plugins/StatusPlugins/AdvancedAutoAway/advancedautoaway.cpp index f08ed86d13..1bd878db57 100644 --- a/plugins/StatusPlugins/AdvancedAutoAway/advancedautoaway.cpp +++ b/plugins/StatusPlugins/AdvancedAutoAway/advancedautoaway.cpp @@ -153,13 +153,13 @@ void LoadOptions( OBJLIST<TAAAProtoSetting>& loadSettings, BOOL override)  int LoadAutoAwaySetting(TAAAProtoSetting& autoAwaySetting, char* protoName)
  {
  	char setting[128];
 -	_snprintf(setting, sizeof(setting), "%s_OptionFlags", protoName);
 +	mir_snprintf(setting, sizeof(setting), "%s_OptionFlags", protoName);
  	autoAwaySetting.optionFlags = db_get_b(NULL,MODULENAME,setting,FLAG_LV2ONINACTIVE|FLAG_RESET);
 -	_snprintf(setting, sizeof(setting), "%s_AwayTime", protoName);
 +	mir_snprintf(setting, sizeof(setting), "%s_AwayTime", protoName);
  	autoAwaySetting.awayTime = db_get_w(NULL,MODULENAME,setting,SETTING_AWAYTIME_DEFAULT);
 -	_snprintf(setting, sizeof(setting), "%s_NATime", protoName);
 +	mir_snprintf(setting, sizeof(setting), "%s_NATime", protoName);
  	autoAwaySetting.naTime = db_get_w(NULL,MODULENAME,setting,SETTING_NATIME_DEFAULT);
 -	_snprintf(setting, sizeof(setting), "%s_StatusFlags", protoName);
 +	mir_snprintf(setting, sizeof(setting), "%s_StatusFlags", protoName);
  	autoAwaySetting.statusFlags = db_get_w(NULL,MODULENAME,setting, StatusModeToProtoFlag(ID_STATUS_ONLINE)|StatusModeToProtoFlag(ID_STATUS_FREECHAT));
  	int flags;
 @@ -167,9 +167,9 @@ int LoadAutoAwaySetting(TAAAProtoSetting& autoAwaySetting, char* protoName)  		flags = 0xFFFFFF;
  	else
  		flags = CallProtoService(protoName, PS_GETCAPS,PFLAGNUM_2,0)&~CallProtoService(protoName, PS_GETCAPS, (WPARAM)PFLAGNUM_5, 0);
 -	_snprintf(setting, sizeof(setting), "%s_Lv1Status", protoName);
 +	mir_snprintf(setting, sizeof(setting), "%s_Lv1Status", protoName);
  	autoAwaySetting.lv1Status = db_get_w(NULL, MODULENAME, setting, (flags&StatusModeToProtoFlag(ID_STATUS_AWAY))?ID_STATUS_AWAY:ID_STATUS_OFFLINE);
 -	_snprintf(setting, sizeof(setting), "%s_Lv2Status", protoName);
 +	mir_snprintf(setting, sizeof(setting), "%s_Lv2Status", protoName);
  	autoAwaySetting.lv2Status = db_get_w(NULL, MODULENAME, setting, (flags&StatusModeToProtoFlag(ID_STATUS_NA))?ID_STATUS_NA:ID_STATUS_OFFLINE);
  	return 0;
 diff --git a/plugins/StatusPlugins/KeepStatus/options.cpp b/plugins/StatusPlugins/KeepStatus/options.cpp index 6169ddd004..949534c71b 100644 --- a/plugins/StatusPlugins/KeepStatus/options.cpp +++ b/plugins/StatusPlugins/KeepStatus/options.cpp @@ -81,7 +81,7 @@ static INT_PTR CALLBACK DlgProcKSBasicOpts(HWND hwndDlg,UINT msg,WPARAM wParam,L  				ListView_InsertItem(hList,&lvItem);
  				char dbSetting[128];
 -				_snprintf(dbSetting, sizeof(dbSetting), "%s_enabled", protos[i]->szModuleName);
 +				mir_snprintf(dbSetting, sizeof(dbSetting), "%s_enabled", protos[i]->szModuleName);
  				ListView_SetCheckState(hList, lvItem.iItem, db_get_b(NULL, MODULENAME, dbSetting, TRUE));
  				lvItem.iItem++;
  			}
 diff --git a/plugins/StatusPlugins/StartupStatus/options.cpp b/plugins/StatusPlugins/StartupStatus/options.cpp index 3e78a0230c..ad68999701 100644 --- a/plugins/StatusPlugins/StartupStatus/options.cpp +++ b/plugins/StatusPlugins/StartupStatus/options.cpp @@ -115,7 +115,7 @@ static char* GetCMDL(TSettingsList& protoSettings)  	GetModuleFileNameA(NULL, path, MAX_PATH);
  	char* cmdl = ( char* )malloc(strlen(path) + 4);
 -	_snprintf(cmdl, strlen(path) + 4, "\"%s\" ", path);
 +	mir_snprintf(cmdl, strlen(path) + 4, "\"%s\" ", path);
  	char* args = GetCMDLArguments(protoSettings);
  	if ( args ) {
 @@ -176,7 +176,7 @@ HRESULT CreateLink(TSettingsList& protoSettings)  	if (MyGetSpecialFolderPath(NULL, savePath, 0x10, FALSE))
  		_tcscat(savePath, _T(SHORTCUT_FILENAME));
  	else
 -		_stprintf(savePath, _T(".\\%s"), _T(SHORTCUT_FILENAME));
 +		mir_sntprintf(savePath, SIZEOF(savePath), _T(".\\%s"), _T(SHORTCUT_FILENAME));
  	// Get a pointer to the IShellLink interface.
  	hres = CoCreateInstance(CLSID_ShellLink, NULL, CLSCTX_INPROC_SERVER, IID_IShellLink, ( void** )&psl);
 diff --git a/plugins/StatusPlugins/StartupStatus/profiles.cpp b/plugins/StatusPlugins/StartupStatus/profiles.cpp index bdd7e78114..f17be2f942 100644 --- a/plugins/StatusPlugins/StartupStatus/profiles.cpp +++ b/plugins/StatusPlugins/StartupStatus/profiles.cpp @@ -161,7 +161,7 @@ INT_PTR GetProfileName(WPARAM wParam, LPARAM lParam)  	DBVARIANT dbv;
  	char setting[80];
 -	_snprintf(setting, sizeof(setting), "%d_%s", profile, SETTING_PROFILENAME);
 +	mir_snprintf(setting, sizeof(setting), "%d_%s", profile, SETTING_PROFILENAME);
  	if ( db_get_ts(NULL, MODULENAME, setting, &dbv))
  		return -1;
 @@ -190,7 +190,7 @@ TCHAR *GetStatusMessage(int profile, char *szProto)  	for ( int i=0; i < pceCount; i++ ) {
  		if ( (pce[i].profile == profile) && (!strcmp(pce[i].szProto, szProto))) {
 -			_snprintf(dbSetting, sizeof(dbSetting), "%d_%s_%s", profile, szProto, SETTING_PROFILE_STSMSG);
 +			mir_snprintf(dbSetting, sizeof(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)*(_tcslen(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;
 -	_snprintf(dbSetting, sizeof(dbSetting), "%d_%s_%s", profile, szProto, SETTING_PROFILE_STSMSG);
 +	mir_snprintf(dbSetting, sizeof(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);
 @@ -264,7 +264,7 @@ INT_PTR LoadAndSetProfile(WPARAM wParam, LPARAM lParam)  		profile = (profile >= 0)?profile:db_get_w(NULL, MODULENAME, SETTING_DEFAULTPROFILE, 0);
  		char setting[64];
 -		_snprintf(setting, sizeof(setting), "%d_%s", profile, SETTING_SHOWCONFIRMDIALOG);
 +		mir_snprintf(setting, sizeof(setting), "%d_%s", profile, SETTING_SHOWCONFIRMDIALOG);
  		if (!db_get_b(NULL, MODULENAME, setting, 0))
  			CallService(MS_CS_SETSTATUSEX,(WPARAM)&profileSettings, 0);
  		else
 diff --git a/plugins/StatusPlugins/StartupStatus/startupstatus.cpp b/plugins/StatusPlugins/StartupStatus/startupstatus.cpp index f95ec4ce8e..6ed4a8b9f1 100644 --- a/plugins/StatusPlugins/StartupStatus/startupstatus.cpp +++ b/plugins/StatusPlugins/StartupStatus/startupstatus.cpp @@ -47,14 +47,14 @@ TSSSetting::TSSSetting( int profile, PROTOACCOUNT* pa )  	// load status
  	char setting[80];
 -	_snprintf(setting, sizeof(setting), "%d_%s", profile, pa->szModuleName);
 +	mir_snprintf(setting, sizeof(setting), "%d_%s", profile, pa->szModuleName);
  	int iStatus = db_get_w(NULL, MODULENAME, setting, 0);
  	if ( iStatus < MIN_STATUS || iStatus > MAX_STATUS )
  		iStatus = DEFAULT_STATUS;
  	status = iStatus;
  	// load last status
 -	_snprintf(setting, sizeof(setting), "%s%s", PREFIX_LAST, szName);
 +	mir_snprintf(setting, sizeof(setting), "%s%s", PREFIX_LAST, szName);
  	iStatus = db_get_w(NULL, MODULENAME, setting, 0);
  	if ( iStatus < MIN_STATUS || iStatus > MAX_STATUS )
  		iStatus = DEFAULT_STATUS;
 @@ -173,7 +173,7 @@ static void SetLastStatusMessages(TSettingsList& ps)  			continue;
  		char dbSetting[128];
 -		_snprintf(dbSetting, sizeof(dbSetting), "%s%s", PREFIX_LASTMSG, ps[i].szName);
 +		mir_snprintf(dbSetting, sizeof(dbSetting), "%s%s", PREFIX_LASTMSG, ps[i].szName);
  		DBVARIANT dbv;
  		if ( ps[i].szMsg == NULL && !db_get_ts(NULL, MODULENAME, dbSetting, &dbv)) {
 diff --git a/plugins/StatusPlugins/StartupStatus/toolbars.cpp b/plugins/StatusPlugins/StartupStatus/toolbars.cpp index a2e53fc395..c88ba01b8c 100644 --- a/plugins/StatusPlugins/StartupStatus/toolbars.cpp +++ b/plugins/StatusPlugins/StartupStatus/toolbars.cpp @@ -55,12 +55,12 @@ int CreateTopToolbarButtons(WPARAM wParam, LPARAM lParam)  	ttb.pszService = MS_SS_LOADANDSETPROFILE;
  	for (int i=0; i < profileCount; i++) {
  		char setting[80];
 -		_snprintf(setting, sizeof(setting), "%d_%s", i, SETTING_CREATETTBBUTTON);
 +		mir_snprintf(setting, sizeof(setting), "%d_%s", i, SETTING_CREATETTBBUTTON);
  		if (!db_get_b(NULL, MODULENAME, setting, FALSE))
  			continue;
  		DBVARIANT dbv;
 -		_snprintf(setting, sizeof(setting), "%d_%s", i, SETTING_PROFILENAME);
 +		mir_snprintf(setting, sizeof(setting), "%d_%s", i, SETTING_PROFILENAME);
  		if (db_get(NULL, MODULENAME, setting, &dbv))
  			continue;
 diff --git a/plugins/StatusPlugins/confirmdialog.cpp b/plugins/StatusPlugins/confirmdialog.cpp index 324946eadc..5a0c1f5b41 100644 --- a/plugins/StatusPlugins/confirmdialog.cpp +++ b/plugins/StatusPlugins/confirmdialog.cpp @@ -212,7 +212,7 @@ static INT_PTR CALLBACK ConfirmDlgProc(HWND hwndDlg,UINT msg,WPARAM wParam,LPARA  		// start timer
  		if (timeOut > 0) {
  			TCHAR text[32];
 -			_sntprintf(text, SIZEOF(text), TranslateT("Closing in %d"), timeOut);
 +			mir_sntprintf(text, SIZEOF(text), TranslateT("Closing in %d"), timeOut);
  			SetDlgItemText(hwndDlg, IDC_CLOSE, text);
  			SetTimer(hwndDlg, TIMER_ID, 1000, NULL);
  		}
 @@ -221,7 +221,7 @@ static INT_PTR CALLBACK ConfirmDlgProc(HWND hwndDlg,UINT msg,WPARAM wParam,LPARA  	case WM_TIMER:
  		{
  			TCHAR text[32];
 -			_sntprintf(text, SIZEOF(text), TranslateT("Closing in %d"), timeOut-1);
 +			mir_sntprintf(text, SIZEOF(text), TranslateT("Closing in %d"), timeOut-1);
  			SetDlgItemText(hwndDlg, IDC_CLOSE, text);
  			if (timeOut <= 0) {
  				KillTimer(hwndDlg, TIMER_ID);
 diff --git a/plugins/TabSRMM/src/chat/log.cpp b/plugins/TabSRMM/src/chat/log.cpp index 0d45441233..deb7bae5b8 100644 --- a/plugins/TabSRMM/src/chat/log.cpp +++ b/plugins/TabSRMM/src/chat/log.cpp @@ -92,7 +92,7 @@ static int Log_AppendIEView(LOGSTREAMDATA* streamData, BOOL simpleMode, TCHAR **  	MODULEINFO *mi = MM_FindModule(streamData->si->pszModule);
  	va_start(va, fmt);
 -	lineLen = _vsntprintf( line, 8000, fmt, va);
 +	lineLen = mir_vsntprintf( line, 8000, fmt, va);
  	if (lineLen < 0)
  		return 0;
  	line[lineLen] = 0;
 diff --git a/plugins/TabSRMM/src/themes.h b/plugins/TabSRMM/src/themes.h index da939dbbf1..5d41062920 100644 --- a/plugins/TabSRMM/src/themes.h +++ b/plugins/TabSRMM/src/themes.h @@ -109,7 +109,7 @@ public:  	CImageItem(const TCHAR *szName)
  	{
  		ZeroMemory(this, sizeof(CImageItem));
 -		_sntprintf(m_szName, 40, szName);
 +		mir_sntprintf(m_szName, 40, szName);
  		m_szName[39] = 0;
  	}
 diff --git a/plugins/UserInfoEx/src/Flags/svc_flagsicons.cpp b/plugins/UserInfoEx/src/Flags/svc_flagsicons.cpp index 7bc1e5a0ba..c18583930d 100644 --- a/plugins/UserInfoEx/src/Flags/svc_flagsicons.cpp +++ b/plugins/UserInfoEx/src/Flags/svc_flagsicons.cpp @@ -133,7 +133,7 @@ HICON LoadFlag(int countryNumber)  		szCountry = (char*)CallService(MS_UTILS_GETCOUNTRYBYNUMBER,countryNumber=0xFFFF,0);
  	char szId[20];
 -	wsprintfA(szId,(countryNumber==0xFFFF) ? "%s_0x%X" : "%s_%i","flags",countryNumber); /* buffer safe */
 +	mir_snprintf(szId, SIZEOF(szId), (countryNumber == 0xFFFF) ? "%s_0x%X" : "%s_%i", "flags", countryNumber); /* buffer safe */
  	return Skin_GetIcon(szId);
  }
 @@ -414,7 +414,7 @@ void InitIcons()  			for (int i=0; i < nCountriesCount; i++) {
  				sid.ptszDescription = mir_a2t(LPGEN(countries[i].szName));
  				/* create identifier */
 -				wsprintfA(szId,(countries[i].id==0xFFFF)?"%s0x%X":"%s%i","flags_",countries[i].id); /* buffer safe */
 +				mir_snprintf(szId, SIZEOF(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);
 @@ -438,7 +438,7 @@ void UninitIcons()  	for(int i=0;i<nCountriesCount;++i) {
  		/* create identifier */
  		char szId[20];
 -		wsprintfA(szId,(countries[i].id==0xFFFF)?"%s0x%X":"%s%i","flags_",countries[i].id); /* buffer safe */
 +		mir_snprintf(szId, SIZEOF(szId), (countries[i].id == 0xFFFF) ? "%s0x%X" : "%s%i", "flags_", countries[i].id); /* buffer safe */
  		Skin_RemoveIcon(szId);
  	}
  	mir_free(phIconHandles);  /* does NULL check */
 diff --git a/plugins/Utils/mir_buffer.h b/plugins/Utils/mir_buffer.h index 4c49570175..1461be9f61 100644 --- a/plugins/Utils/mir_buffer.h +++ b/plugins/Utils/mir_buffer.h @@ -244,7 +244,7 @@ class Buffer  			va_list arg;
  			va_start(arg, app);
 -			total = __bvsnprintf<T>(&str[len], size - len - 1, app, arg);
 +			total = __bvsnprintf<T>(&str[len], size - len - 1, app, arg); //!!!!!!!!!!!!
  			if (total < 0)
  				total = size - len - 1;
  			len += total;
 diff --git a/plugins/Variables/src/dbhelpers.h b/plugins/Variables/src/dbhelpers.h index 2315d2eab4..cb5852de34 100644 --- a/plugins/Variables/src/dbhelpers.h +++ b/plugins/Variables/src/dbhelpers.h @@ -26,7 +26,7 @@ static int __inline DBWriteIthSettingByte(DWORD i, HANDLE hContact,const char *s  	char dbSetting[128];
 -	_snprintf(dbSetting, sizeof(dbSetting), "%s%u_%s", PREFIX_ITH, i, szSetting);
 +	mir_snprintf(dbSetting, sizeof(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, HANDLE hContact,const char *s  	char dbSetting[128];
 -	_snprintf(dbSetting, sizeof(dbSetting), "%s%u_%s", PREFIX_ITH, i, szSetting);
 +	mir_snprintf(dbSetting, sizeof(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, HANDLE hContact,const char *  	char dbSetting[128];
 -	_snprintf(dbSetting, sizeof(dbSetting), "%s%u_%s", PREFIX_ITH, i, szSetting);
 +	mir_snprintf(dbSetting, sizeof(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, HANDLE hContact,const char  	char dbSetting[128];
 -	_snprintf(dbSetting, sizeof(dbSetting), "%s%u_%s", PREFIX_ITH, i, szSetting);
 +	mir_snprintf(dbSetting, sizeof(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, HANDLE hContact, const char *sz  	char dbSetting[128];
 -	_snprintf(dbSetting, sizeof(dbSetting), "%s%u_%s", PREFIX_ITH, i, szSetting);
 +	mir_snprintf(dbSetting, sizeof(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, HANDLE hContact, const char *s  	char dbSetting[128];
 -	_snprintf(dbSetting, sizeof(dbSetting), "%s%u_%s", PREFIX_ITH, i, szSetting);
 +	mir_snprintf(dbSetting, sizeof(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, HANDLE hContact, const char  	char dbSetting[128];
 -	_snprintf(dbSetting, sizeof(dbSetting), "%s%u_%s", PREFIX_ITH, i, szSetting);
 +	mir_snprintf(dbSetting, sizeof(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, HANDLE hContact, const char *szModu  	char dbSetting[128];
 -	_snprintf(dbSetting, sizeof(dbSetting), "%s%u_%s", PREFIX_ITH, i, szSetting);
 +	mir_snprintf(dbSetting, sizeof(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, HANDLE hContact,const char *szMo  	char dbSetting[128];
 -	_snprintf(dbSetting, sizeof(dbSetting), "%s%u_%s", PREFIX_ITH, i, szSetting);
 +	mir_snprintf(dbSetting, sizeof(dbSetting), "%s%u_%s", PREFIX_ITH, i, szSetting);
  	return db_unset(hContact, szModule, dbSetting);
  }
 diff --git a/plugins/WhenWasIt/src/dlg_handlers.cpp b/plugins/WhenWasIt/src/dlg_handlers.cpp index bb82b06974..e7e4c7285d 100644 --- a/plugins/WhenWasIt/src/dlg_handlers.cpp +++ b/plugins/WhenWasIt/src/dlg_handlers.cpp @@ -194,7 +194,7 @@ INT_PTR CALLBACK DlgProcOptions(HWND hWnd, UINT msg, WPARAM wParam, LPARAM lPara  			SetWindowText(GetDlgItem(hWnd, IDC_DAYS_IN_ADVANCE), buffer);
  			_itot(commonData.checkInterval, buffer, 10);
  			SetWindowText(GetDlgItem(hWnd, IDC_CHECK_INTERVAL), buffer);
 -			_sntprintf(buffer, 1024, _T("%d|%d"), commonData.popupTimeout, commonData.popupTimeoutToday);
 +			mir_sntprintf(buffer, 1024, _T("%d|%d"), commonData.popupTimeout, commonData.popupTimeoutToday);
  			SetWindowText(GetDlgItem(hWnd, IDC_POPUP_TIMEOUT), buffer);
  			_itot(commonData.cSoundNearDays, buffer, 10);
  			SetWindowText(GetDlgItem(hWnd, IDC_SOUND_NEAR_DAYS_EDIT), buffer);
 @@ -421,7 +421,7 @@ INT_PTR CALLBACK DlgProcAddBirthday(HWND hWnd, UINT msg, WPARAM wParam, LPARAM l  			TCHAR buffer[maxSize];
  			char *szProto = GetContactProto(hContact);
  			TCHAR *name = GetContactName(hContact, szProto);
 -			_stprintf(buffer, TranslateT("Set birthday for %s:"), name);
 +			mir_sntprintf(buffer, SIZEOF(buffer), TranslateT("Set birthday for %s:"), name);
  			free(name);
  			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);
 -				_stprintf(buffer, TranslateT("%S protocol"), szProto);
 +				mir_sntprintf(buffer, SIZEOF(buffer), TranslateT("%S protocol"), szProto);
  				szCurrentModuleTooltip = buffer;
  				break;
 @@ -612,22 +612,22 @@ int UpdateBirthdayEntry(HWND hList, HANDLE hContact, int entry, int bShowAll, in  		TCHAR buffer[2048];
  		if ((dtb <= 366) && (dtb >= 0))
 -			_stprintf(buffer, _T("%d"), dtb);
 +			mir_sntprintf(buffer, SIZEOF(buffer), _T("%d"), dtb);
  		else
 -			_stprintf(buffer, NA);
 +			mir_sntprintf(buffer, SIZEOF(buffer), NA);
  		ListView_SetItemText(hList, entry, 2, buffer);
  		if ((year != 0) && (month != 0) && (day != 0))
 -			_stprintf(buffer, _T("%04d-%02d-%02d"), year, month, day);
 +			mir_sntprintf(buffer, SIZEOF(buffer), _T("%04d-%02d-%02d"), year, month, day);
  		else
 -			_stprintf(buffer, NA);
 +			mir_sntprintf(buffer, SIZEOF(buffer), NA);
  		ListView_SetItemText(hList, entry, 3, buffer);
  		if (age < 400) //hopefully noone lives longer than this :)
 -			_stprintf(buffer, _T("%d"), age);
 +			mir_sntprintf(buffer, SIZEOF(buffer), _T("%d"), age);
  		else
 -			_stprintf(buffer, NA);
 +			mir_sntprintf(buffer, SIZEOF(buffer), NA);
  		ListView_SetItemText(hList, entry, 4, buffer);
  		ListView_SetItemText(hList, entry, 5, GetBirthdayModule(module, hContact));
 @@ -677,7 +677,7 @@ void SetBirthdaysCount(HWND hWnd)  {
  	int count = ListView_GetItemCount((GetDlgItem(hWnd, IDC_BIRTHDAYS_LIST)));
  	TCHAR title[512];
 -	_stprintf(title, TranslateT("Birthday list (%d)"), count);
 +	mir_sntprintf(title, SIZEOF(title), TranslateT("Birthday list (%d)"), count);
  	SetWindowText(hWnd, title);
  }
 @@ -886,7 +886,7 @@ INT_PTR CALLBACK DlgProcUpcoming(HWND hWnd, UINT msg, WPARAM wParam, LPARAM lPar  		{
  			const int MAX_SIZE = 512;
  			TCHAR buffer[MAX_SIZE];
 -			_stprintf(buffer, (timeout != 2) ? TranslateT("Closing in %d seconds") : TranslateT("Closing in %d second"), --timeout);
 +			mir_sntprintf(buffer, SIZEOF(buffer), (timeout != 2) ? TranslateT("Closing in %d seconds") : TranslateT("Closing in %d second"), --timeout);
  			SetWindowText(GetDlgItem(hWnd, IDC_CLOSE), buffer);
  			if (timeout <= 0)
 diff --git a/plugins/WhenWasIt/src/services.cpp b/plugins/WhenWasIt/src/services.cpp index f9f43b2318..b0fb1a7a6c 100644 --- a/plugins/WhenWasIt/src/services.cpp +++ b/plugins/WhenWasIt/src/services.cpp @@ -211,7 +211,7 @@ INT_PTR RefreshUserDetailsService(WPARAM wParam, LPARAM lParam)  	HANDLE result = CreateThread(NULL, 0, RefreshUserDetailsWorkerThread, NULL, 0, &threadID);
  	if ( !result) {
  		TCHAR buffer[1024];
 -		_stprintf(buffer, TranslateT("Could not create worker thread. Error#%d - threadID %d"), GetLastError(), threadID);
 +		mir_sntprintf(buffer, SIZEOF(buffer), TranslateT("Could not create worker thread. Error#%d - threadID %d"), GetLastError(), threadID);
  		MessageBox(0, buffer, TranslateT("Error"), MB_OK | MB_ICONERROR);
  	}
 @@ -265,7 +265,7 @@ INT_PTR ExportBirthdaysService(WPARAM wParam, LPARAM lParam)  		if ( !_tcschr(fn, _T('.')))
  			_tcscat(fileName, _T(BIRTHDAY_EXTENSION));
 -		_stprintf(buffer, TranslateT("Exporting birthdays to file: %s"), fileName);
 +		mir_sntprintf(buffer, SIZEOF(buffer), TranslateT("Exporting birthdays to file: %s"), fileName);
  		ShowPopupMessage(TranslateT("WhenWasIt"), buffer, hExportBirthdays);
  		DoExport(fileName);
  		ShowPopupMessage(TranslateT("WhenWasIt"), TranslateT("Done exporting birthdays"), hExportBirthdays);
 @@ -312,7 +312,7 @@ int DoImport(TCHAR *fileName)  				}
  				else {
  					TCHAR tmp[2048];
 -					_stprintf(tmp, TranslateT(NOTFOUND_FORMAT), szHandle, szProto);
 +					mir_sntprintf(tmp, SIZEOF(tmp), TranslateT(NOTFOUND_FORMAT), szHandle, szProto);
  					ShowPopupMessage(TranslateT("Warning"), tmp, hImportBirthdays);
  				}
  			}
 diff --git a/plugins/YAMN/src/account.cpp b/plugins/YAMN/src/account.cpp index 8138528813..376389eddb 100644 --- a/plugins/YAMN/src/account.cpp +++ b/plugins/YAMN/src/account.cpp @@ -226,7 +226,7 @@ DWORD ReadStringFromMemory(char **Parser,TCHAR *End,char **StoreTo,TCHAR *DebugS  	Finder=*Parser;
  	while((*Finder != (TCHAR)0) && (Finder<=End)) Finder++;
 -	_stprintf(Debug,_T("%s: %s,length is %d, remaining %d chars"),DebugString,*Parser,Finder-*Parser,End-Finder);
 +	mir_sntprintf(Debug, SIZEOF(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;
 @@ -281,7 +281,7 @@ DWORD ReadStringFromMemoryW(WCHAR **Parser,TCHAR *End,WCHAR **StoreTo,WCHAR *Deb  	Finder=*Parser;
  	while((*Finder != (WCHAR)0) && (Finder<=(WCHAR *)End)) Finder++;
 -	swprintf(Debug,L"%s: %s,length is %d, remaining %d chars",DebugString,*Parser,Finder-*Parser,(WCHAR *)End-Finder);
 +	mir_sntprintf(Debug, SIZEOF(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;
 @@ -337,7 +337,7 @@ static DWORD ReadNotificationFromMemory(char **Parser,char *End,YAMN_NOTIFICATIO  	if (*Parser>=End)
  		return EACC_FILECOMPATIBILITY;
  #ifdef DEBUG_FILEREAD
 -	_stprintf(Debug,_T("NFlags: %04x, remaining %d chars"),Which->Flags,End-*Parser);
 +	mir_sntprintf(Debug, SIZEOF(Debug), _T("NFlags: %04x, remaining %d chars"), Which->Flags, End-*Parser);
  	MessageBox(NULL,Debug,_T("debug"),MB_OK);
  #endif
 @@ -346,7 +346,7 @@ static DWORD ReadNotificationFromMemory(char **Parser,char *End,YAMN_NOTIFICATIO  	if (*Parser>=End)
  		return EACC_FILECOMPATIBILITY;
  #ifdef DEBUG_FILEREAD
 -	_stprintf(Debug,_T("PopupB: %04x, remaining %d chars"),Which->PopupB,End-*Parser);
 +	mir_sntprintf(Debug, SIZEOF(Debug), _T("PopupB: %04x, remaining %d chars"), Which->PopupB, End-*Parser);
  	MessageBox(NULL,Debug,_T("debug"),MB_OK);
  #endif
  	Which->PopupT=*(COLORREF *)(*Parser);
 @@ -354,7 +354,7 @@ static DWORD ReadNotificationFromMemory(char **Parser,char *End,YAMN_NOTIFICATIO  	if (*Parser>=End)
  		return EACC_FILECOMPATIBILITY;
  #ifdef DEBUG_FILEREAD
 -	_stprintf(Debug,_T("PopupT: %04x, remaining %d chars"),Which->PopupT,End-*Parser);
 +	mir_sntprintf(Debug, SIZEOF(Debug), _T("PopupT: %04x, remaining %d chars"), Which->PopupT, End-*Parser);
  	MessageBox(NULL,Debug,_T("debug"),MB_OK);
  #endif
  	Which->PopupTime=*(DWORD *)(*Parser);
 @@ -362,7 +362,7 @@ static DWORD ReadNotificationFromMemory(char **Parser,char *End,YAMN_NOTIFICATIO  	if (*Parser>=End)
  		return EACC_FILECOMPATIBILITY;
  #ifdef DEBUG_FILEREAD
 -	_stprintf(Debug,_T("PopupTime: %04x, remaining %d chars"),Which->PopupTime,End-*Parser);
 +	mir_sntprintf(Debug, SIZEOF(Debug), _T("PopupTime: %04x, remaining %d chars"), Which->PopupTime, End-*Parser);
  	MessageBox(NULL,Debug,_T("debug"),MB_OK);
  #endif
 @@ -512,7 +512,7 @@ DWORD ReadAccountFromMemory(HACCOUNT Which,char **Parser,char *End)  	if (*Parser>=End)
  		return EACC_FILECOMPATIBILITY;
  #ifdef	DEBUG_FILEREAD
 -	_stprintf(Debug,_T("Port: %d, remaining %d chars"),Which->Server->Port,End-*Parser);
 +	mir_sntprintf(Debug, SIZEOF(Debug), _T("Port: %d, remaining %d chars"), Which->Server->Port, End-*Parser);
  	MessageBox(NULL,Debug,_T("debug"),MB_OK);
  #endif
  #ifdef	DEBUG_FILEREAD
 @@ -535,19 +535,19 @@ DWORD ReadAccountFromMemory(HACCOUNT Which,char **Parser,char *End)  	if (*Parser>=End)
  		return EACC_FILECOMPATIBILITY;
  #ifdef DEBUG_FILEREAD
 -	_stprintf(Debug,_T("Flags: %04x, remaining %d chars"),Which->Flags,End-*Parser);
 +	mir_sntprintf(Debug, SIZEOF(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
 -	_stprintf(Debug,_T("STFlags: %04x, remaining %d chars"),Which->StatusFlags,End-*Parser);
 +	mir_sntprintf(Debug, SIZEOF(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
 -	_stprintf(Debug,_T("PFlags: %04x, remaining %d chars"),Which->PluginFlags,End-*Parser);
 +	mir_sntprintf(Debug, SIZEOF(Debug), _T("PFlags: %04x, remaining %d chars"), Which->PluginFlags, End-*Parser);
  	MessageBox(NULL,Debug,_T("debug"),MB_OK);
  #endif
 @@ -558,7 +558,7 @@ DWORD ReadAccountFromMemory(HACCOUNT Which,char **Parser,char *End)  	if (*Parser>=End)
  		return EACC_FILECOMPATIBILITY;
  #ifdef DEBUG_FILEREAD
 -	_stprintf(Debug,_T("Interval: %d, remaining %d chars"),Which->Interval,End-*Parser);
 +	mir_sntprintf(Debug, SIZEOF(Debug), _T("Interval: %d, remaining %d chars"), Which->Interval, End-*Parser);
  	MessageBox(NULL,Debug,_T("debug"),MB_OK);
  #endif
 @@ -601,7 +601,7 @@ DWORD ReadAccountFromMemory(HACCOUNT Which,char **Parser,char *End)  	if (*Parser>=End)
  		return EACC_FILECOMPATIBILITY;
  #ifdef DEBUG_FILEREAD
 -	_stprintf(Debug,_T("LastChecked: %04x, remaining %d chars"),Which->LastChecked,End-*Parser);
 +	mir_sntprintf(Debug, SIZEOF(Debug), _T("LastChecked: %04x, remaining %d chars"), Which->LastChecked, End-*Parser);
  	MessageBox(NULL,Debug,_T("debug"),MB_OK);
  #endif
  	Which->LastSChecked=*(SYSTEMTIME *)(*Parser);
 @@ -609,7 +609,7 @@ DWORD ReadAccountFromMemory(HACCOUNT Which,char **Parser,char *End)  	if (*Parser>=End)
  		return EACC_FILECOMPATIBILITY;
  #ifdef DEBUG_FILEREAD
 -	_stprintf(Debug,_T("LastSChecked: %04x, remaining %d chars"),Which->LastSChecked,End-*Parser);
 +	mir_sntprintf(Debug, SIZEOF(Debug), _T("LastSChecked: %04x, remaining %d chars"), Which->LastSChecked, End-*Parser);
  	MessageBox(NULL,Debug,_T("debug"),MB_OK);
  #endif
  	Which->LastSynchronised=*(SYSTEMTIME *)(*Parser);
 @@ -617,7 +617,7 @@ DWORD ReadAccountFromMemory(HACCOUNT Which,char **Parser,char *End)  	if (*Parser>=End)
  		return EACC_FILECOMPATIBILITY;
  #ifdef DEBUG_FILEREAD
 -	_stprintf(Debug,_T("LastSynchronised: %04x, remaining %d chars"),Which->LastSynchronised,End-*Parser);
 +	mir_sntprintf(Debug, SIZEOF(Debug), _T("LastSynchronised: %04x, remaining %d chars"), Which->LastSynchronised, End-*Parser);
  	MessageBox(NULL,Debug,_T("debug"),MB_OK);
  #endif
  	Which->LastMail=*(SYSTEMTIME *)(*Parser);
 @@ -625,7 +625,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
 -	_stprintf(Debug,_T("LastMail: %04x, remaining %d chars"),Which->LastMail,End-*Parser);
 +	mir_sntprintf(Debug, SIZEOF(Debug), _T("LastMail: %04x, remaining %d chars"), Which->LastMail, End-*Parser);
  	MessageBox(NULL,Debug,_T("debug"),MB_OK);
  #endif
  	if (*Parser==End)
 @@ -831,11 +831,6 @@ static INT_PTR PerformAccountWriting(HYAMNPROTOPLUGIN Plugin,HANDLE File)  	{
  		for (ActualAccount=Plugin->FirstAccount;ActualAccount != NULL;ActualAccount=ActualAccount->Next)
  		{
 -/*			TCHAR DEBUG[100];
 -			Beep(3000,100);Sleep(200);
 -			_stprintf(DEBUG,_T("Browsing account %s"),ActualAccount->Name==NULL ? _T("(null)") : ActualAccount->Name);
 -			MessageBox(NULL,DEBUG,_T("debug- WriteAccount..."),MB_OK);
 -*/
  #ifdef DEBUG_SYNCHRO
  			DebugLog(SynchroFile,"WriteAccountsToFile:ActualAccountSO-read wait\n");
  #endif
 diff --git a/plugins/YAMN/src/browser/badconnect.cpp b/plugins/YAMN/src/browser/badconnect.cpp index cb549b29f3..c233475d29 100644 --- a/plugins/YAMN/src/browser/badconnect.cpp +++ b/plugins/YAMN/src/browser/badconnect.cpp @@ -117,8 +117,9 @@ INT_PTR CALLBACK DlgProcYAMNBadConnection(HWND hDlg,UINT msg,WPARAM wParam,LPARA  #ifdef DEBUG_SYNCHRO
  			DebugLog(SynchroFile,"BadConnect:ActualAccountSO-read enter\n");
  #endif
 -			TitleStrA = new char[strlen(ActualAccount->Name)+strlen(Translate(BADCONNECTTITLE))];
 -			wsprintfA(TitleStrA,Translate(BADCONNECTTITLE),ActualAccount->Name);
 +			int size = strlen(ActualAccount->Name)+strlen(Translate(BADCONNECTTITLE));
 +			TitleStrA = new char[size];
 +			mir_snprintf(TitleStrA, size, Translate(BADCONNECTTITLE), ActualAccount->Name);
  			ShowPopup=ActualAccount->BadConnectN.Flags & YAMN_ACC_POP;
  			ShowMsg=ActualAccount->BadConnectN.Flags & YAMN_ACC_MSG;
 diff --git a/plugins/YAMN/src/debug.cpp b/plugins/YAMN/src/debug.cpp index c459d0cbb7..2f2d3d1069 100644 --- a/plugins/YAMN/src/debug.cpp +++ b/plugins/YAMN/src/debug.cpp @@ -43,21 +43,21 @@ void InitDebug()  	InitializeCriticalSection(&FileAccessCS);
  #ifdef DEBUG_SYNCHRO
 -	_stprintf(DebugFileName,DebugSynchroFileName2,DebugUserDirectory);
 +	mir_sntprintf(DebugFileName, SIZEOF(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
 -	_stprintf(DebugFileName,DebugCommFileName2,DebugUserDirectory);
 +	mir_sntprintf(DebugFileName, SIZEOF(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
 -	_stprintf(DebugFileName,DebugDecodeFileName2,DebugUserDirectory);
 +	mir_sntprintf(DebugFileName, SIZEOF(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);
 @@ -93,7 +93,7 @@ void DebugLog(HANDLE File,const char *fmt,...)  	va_start(vararg,fmt);
  	str=(char *)malloc(strsize=65536);
  	mir_snprintf(tids, SIZEOF(tids), "[%x]",GetCurrentThreadId());
 -	while(_vsnprintf(str,strsize,fmt,vararg)==-1)
 +	while(mir_vsnprintf(str, strsize, fmt, vararg)==-1)
  		str=(char *)realloc(str,strsize+=65536);
  	va_end(vararg);
  	EnterCriticalSection(&FileAccessCS);
 @@ -114,7 +114,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());
 -	while(_vsnwprintf(str,strsize,fmt,vararg)==-1)
 +	while(mir_vsnwprintf(str, strsize, fmt, vararg)==-1)
  		str=(WCHAR *)realloc(str,(strsize+=65536)*sizeof(WCHAR));
  	va_end(vararg);
  	EnterCriticalSection(&FileAccessCS);
 diff --git a/plugins/helpers/gen_helpers.cpp b/plugins/helpers/gen_helpers.cpp index 39927fcece..ba88fec81d 100644 --- a/plugins/helpers/gen_helpers.cpp +++ b/plugins/helpers/gen_helpers.cpp @@ -115,7 +115,7 @@ int AddDebugLogMessageA(const char* fmt, ...)  	va_list va;
  	va_start(va,fmt);
 -	_vsnprintf(szText, sizeof(szText), fmt, va);
 +	mir_vsnprintf(szText, sizeof(szText), fmt, va);
  	va_end(va);
  #ifdef MODULENAME
  	mir_snprintf(szFinal, sizeof(szFinal), "%s: %s", MODULENAME, szText);
 @@ -135,7 +135,7 @@ int AddDebugLogMessage(const TCHAR* fmt, ...) {  	va_list va;
  	va_start(va,fmt);
 -	_vsntprintf(tszText, SIZEOF(tszText), fmt, va);
 +	mir_vsntprintf(tszText, SIZEOF(tszText), fmt, va);
  	va_end(va);
  #ifdef MODULENAME
  	mir_sntprintf(tszFinal, SIZEOF(tszFinal), _T("%s: %s"), MODULENAME, tszText);
 @@ -159,7 +159,7 @@ int AddErrorLogMessageA(const char* fmt, ...) {  	va_list va;
  	va_start(va,fmt);
 -	_vsnprintf(szText, sizeof(szText), fmt, va);
 +	mir_vsnprintf(szText, sizeof(szText), fmt, va);
  	va_end(va);
  #ifdef MODULENAME
  	mir_snprintf(szFinal, sizeof(szFinal), "%s: %s", MODULENAME, szText);
 @@ -180,7 +180,7 @@ int AddErrorLogMessage(const TCHAR* fmt, ...) {  	va_list va;
  	va_start(va,fmt);
 -	_vsntprintf(tszText, SIZEOF(tszText), fmt, va);
 +	mir_vsntprintf(tszText, SIZEOF(tszText), fmt, va);
  	va_end(va);
  #ifdef MODULENAME
  	mir_sntprintf(tszFinal, SIZEOF(tszFinal), _T("%s: %s"), MODULENAME, tszText);
  | 
