1
0
Fork 1
mirror of https://github.com/TES3MP/openmw-tes3mp.git synced 2025-01-19 20:53:50 +00:00

Vector instead of new/delete

This commit is contained in:
Alexander "Ace" Olofsson 2012-01-17 09:02:45 +01:00
parent 8663177ad1
commit b4174b6419

View file

@ -90,15 +90,13 @@ boost::filesystem::path WindowsPath::getInstallPath() const
if (RegOpenKeyEx(HKEY_LOCAL_MACHINE, TEXT(regkey), 0, KEY_ALL_ACCESS, &hKey) == ERROR_SUCCESS)
{
//Key existed, let's try to read the install dir
char* data = new char[4096];
int len = 4096;
std::vector<char> buf(512);
int len = 512;
if (RegQueryValueEx(hKey, TEXT("Installed Path"), NULL, NULL, (LPBYTE)data, (LPDWORD)&len) == ERROR_SUCCESS)
if (RegQueryValueEx(hKey, TEXT("Installed Path"), NULL, NULL, (LPBYTE)&buf[0], (LPDWORD)&len) == ERROR_SUCCESS)
{
installPath = data;
installPath = &buf[0];
}
delete[] data;
}
return installPath;