mirror of
				https://github.com/chibicitiberiu/rainmeter-studio.git
				synced 2024-02-24 04:33:31 +00:00 
			
		
		
		
	Core dll:
- Replace swprintf/wsprintf/wcscpy/wcscat to _snwprintf_s/wcsncpy_s/wcsncat_s. - Changed printf format parameter strictly for supporting both 32bit and 64bit. - Fixed an issue that !RainmeterWriteKeyValue doesn't accept %APPDATA%\Rainmeter path. - Code cleanup.
This commit is contained in:
		@@ -515,7 +515,7 @@ BOOL LSLog(int nLevel, LPCTSTR pszModule, LPCTSTR pszMessage)
 | 
			
		||||
		startTime = time;
 | 
			
		||||
	}
 | 
			
		||||
	WCHAR buffer[128];
 | 
			
		||||
	swprintf(buffer, L"(%02i:%02i:%02i.%03i) ", (time - startTime) / (1000 * 60* 60), ((time - startTime) / (1000 * 60)) % 60, ((time - startTime) / 1000) % 60, (time - startTime) % 1000);
 | 
			
		||||
	_snwprintf_s(buffer, _TRUNCATE, L"(%02i:%02i:%02i.%03i) ", (time - startTime) / (1000 * 60* 60), ((time - startTime) / (1000 * 60)) % 60, ((time - startTime) / 1000) % 60, (time - startTime) % 1000);
 | 
			
		||||
 | 
			
		||||
	std::wstring message(buffer);
 | 
			
		||||
	logInfo.timestamp = message; 
 | 
			
		||||
@@ -615,10 +615,10 @@ void DebugLog(const WCHAR* format, ... )
 | 
			
		||||
	_CrtSetReportMode(_CRT_ASSERT, 0);
 | 
			
		||||
 | 
			
		||||
	errno = 0;
 | 
			
		||||
	_vsnwprintf_s( buffer, 4096, _TRUNCATE, format, args );
 | 
			
		||||
	_vsnwprintf_s( buffer, _TRUNCATE, format, args );
 | 
			
		||||
	if (errno != 0)
 | 
			
		||||
	{
 | 
			
		||||
		_snwprintf_s(buffer, 4096, _TRUNCATE, L"DebugLog internal error: %s", format);
 | 
			
		||||
		_snwprintf_s(buffer, _TRUNCATE, L"DebugLog internal error: %s", format);
 | 
			
		||||
	}
 | 
			
		||||
 | 
			
		||||
	_set_invalid_parameter_handler(oldHandler);
 | 
			
		||||
 
 | 
			
		||||
		Reference in New Issue
	
	Block a user