summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorschmidt <douglascraigschmidt@users.noreply.github.com>2002-06-12 01:35:53 +0000
committerschmidt <douglascraigschmidt@users.noreply.github.com>2002-06-12 01:35:53 +0000
commit5c488f9e7624044f360946c74b2c7fd2d48bb8fb (patch)
treeca6176a8237bca8c9455c527779a3d0ddab03be6
parentbd6ec1fbf2b33c10540649957862a0a1e3a06dcd (diff)
downloadATCD-5c488f9e7624044f360946c74b2c7fd2d48bb8fb.tar.gz
ChangeLogTag:Tue Jun 11 19:05:39 2002 Douglas C. Schmidt <schmidt@macarena.cs.wustl.edu>
-rw-r--r--ChangeLog14
-rw-r--r--ChangeLogs/ChangeLog-02a14
-rw-r--r--ChangeLogs/ChangeLog-03a14
-rw-r--r--ace/Configuration.cpp70
-rw-r--r--ace/Configuration.h10
-rw-r--r--ace/SOCK_Dgram_Mcast.h4
-rw-r--r--tests/Config_Test.cpp129
7 files changed, 173 insertions, 82 deletions
diff --git a/ChangeLog b/ChangeLog
index 42b23d686bc..a764db825d5 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,17 @@
+Tue Jun 11 19:05:39 2002 Douglas C. Schmidt <schmidt@macarena.cs.wustl.edu>
+
+ * ace/SOCK_Dgram_Mcast.h: Added a default constructor for
+ ACE_SOCK_Dgram_Mcast.
+
+ * tests/Config_Test.cpp (test): Added tests for the following capability.
+ Thanks to Eugene Alterman <eugalt@myrealbox.com> for
+ contributing these tests.
+
+ * ace/Configuration.{h,cpp}: Added support for a new open_simple_section()
+ method that does not allow path key separators. Thanks to
+ Eugene Alterman <eugalt@myrealbox.com> for contributing this
+ patch.
+
Tue Jun 11 20:02:39 2002 Steve Huston <shuston@riverace.com>
* ace/DLL_Manager.cpp (ACE_DLL_Handle::error()): Change to a
diff --git a/ChangeLogs/ChangeLog-02a b/ChangeLogs/ChangeLog-02a
index 42b23d686bc..a764db825d5 100644
--- a/ChangeLogs/ChangeLog-02a
+++ b/ChangeLogs/ChangeLog-02a
@@ -1,3 +1,17 @@
+Tue Jun 11 19:05:39 2002 Douglas C. Schmidt <schmidt@macarena.cs.wustl.edu>
+
+ * ace/SOCK_Dgram_Mcast.h: Added a default constructor for
+ ACE_SOCK_Dgram_Mcast.
+
+ * tests/Config_Test.cpp (test): Added tests for the following capability.
+ Thanks to Eugene Alterman <eugalt@myrealbox.com> for
+ contributing these tests.
+
+ * ace/Configuration.{h,cpp}: Added support for a new open_simple_section()
+ method that does not allow path key separators. Thanks to
+ Eugene Alterman <eugalt@myrealbox.com> for contributing this
+ patch.
+
Tue Jun 11 20:02:39 2002 Steve Huston <shuston@riverace.com>
* ace/DLL_Manager.cpp (ACE_DLL_Handle::error()): Change to a
diff --git a/ChangeLogs/ChangeLog-03a b/ChangeLogs/ChangeLog-03a
index 42b23d686bc..a764db825d5 100644
--- a/ChangeLogs/ChangeLog-03a
+++ b/ChangeLogs/ChangeLog-03a
@@ -1,3 +1,17 @@
+Tue Jun 11 19:05:39 2002 Douglas C. Schmidt <schmidt@macarena.cs.wustl.edu>
+
+ * ace/SOCK_Dgram_Mcast.h: Added a default constructor for
+ ACE_SOCK_Dgram_Mcast.
+
+ * tests/Config_Test.cpp (test): Added tests for the following capability.
+ Thanks to Eugene Alterman <eugalt@myrealbox.com> for
+ contributing these tests.
+
+ * ace/Configuration.{h,cpp}: Added support for a new open_simple_section()
+ method that does not allow path key separators. Thanks to
+ Eugene Alterman <eugalt@myrealbox.com> for contributing this
+ patch.
+
Tue Jun 11 20:02:39 2002 Steve Huston <shuston@riverace.com>
* ace/DLL_Manager.cpp (ACE_DLL_Handle::error()): Change to a
diff --git a/ace/Configuration.cpp b/ace/Configuration.cpp
index 44833c2e1d1..faf9c1d2fed 100644
--- a/ace/Configuration.cpp
+++ b/ace/Configuration.cpp
@@ -216,7 +216,7 @@ ACE_Configuration::validate_name (const ACE_TCHAR* name, int allow_path)
{
// Invalid character set
const ACE_TCHAR* reject =
- allow_path ? ACE_LIB_TEXT("][") : ACE_LIB_TEXT("\\][");
+ allow_path ? ACE_LIB_TEXT ("][") : ACE_LIB_TEXT ("\\][");
// Position of the first invalid character or terminating null.
size_t pos = ACE_OS_String::strcspn (name, reject);
@@ -383,7 +383,7 @@ int ACE_Configuration::operator== (const ACE_Configuration& rhs) const
unsigned char* rhsCharData = (unsigned char*)rhsData;
// yes, then check each element
for (u_int count = 0;
- (rc) && (count < thisLength);
+ (rc) && (count < thisLength);
count++)
{
rc = (* (thisCharData + count) == * (rhsCharData + count));
@@ -409,7 +409,7 @@ int ACE_Configuration::operator== (const ACE_Configuration& rhs) const
// look in the rhs for values not in this
valueIndex = 0;
while ((rc) &&
- (!nonconst_rhs.enumerate_values (rhsSection,
+ (!nonconst_rhs.enumerate_values (rhsSection,
valueIndex,
valueName,
rhsType)))
@@ -490,7 +490,7 @@ ACE_Configuration_Win32Registry::operator== (const ACE_Configuration_Win32Regist
}
int
-ACE_Configuration_Win32Registry::operator!=(const ACE_Configuration_Win32Registry &rhs) const
+ACE_Configuration_Win32Registry::operator!= (const ACE_Configuration_Win32Registry &rhs) const
{
ACE_UNUSED_ARG (rhs);
return 1;
@@ -542,7 +542,7 @@ ACE_Configuration_Win32Registry::open_section (const ACE_Configuration_Section_K
0,
&result_key,
#if defined (__MINGW32__)
- (PDWORD) 0
+ (PDWORD) 0
#else
0
#endif /* __MINGW32__ */
@@ -725,8 +725,8 @@ ACE_Configuration_Win32Registry::set_string_value (const ACE_Configuration_Secti
name,
0,
REG_SZ,
- (BYTE *) value.fast_rep (),
- (value.length () + 1) * sizeof (ACE_TCHAR)) != ERROR_SUCCESS)
+ (BYTE *) value.fast_rep (),
+ (value.length () + 1) * sizeof (ACE_TCHAR)) != ERROR_SUCCESS)
return -2;
return 0;
@@ -748,7 +748,7 @@ ACE_Configuration_Win32Registry::set_integer_value (const ACE_Configuration_Sect
name,
0,
REG_DWORD,
- (BYTE *) &value,
+ (BYTE *) &value,
sizeof (value)) != ERROR_SUCCESS)
return -2;
@@ -772,7 +772,7 @@ ACE_Configuration_Win32Registry::set_binary_value (const ACE_Configuration_Secti
name,
0,
REG_BINARY,
- (BYTE *) data,
+ (BYTE *) data,
length) != ERROR_SUCCESS)
return -2;
@@ -798,7 +798,7 @@ ACE_Configuration_Win32Registry::get_string_value (const ACE_Configuration_Secti
name,
0,
&type,
- (BYTE *) 0,
+ (BYTE *) 0,
&buffer_length) != ERROR_SUCCESS)
return -2;
@@ -816,7 +816,7 @@ ACE_Configuration_Win32Registry::get_string_value (const ACE_Configuration_Secti
name,
0,
&type,
- (BYTE *) buffer.get (),
+ (BYTE *) buffer.get (),
&buffer_length) != ERROR_SUCCESS)
{
return -5;
@@ -844,7 +844,7 @@ ACE_Configuration_Win32Registry::get_integer_value (const ACE_Configuration_Sect
name,
0,
&type,
- (BYTE *) &value,
+ (BYTE *) &value,
&length) != ERROR_SUCCESS)
return -2;
@@ -874,7 +874,7 @@ ACE_Configuration_Win32Registry::get_binary_value (const ACE_Configuration_Secti
name,
0,
&type,
- (BYTE *) 0,
+ (BYTE *) 0,
&buffer_length) != ERROR_SUCCESS)
return -2;
@@ -889,7 +889,7 @@ ACE_Configuration_Win32Registry::get_binary_value (const ACE_Configuration_Secti
name,
0,
&type,
- (BYTE *) data,
+ (BYTE *) data,
&buffer_length) != ERROR_SUCCESS)
{
delete [] (BYTE *) data;
@@ -1026,7 +1026,7 @@ ACE_Configuration_Win32Registry::resolve_key (HKEY hKey,
0,
&subkey,
#if defined (__MINGW32__)
- (PDWORD) 0
+ (PDWORD) 0
#else
0
#endif /* __MINGW32__ */
@@ -1457,7 +1457,7 @@ ACE_Configuration_Heap::new_section (const ACE_TString& section,
ACE_Configuration_ExtId name (ptr);
ACE_Configuration_Section_IntId entry ((VALUE_MAP*) value_hash_map ,
- (SUBSECTION_MAP*) section_hash_map);
+ (SUBSECTION_MAP*) section_hash_map);
// Do a normal bind. This will fail if there's already an
// entry with the same name.
@@ -1514,9 +1514,31 @@ ACE_Configuration_Heap::open_section (const ACE_Configuration_Section_Key& base,
ACE_Configuration_Section_Key& result)
{
ACE_ASSERT (this->allocator_);
- if (validate_name (sub_section))
+ if (validate_name (sub_section, true))
return -1;
+ const ACE_TCHAR* separator;
+ result = base;
+
+ while (separator = ACE_OS_String::strchr (sub_section, ACE_TEXT ('\\')))
+ {
+ ACE_TString simple_section (sub_section, separator - sub_section);
+ int ret_val =
+ open_simple_section (result, simple_section.c_str (), create, result);
+ if (ret_val)
+ return ret_val;
+ sub_section = separator + 1;
+ }
+
+ return open_simple_section (result, sub_section, create, result);
+}
+
+int
+ACE_Configuration_Heap::open_simple_section (const ACE_Configuration_Section_Key& base,
+ const ACE_TCHAR* sub_section,
+ int create,
+ ACE_Configuration_Section_Key& result)
+{
ACE_TString section;
if (load_key (base, section))
return -1;
@@ -1759,7 +1781,7 @@ ACE_Configuration_Heap::set_string_value (const ACE_Configuration_Section_Key& k
entry->int_id_.free (allocator_);
// Allocate the new value in this heap
ACE_TCHAR* pers_value =
- (ACE_TCHAR *) allocator_->malloc ((value.length () + 1) * sizeof (ACE_TCHAR));
+ (ACE_TCHAR *) allocator_->malloc ((value.length () + 1) * sizeof (ACE_TCHAR));
ACE_OS::strcpy (pers_value, value.fast_rep ());
ACE_Configuration_Value_IntId new_value_int (pers_value);
entry->int_id_ = new_value_int;
@@ -1768,10 +1790,10 @@ ACE_Configuration_Heap::set_string_value (const ACE_Configuration_Section_Key& k
{
// it doesn't exist, bind it
ACE_TCHAR* pers_name =
- (ACE_TCHAR *) allocator_->malloc ((ACE_OS::strlen (name) + 1) * sizeof (ACE_TCHAR));
+ (ACE_TCHAR *) allocator_->malloc ((ACE_OS::strlen (name) + 1) * sizeof (ACE_TCHAR));
ACE_OS::strcpy (pers_name, name);
ACE_TCHAR* pers_value =
- (ACE_TCHAR *) allocator_->malloc ((value.length () + 1) * sizeof (ACE_TCHAR));
+ (ACE_TCHAR *) allocator_->malloc ((value.length () + 1) * sizeof (ACE_TCHAR));
ACE_OS::strcpy (pers_value, value.fast_rep ());
ACE_Configuration_ExtId item_name (pers_name);
ACE_Configuration_Value_IntId item_value (pers_value);
@@ -1820,7 +1842,7 @@ ACE_Configuration_Heap::set_integer_value (const ACE_Configuration_Section_Key&
{
// it doesn't exist, bind it
ACE_TCHAR* pers_name =
- (ACE_TCHAR *) allocator_->malloc ((ACE_OS::strlen (name) + 1) * sizeof (ACE_TCHAR));
+ (ACE_TCHAR *) allocator_->malloc ((ACE_OS::strlen (name) + 1) * sizeof (ACE_TCHAR));
ACE_OS::strcpy (pers_name, name);
ACE_Configuration_ExtId item_name (pers_name);
ACE_Configuration_Value_IntId item_value (value);
@@ -1874,7 +1896,7 @@ ACE_Configuration_Heap::set_binary_value (const ACE_Configuration_Section_Key& k
{
// it doesn't exist, bind it
ACE_TCHAR* pers_name =
- (ACE_TCHAR *) allocator_->malloc ((ACE_OS::strlen (name) + 1) * sizeof (ACE_TCHAR));
+ (ACE_TCHAR *) allocator_->malloc ((ACE_OS::strlen (name) + 1) * sizeof (ACE_TCHAR));
ACE_OS::strcpy (pers_name, name);
ACE_TCHAR* pers_value = (ACE_TCHAR *) allocator_->malloc (length);
ACE_OS::memcpy (pers_value, data, length);
@@ -1903,10 +1925,10 @@ ACE_Configuration_Heap::set_binary_value (const ACE_Configuration_Section_Key& k
{
// it doesn't exist, bind it
ACE_TCHAR* pers_name =
- (ACE_TCHAR *) allocator_->malloc ((ACE_OS::strlen (name) + 1) * sizeof (ACE_TCHAR));
+ (ACE_TCHAR *) allocator_->malloc ((ACE_OS::strlen (name) + 1) * sizeof (ACE_TCHAR));
ACE_OS::strcpy (pers_name, name);
ACE_TCHAR* pers_value =
- (ACE_TCHAR *) allocator_->malloc (length);
+ (ACE_TCHAR *) allocator_->malloc (length);
ACE_OS::memcpy (pers_value, data, length);
ACE_Configuration_ExtId VExtId (pers_name);
ACE_Configuration_Value_IntId VIntId (pers_value, length);
diff --git a/ace/Configuration.h b/ace/Configuration.h
index 42e8f4d6950..ce8fe03a74d 100644
--- a/ace/Configuration.h
+++ b/ace/Configuration.h
@@ -726,10 +726,14 @@ public:
const ACE_TCHAR* name);
private:
+ /// <sub_section> may not contain path separators
+ int open_simple_section (const ACE_Configuration_Section_Key &base,
+ const ACE_TCHAR *sub_section,
+ int create, ACE_Configuration_Section_Key &result);
/// Adds a new section
- int add_section (const ACE_Configuration_Section_Key& base,
- const ACE_TCHAR* sub_section,
- ACE_Configuration_Section_Key& result);
+ int add_section (const ACE_Configuration_Section_Key &base,
+ const ACE_TCHAR *sub_section,
+ ACE_Configuration_Section_Key &result);
/// Helper for the <open> method.
int create_index (void);
diff --git a/ace/SOCK_Dgram_Mcast.h b/ace/SOCK_Dgram_Mcast.h
index 98714147289..10f69ca9b89 100644
--- a/ace/SOCK_Dgram_Mcast.h
+++ b/ace/SOCK_Dgram_Mcast.h
@@ -13,7 +13,6 @@
*/
//=============================================================================
-
#ifndef ACE_SOCK_DGRAM_MCAST_H
#define ACE_SOCK_DGRAM_MCAST_H
#include "ace/pre.h"
@@ -38,7 +37,8 @@
class ACE_Export ACE_SOCK_Dgram_Mcast :
public ACE_SOCK_Dgram_Mcast_Ex <ACE_SDM_DEFOPT_LOCK>
{
-
+public:
+ ACE_SOCK_Dgram_Mcast (void) {}
};
#include "ace/post.h"
diff --git a/tests/Config_Test.cpp b/tests/Config_Test.cpp
index f9979b01d6f..9e0c6dd2436 100644
--- a/tests/Config_Test.cpp
+++ b/tests/Config_Test.cpp
@@ -25,56 +25,18 @@
ACE_RCSID(tests, Config_Test, "$Id$")
-static int
-test_subkey_path (void)
-{
- ACE_Configuration_Win32Registry config (HKEY_LOCAL_MACHINE);
-
- ACE_Configuration_Section_Key root = config.root_section ();
-
- ACE_Configuration_Section_Key testsection;
-
- if (config.open_section (root,
- ACE_TEXT ("Software\\ACE\\test"),
- 1,
- testsection))
- return -26;
-
- if (config.open_section (root,
- ACE_TEXT ("Software"),
- 0,
- testsection))
- return -27;
-
- if (config.remove_section (testsection,
- ACE_TEXT ("ACE"),
- 1))
- return -28;
-
- return 0;
-}
-
static int
-test (ACE_Configuration *config)
+test (ACE_Configuration *config,
+ ACE_Configuration_Section_Key &testsection)
{
ACE_TString stvalue;
-
- ACE_Configuration_Section_Key root =
+ const ACE_Configuration_Section_Key &root =
config->root_section ();
- // Add a section.
- ACE_Configuration_Section_Key testsection;
-
- if (config->open_section (root,
- ACE_TEXT ("test"),
- 1,
- testsection))
- return -2;
-
// Set some values.
- else if (config->set_string_value (testsection,
- ACE_TEXT ("stvalue"),
- ACE_TEXT ("stvaluetest")))
+ if (config->set_string_value (testsection,
+ ACE_TEXT ("stvalue"),
+ ACE_TEXT ("stvaluetest")))
return -3;
else if (config->remove_value (testsection,
@@ -265,6 +227,27 @@ test (ACE_Configuration *config)
0))
return -21;
+ return 0;
+}
+
+static int
+test (ACE_Configuration *config)
+{
+ const ACE_Configuration_Section_Key& root =
+ config->root_section ();
+
+ ACE_Configuration_Section_Key testsection;
+
+ if (config->open_section (root,
+ ACE_TEXT ("test"),
+ 1,
+ testsection))
+ return -2;
+
+ int ret_val = test (config, testsection);
+ if (ret_val)
+ return ret_val;
+
// Try to remove the testsection root, it should fail since it still
// has subkeys
if (!config->remove_section (root,
@@ -298,23 +281,55 @@ test (ACE_Configuration *config)
}
static int
+test_subkey_path (ACE_Configuration* config)
+{
+ ACE_Configuration_Section_Key root =
+ config->root_section ();
+
+ ACE_Configuration_Section_Key testsection;
+
+ if (config->open_section (root,
+ ACE_TEXT ("Software\\ACE\\test"),
+ 1,
+ testsection))
+ return -26;
+
+ int ret_val = test (config, testsection);
+ if (ret_val)
+ return ret_val;
+
+ if (config->open_section (root,
+ ACE_TEXT ("Software"),
+ 0,
+ testsection))
+ return -27;
+
+ if (config->remove_section (testsection,
+ ACE_TEXT ("ACE"),
+ 1))
+ return -28;
+
+ return 0;
+}
+
+static int
run_tests (void)
{
#if defined (ACE_WIN32)
{
- int result = test_subkey_path ();
+ ACE_Configuration_Win32Registry RegConfig (HKEY_LOCAL_MACHINE);
+ int result = test_subkey_path (&RegConfig);
if (result)
ACE_ERROR_RETURN ((LM_ERROR,
"Win32 registry test failed (%d)\n", result),
-1);
}
-
- // Test win32 registry implementation.
+ // test win32 registry implementation.
HKEY root =
ACE_Configuration_Win32Registry::resolve_key (HKEY_LOCAL_MACHINE,
ACE_TEXT ("Software\\ACE\\test"));
if (!root)
- ACE_ERROR_RETURN((LM_ERROR,
+ ACE_ERROR_RETURN ((LM_ERROR,
"resolve_key is broken\n"),-2);
// test resolving of forward slashes
@@ -322,7 +337,7 @@ run_tests (void)
ACE_Configuration_Win32Registry::resolve_key (HKEY_LOCAL_MACHINE,
ACE_TEXT ("Software/ACE/test"), 0);
if (!root_fs)
- ACE_ERROR_RETURN((LM_ERROR,
+ ACE_ERROR_RETURN ((LM_ERROR,
"resolve_key is broken\n"),-2);
ACE_Configuration_Win32Registry RegConfig (root);
@@ -342,6 +357,14 @@ run_tests (void)
if (heap_config.open ())
return 0;
{
+ int result = test_subkey_path (&heap_config);
+ if (result)
+ ACE_ERROR_RETURN ((LM_ERROR,
+ "Heap Configuration test failed (%d)\n", result),
+ -1);
+ }
+
+ {
int result = test (&heap_config);
if (result)
ACE_ERROR_RETURN ((LM_ERROR,
@@ -653,7 +676,7 @@ iniCompare (ACE_Configuration_Heap& fromFile, ACE_Configuration_Heap& original)
// loop through each section in the fromFile object
while ((rc) &&
- (!fromFile.enumerate_sections (fromFileRoot,
+ (!fromFile.enumerate_sections (fromFileRoot,
sectionIndex,
sectionName)) )
{
@@ -680,7 +703,7 @@ iniCompare (ACE_Configuration_Heap& fromFile, ACE_Configuration_Heap& original)
// Enumerate each value in the fromFile section
while ((rc) &&
- (!fromFile.enumerate_values (fromFileSection,
+ (!fromFile.enumerate_values (fromFileSection,
valueIndex,
valueName,
valueType)))
@@ -783,7 +806,7 @@ iniCompare (ACE_Configuration_Heap& fromFile, ACE_Configuration_Heap& original)
// for values in the original section
valueIndex = 0;
while ((rc) &&
- (!original.enumerate_values (originalSection,
+ (!original.enumerate_values (originalSection,
valueIndex,
valueName,
originalType)))
@@ -807,7 +830,7 @@ iniCompare (ACE_Configuration_Heap& fromFile, ACE_Configuration_Heap& original)
// Finally, if the original has any sections, then we're not equal
sectionIndex = 0;
while ((rc) &&
- (!original.enumerate_sections (originalRoot,
+ (!original.enumerate_sections (originalRoot,
sectionIndex,
sectionName)))
sectionIndex++;