Rietveld Code Review Tool
Help | Bug tracker | Discussion group | Source code

Side by Side Diff: src/plugin/PluginSettings.cpp

Issue 5163581322559488: Issue 1283 - wrong usage of memset, fix sizeof, make proper initializing (Closed)
Patch Set: fix usage of GetLocaleInfo Created Oct. 8, 2014, 9:37 p.m.
Left:
Right:
Use n/p to move between diff chunks; N/P to move between comments.
Jump to:
View unified diff | Download patch
OLDNEW
1 #include "PluginStdAfx.h" 1 #include "PluginStdAfx.h"
2 2
3 #include <Wbemidl.h> 3 #include <Wbemidl.h>
4 #include <time.h> 4 #include <time.h>
5 #include "PluginSettings.h" 5 #include "PluginSettings.h"
6 #include "PluginClient.h" 6 #include "PluginClient.h"
7 #include "PluginSystem.h" 7 #include "PluginSystem.h"
8 #include "PluginFilter.h" 8 #include "PluginFilter.h"
9 #include "PluginMutex.h" 9 #include "PluginMutex.h"
10 #include "../shared/Utils.h" 10 #include "../shared/Utils.h"
(...skipping 213 matching lines...) Expand 10 before | Expand all | Expand 10 after
224 ReadWhitelist(true); 224 ReadWhitelist(true);
225 } 225 }
226 226
227 return true; 227 return true;
228 } 228 }
229 229
230 DWORD CPluginSettings::GetWindowsBuildNumber() 230 DWORD CPluginSettings::GetWindowsBuildNumber()
231 { 231 {
232 if (m_WindowsBuildNumber == 0) 232 if (m_WindowsBuildNumber == 0)
233 { 233 {
234 OSVERSIONINFOEX osvi; 234 OSVERSIONINFOEX osvi = {};
235 SYSTEM_INFO si; 235 osvi.dwOSVersionInfoSize = sizeof(osvi);
236 BOOL bOsVersionInfoEx; 236 if (GetVersionExW(reinterpret_cast<OSVERSIONINFO*>(&osvi)) != 0)
237 237 {
238 ZeroMemory(&si, sizeof(SYSTEM_INFO)); 238 m_WindowsBuildNumber = osvi.dwBuildNumber;
239 ZeroMemory(&osvi, sizeof(OSVERSIONINFOEX)); 239 }
240
241 osvi.dwOSVersionInfoSize = sizeof(OSVERSIONINFOEX);
242 bOsVersionInfoEx = GetVersionEx((OSVERSIONINFO*) &osvi);
243
244 m_WindowsBuildNumber = osvi.dwBuildNumber;
245 } 240 }
246 241
247 return m_WindowsBuildNumber; 242 return m_WindowsBuildNumber;
248 } 243 }
249 244
250 void CPluginSettings::SetSubscription(const std::wstring& url) 245 void CPluginSettings::SetSubscription(const std::wstring& url)
251 { 246 {
252 CPluginClient::GetInstance()->SetSubscription(url); 247 CPluginClient::GetInstance()->SetSubscription(url);
253 RefreshWhitelist(); 248 RefreshWhitelist();
254 } 249 }
(...skipping 15 matching lines...) Expand all
270 265
271 CString CPluginSettings::GetAppLocale() 266 CString CPluginSettings::GetAppLocale()
272 { 267 {
273 return to_CString(GetBrowserLanguage()); 268 return to_CString(GetBrowserLanguage());
274 } 269 }
275 270
276 CString CPluginSettings::GetDocumentationLink() 271 CString CPluginSettings::GetDocumentationLink()
277 { 272 {
278 return CString(CPluginClient::GetInstance()->GetDocumentationLink().c_str()); 273 return CString(CPluginClient::GetInstance()->GetDocumentationLink().c_str());
279 } 274 }
OLDNEW

Powered by Google App Engine
This is Rietveld