summaryrefslogtreecommitdiffstats
path: root/Source/kwsys/Registry.cxx
diff options
context:
space:
mode:
authorAndy Cedilnik <andy.cedilnik@kitware.com>2005-09-22 13:58:03 (GMT)
committerAndy Cedilnik <andy.cedilnik@kitware.com>2005-09-22 13:58:03 (GMT)
commitba90faca0a63485e6f49bec9a3ebda65fa31f60f (patch)
tree6db5375522f7cf3ab60756436b8d13e0dc47791f /Source/kwsys/Registry.cxx
parent5c133cd7e612ce9b43708e55efafbf2f60ce8169 (diff)
downloadCMake-ba90faca0a63485e6f49bec9a3ebda65fa31f60f.zip
CMake-ba90faca0a63485e6f49bec9a3ebda65fa31f60f.tar.gz
CMake-ba90faca0a63485e6f49bec9a3ebda65fa31f60f.tar.bz2
COMP: Try to remove warnings
Diffstat (limited to 'Source/kwsys/Registry.cxx')
-rw-r--r--Source/kwsys/Registry.cxx32
1 files changed, 14 insertions, 18 deletions
diff --git a/Source/kwsys/Registry.cxx b/Source/kwsys/Registry.cxx
index d7c5f0a..97d854d 100644
--- a/Source/kwsys/Registry.cxx
+++ b/Source/kwsys/Registry.cxx
@@ -138,19 +138,19 @@ bool Registry::Open(const char *toplevel,
bool res = false;
if ( m_Locked )
{
- return 0;
+ return res;
}
if ( m_Opened )
{
if ( !this->Close() )
{
- return false;
+ return res;
}
}
if ( !toplevel || !*toplevel )
{
kwsys_ios::cerr << "Registry::Opened() Toplevel not defined" << kwsys_ios::endl;
- return false;
+ return res;
}
if ( isspace(toplevel[0]) ||
@@ -158,7 +158,7 @@ bool Registry::Open(const char *toplevel,
{
kwsys_ios::cerr << "Toplevel has to start with letter or number and end"
" with one" << kwsys_ios::endl;
- return 0;
+ return res;
}
res = this->Helper->Open(toplevel, subkey, readonly);
@@ -203,14 +203,14 @@ bool Registry::ReadValue(const char *subkey,
bool open = false;
if ( ! value )
{
- return false;
+ return res;
}
if ( !m_Opened )
{
if ( !this->Open(this->GetTopLevel(), subkey,
Registry::READONLY) )
{
- return false;
+ return res;
}
open = true;
}
@@ -236,7 +236,7 @@ bool Registry::DeleteKey(const char *subkey, const char *key)
if ( !this->Open(this->GetTopLevel(), subkey,
Registry::READWRITE) )
{
- return false;
+ return res;
}
open = true;
}
@@ -267,7 +267,7 @@ bool Registry::DeleteValue(const char *subkey, const char *key)
if ( !this->Open(this->GetTopLevel(), subkey,
Registry::READWRITE) )
{
- return false;
+ return res;
}
open = true;
}
@@ -292,14 +292,14 @@ bool Registry::DeleteValue(const char *subkey, const char *key)
bool Registry::SetValue(const char *subkey, const char *key,
const char *value)
{
- bool res = true;
+ bool res = false;
bool open = false;
if ( !m_Opened )
{
if ( !this->Open(this->GetTopLevel(), subkey,
Registry::READWRITE) )
{
- return false;
+ return res;
}
open = true;
}
@@ -555,12 +555,11 @@ bool RegistryHelper::ReadValue(const char *skey, const char **value)
{
return false;
}
- int res = 1;
DWORD dwType, dwSize;
dwType = REG_SZ;
char buffer[1024]; // Replace with RegQueryInfoKey
dwSize = sizeof(buffer);
- res = ( RegQueryValueEx(this->HKey, skey, NULL, &dwType,
+ int res = ( RegQueryValueEx(this->HKey, skey, NULL, &dwType,
(BYTE *)buffer, &dwSize) == ERROR_SUCCESS );
if ( !res )
{
@@ -600,8 +599,7 @@ bool RegistryHelper::DeleteKey(const char* skey)
#ifdef _WIN32
if ( m_RegistryType == Registry::WIN32_REGISTRY)
{
- int res = 1;
- res = ( RegDeleteKey( this->HKey, skey ) == ERROR_SUCCESS );
+ int res = ( RegDeleteKey( this->HKey, skey ) == ERROR_SUCCESS );
return (res != 0);
}
#endif
@@ -624,8 +622,7 @@ bool RegistryHelper::DeleteValue(const char *skey)
#ifdef _WIN32
if ( m_RegistryType == Registry::WIN32_REGISTRY)
{
- int res = 1;
- res = ( RegDeleteValue( this->HKey, skey ) == ERROR_SUCCESS );
+ int res = ( RegDeleteValue( this->HKey, skey ) == ERROR_SUCCESS );
return (res != 0);
}
#endif
@@ -648,9 +645,8 @@ bool RegistryHelper::SetValue(const char *skey, const char *value)
#ifdef _WIN32
if ( m_RegistryType == Registry::WIN32_REGISTRY)
{
- int res = 1;
DWORD len = (DWORD)(value ? strlen(value) : 0);
- res = ( RegSetValueEx(this->HKey, skey, 0, REG_SZ,
+ int res = ( RegSetValueEx(this->HKey, skey, 0, REG_SZ,
(CONST BYTE *)(const char *)value,
len+1) == ERROR_SUCCESS );
return (res != 0);