STYLE: Fixed line-too-long. COMP: Fixed warnings about lossy conversions.

This commit is contained in:
Brad King 2007-11-20 11:10:11 -05:00
parent d5ff71a14e
commit eee575283d
5 changed files with 46 additions and 21 deletions

View File

@ -347,7 +347,8 @@ HRESULT FindVisualStudioInstances(
//std::cout << "Found Visual Studio instance." << std::endl; //std::cout << "Found Visual Studio instance." << std::endl;
//std::cout << " ROT entry name: " << it->first << std::endl; //std::cout << " ROT entry name: " << it->first << std::endl;
//std::cout << " ROT entry object: " << (IUnknown*) it->second << std::endl; //std::cout << " ROT entry object: "
// << (IUnknown*) it->second << std::endl;
//std::cout << " slnFile: " << slnFile << std::endl; //std::cout << " slnFile: " << slnFile << std::endl;
//std::cout << " slnName: " << slnName << std::endl; //std::cout << " slnName: " << slnName << std::endl;
} }
@ -381,7 +382,7 @@ int cmCallVisualStudioMacro::GetNumberOfRunningVisualStudioInstances(
if(SUCCEEDED(hr)) if(SUCCEEDED(hr))
{ {
count = instances.size(); count = static_cast<int>(instances.size());
} }
// Force release all COM pointers before CoUninitialize: // Force release all COM pointers before CoUninitialize:
@ -389,6 +390,8 @@ int cmCallVisualStudioMacro::GetNumberOfRunningVisualStudioInstances(
CoUninitialize(); CoUninitialize();
} }
#else
(void)slnFile;
#endif #endif
return count; return count;
@ -449,6 +452,9 @@ int cmCallVisualStudioMacro::CallMacro(
CoUninitialize(); CoUninitialize();
} }
#else #else
(void)slnFile;
(void)macro;
(void)args;
cmSystemTools::Error("cmCallVisualStudioMacro::CallMacro is not " cmSystemTools::Error("cmCallVisualStudioMacro::CallMacro is not "
"supported on this platform"); "supported on this platform");
#endif #endif

View File

@ -1795,7 +1795,9 @@ void cmGlobalGenerator::FileReplacedDuringGenerate(const std::string& filename)
this->FilesReplacedDuringGenerate.push_back(filename); this->FilesReplacedDuringGenerate.push_back(filename);
} }
void cmGlobalGenerator::GetFilesReplacedDuringGenerate(std::vector<std::string>& filenames) void
cmGlobalGenerator
::GetFilesReplacedDuringGenerate(std::vector<std::string>& filenames)
{ {
filenames.clear(); filenames.clear();
std::copy( std::copy(

View File

@ -79,7 +79,8 @@ std::string cmGlobalVisualStudio8Generator::GetUserMacrosDirectory()
// base begins with the VisualStudioProjectsLocation reg value... // base begins with the VisualStudioProjectsLocation reg value...
if (cmSystemTools::ReadRegistryValue( if (cmSystemTools::ReadRegistryValue(
"HKEY_CURRENT_USER\\Software\\Microsoft\\VisualStudio\\8.0;VisualStudioProjectsLocation", "HKEY_CURRENT_USER\\Software\\Microsoft\\VisualStudio\\8.0;"
"VisualStudioProjectsLocation",
base)) base))
{ {
cmSystemTools::ConvertToUnixSlashes(base); cmSystemTools::ConvertToUnixSlashes(base);

View File

@ -69,7 +69,8 @@ std::string cmGlobalVisualStudio9Generator::GetUserMacrosDirectory()
// base begins with the VisualStudioProjectsLocation reg value... // base begins with the VisualStudioProjectsLocation reg value...
if (cmSystemTools::ReadRegistryValue( if (cmSystemTools::ReadRegistryValue(
"HKEY_CURRENT_USER\\Software\\Microsoft\\VisualStudio\\9.0;VisualStudioProjectsLocation", "HKEY_CURRENT_USER\\Software\\Microsoft\\VisualStudio\\9.0;"
"VisualStudioProjectsLocation",
base)) base))
{ {
cmSystemTools::ConvertToUnixSlashes(base); cmSystemTools::ConvertToUnixSlashes(base);

View File

@ -380,9 +380,11 @@ bool IsVisualStudioMacrosFileRegistered(const std::string& macrosFile,
LONG result = ERROR_SUCCESS; LONG result = ERROR_SUCCESS;
DWORD index = 0; DWORD index = 0;
keyname = "Software\\Microsoft\\VisualStudio\\8.0\\vsmacros\\OtherProjects7"; keyname =
"Software\\Microsoft\\VisualStudio\\8.0\\vsmacros\\OtherProjects7";
hkey = NULL; hkey = NULL;
result = RegOpenKeyEx(HKEY_CURRENT_USER, keyname.c_str(), 0, KEY_READ, &hkey); result = RegOpenKeyEx(HKEY_CURRENT_USER, keyname.c_str(),
0, KEY_READ, &hkey);
if (ERROR_SUCCESS == result) if (ERROR_SUCCESS == result)
{ {
// Iterate the subkeys and look for the values of interest in each subkey: // Iterate the subkeys and look for the values of interest in each subkey:
@ -394,7 +396,8 @@ bool IsVisualStudioMacrosFileRegistered(const std::string& macrosFile,
lastWriteTime.dwHighDateTime = 0; lastWriteTime.dwHighDateTime = 0;
lastWriteTime.dwLowDateTime = 0; lastWriteTime.dwLowDateTime = 0;
while (ERROR_SUCCESS == RegEnumKeyEx(hkey, index, subkeyname, &cch_subkeyname, while (ERROR_SUCCESS == RegEnumKeyEx(hkey, index, subkeyname,
&cch_subkeyname,
0, keyclass, &cch_keyclass, &lastWriteTime)) 0, keyclass, &cch_keyclass, &lastWriteTime))
{ {
// Open the subkey and query the values of interest: // Open the subkey and query the values of interest:
@ -405,15 +408,18 @@ bool IsVisualStudioMacrosFileRegistered(const std::string& macrosFile,
DWORD valueType = REG_SZ; DWORD valueType = REG_SZ;
CHAR data1[256]; CHAR data1[256];
DWORD cch_data1 = sizeof(data1)/sizeof(data1[0]); DWORD cch_data1 = sizeof(data1)/sizeof(data1[0]);
RegQueryValueEx(hsubkey, "Path", 0, &valueType, (LPBYTE) &data1[0], &cch_data1); RegQueryValueEx(hsubkey, "Path", 0, &valueType,
(LPBYTE) &data1[0], &cch_data1);
DWORD data2 = 0; DWORD data2 = 0;
DWORD cch_data2 = sizeof(data2); DWORD cch_data2 = sizeof(data2);
RegQueryValueEx(hsubkey, "Security", 0, &valueType, (LPBYTE) &data2, &cch_data2); RegQueryValueEx(hsubkey, "Security", 0, &valueType,
(LPBYTE) &data2, &cch_data2);
DWORD data3 = 0; DWORD data3 = 0;
DWORD cch_data3 = sizeof(data3); DWORD cch_data3 = sizeof(data3);
RegQueryValueEx(hsubkey, "StorageFormat", 0, &valueType, (LPBYTE) &data3, &cch_data3); RegQueryValueEx(hsubkey, "StorageFormat", 0, &valueType,
(LPBYTE) &data3, &cch_data3);
s2 = cmSystemTools::LowerCase(data1); s2 = cmSystemTools::LowerCase(data1);
cmSystemTools::ConvertToUnixSlashes(s2); cmSystemTools::ConvertToUnixSlashes(s2);
@ -478,23 +484,28 @@ bool IsVisualStudioMacrosFileRegistered(const std::string& macrosFile,
nextAvailableSubKeyName = ossNext.str(); nextAvailableSubKeyName = ossNext.str();
keyname = "Software\\Microsoft\\VisualStudio\\8.0\\vsmacros\\RecordingProject7"; keyname =
"Software\\Microsoft\\VisualStudio\\8.0\\vsmacros\\RecordingProject7";
hkey = NULL; hkey = NULL;
result = RegOpenKeyEx(HKEY_CURRENT_USER, keyname.c_str(), 0, KEY_READ, &hkey); result = RegOpenKeyEx(HKEY_CURRENT_USER, keyname.c_str(),
0, KEY_READ, &hkey);
if (ERROR_SUCCESS == result) if (ERROR_SUCCESS == result)
{ {
DWORD valueType = REG_SZ; DWORD valueType = REG_SZ;
CHAR data1[256]; CHAR data1[256];
DWORD cch_data1 = sizeof(data1)/sizeof(data1[0]); DWORD cch_data1 = sizeof(data1)/sizeof(data1[0]);
RegQueryValueEx(hkey, "Path", 0, &valueType, (LPBYTE) &data1[0], &cch_data1); RegQueryValueEx(hkey, "Path", 0, &valueType,
(LPBYTE) &data1[0], &cch_data1);
DWORD data2 = 0; DWORD data2 = 0;
DWORD cch_data2 = sizeof(data2); DWORD cch_data2 = sizeof(data2);
RegQueryValueEx(hkey, "Security", 0, &valueType, (LPBYTE) &data2, &cch_data2); RegQueryValueEx(hkey, "Security", 0, &valueType,
(LPBYTE) &data2, &cch_data2);
DWORD data3 = 0; DWORD data3 = 0;
DWORD cch_data3 = sizeof(data3); DWORD cch_data3 = sizeof(data3);
RegQueryValueEx(hkey, "StorageFormat", 0, &valueType, (LPBYTE) &data3, &cch_data3); RegQueryValueEx(hkey, "StorageFormat", 0, &valueType,
(LPBYTE) &data3, &cch_data3);
s2 = cmSystemTools::LowerCase(data1); s2 = cmSystemTools::LowerCase(data1);
cmSystemTools::ConvertToUnixSlashes(s2); cmSystemTools::ConvertToUnixSlashes(s2);
@ -525,7 +536,8 @@ void WriteVSMacrosFileRegistryEntry(
const std::string& nextAvailableSubKeyName, const std::string& nextAvailableSubKeyName,
const std::string& macrosFile) const std::string& macrosFile)
{ {
std::string keyname = "Software\\Microsoft\\VisualStudio\\8.0\\vsmacros\\OtherProjects7"; std::string keyname =
"Software\\Microsoft\\VisualStudio\\8.0\\vsmacros\\OtherProjects7";
HKEY hkey = NULL; HKEY hkey = NULL;
LONG result = RegOpenKeyEx(HKEY_CURRENT_USER, keyname.c_str(), 0, LONG result = RegOpenKeyEx(HKEY_CURRENT_USER, keyname.c_str(), 0,
KEY_READ|KEY_WRITE, &hkey); KEY_READ|KEY_WRITE, &hkey);
@ -543,7 +555,7 @@ void WriteVSMacrosFileRegistryEntry(
cmSystemTools::ReplaceString(s, "/", "\\"); cmSystemTools::ReplaceString(s, "/", "\\");
result = RegSetValueEx(hsubkey, "Path", 0, REG_SZ, (LPBYTE) s.c_str(), result = RegSetValueEx(hsubkey, "Path", 0, REG_SZ, (LPBYTE) s.c_str(),
strlen(s.c_str()) + 1); static_cast<DWORD>(strlen(s.c_str()) + 1));
if (ERROR_SUCCESS != result) if (ERROR_SUCCESS != result)
{ {
std::cout << "error result 1: " << result << std::endl; std::cout << "error result 1: " << result << std::endl;
@ -553,7 +565,8 @@ void WriteVSMacrosFileRegistryEntry(
// Security value is always "1" for sample macros files (seems to be "2" // Security value is always "1" for sample macros files (seems to be "2"
// if you put the file somewhere outside the standard VSMacros folder) // if you put the file somewhere outside the standard VSMacros folder)
dw = 1; dw = 1;
result = RegSetValueEx(hsubkey, "Security", 0, REG_DWORD, (LPBYTE) &dw, sizeof(DWORD)); result = RegSetValueEx(hsubkey, "Security",
0, REG_DWORD, (LPBYTE) &dw, sizeof(DWORD));
if (ERROR_SUCCESS != result) if (ERROR_SUCCESS != result)
{ {
std::cout << "error result 2: " << result << std::endl; std::cout << "error result 2: " << result << std::endl;
@ -562,7 +575,8 @@ void WriteVSMacrosFileRegistryEntry(
// StorageFormat value is always "0" for sample macros files // StorageFormat value is always "0" for sample macros files
dw = 0; dw = 0;
result = RegSetValueEx(hsubkey, "StorageFormat", 0, REG_DWORD, (LPBYTE) &dw, sizeof(DWORD)); result = RegSetValueEx(hsubkey, "StorageFormat",
0, REG_DWORD, (LPBYTE) &dw, sizeof(DWORD));
if (ERROR_SUCCESS != result) if (ERROR_SUCCESS != result)
{ {
std::cout << "error result 3: " << result << std::endl; std::cout << "error result 3: " << result << std::endl;
@ -573,7 +587,8 @@ void WriteVSMacrosFileRegistryEntry(
} }
else else
{ {
std::cout << "error creating subkey: " << nextAvailableSubKeyName << std::endl; std::cout << "error creating subkey: "
<< nextAvailableSubKeyName << std::endl;
std::cout << std::endl; std::cout << std::endl;
} }
RegCloseKey(hkey); RegCloseKey(hkey);