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
+31 -16
View File
@@ -380,9 +380,11 @@ bool IsVisualStudioMacrosFileRegistered(const std::string& macrosFile,
LONG result = ERROR_SUCCESS;
DWORD index = 0;
keyname = "Software\\Microsoft\\VisualStudio\\8.0\\vsmacros\\OtherProjects7";
keyname =
"Software\\Microsoft\\VisualStudio\\8.0\\vsmacros\\OtherProjects7";
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)
{
// 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.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))
{
// Open the subkey and query the values of interest:
@@ -405,15 +408,18 @@ bool IsVisualStudioMacrosFileRegistered(const std::string& macrosFile,
DWORD valueType = REG_SZ;
CHAR data1[256];
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 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 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);
cmSystemTools::ConvertToUnixSlashes(s2);
@@ -478,23 +484,28 @@ bool IsVisualStudioMacrosFileRegistered(const std::string& macrosFile,
nextAvailableSubKeyName = ossNext.str();
keyname = "Software\\Microsoft\\VisualStudio\\8.0\\vsmacros\\RecordingProject7";
keyname =
"Software\\Microsoft\\VisualStudio\\8.0\\vsmacros\\RecordingProject7";
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)
{
DWORD valueType = REG_SZ;
CHAR data1[256];
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 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 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);
cmSystemTools::ConvertToUnixSlashes(s2);
@@ -525,7 +536,8 @@ void WriteVSMacrosFileRegistryEntry(
const std::string& nextAvailableSubKeyName,
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;
LONG result = RegOpenKeyEx(HKEY_CURRENT_USER, keyname.c_str(), 0,
KEY_READ|KEY_WRITE, &hkey);
@@ -543,7 +555,7 @@ void WriteVSMacrosFileRegistryEntry(
cmSystemTools::ReplaceString(s, "/", "\\");
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)
{
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"
// if you put the file somewhere outside the standard VSMacros folder)
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)
{
std::cout << "error result 2: " << result << std::endl;
@@ -562,7 +575,8 @@ void WriteVSMacrosFileRegistryEntry(
// StorageFormat value is always "0" for sample macros files
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)
{
std::cout << "error result 3: " << result << std::endl;
@@ -573,7 +587,8 @@ void WriteVSMacrosFileRegistryEntry(
}
else
{
std::cout << "error creating subkey: " << nextAvailableSubKeyName << std::endl;
std::cout << "error creating subkey: "
<< nextAvailableSubKeyName << std::endl;
std::cout << std::endl;
}
RegCloseKey(hkey);