Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
38 changes: 19 additions & 19 deletions ACE/ace/Configuration.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -408,7 +408,7 @@ static constexpr int ACE_DEFAULT_BUFSIZE = 256;
static const ACE_TCHAR *temp_name (const ACE_TCHAR *name)
{
if (name && *name == ACE_Configuration::NULL_String_)
return 0;
return nullptr;
return name;
}

Expand Down Expand Up @@ -441,7 +441,7 @@ ACE_Configuration_Win32Registry::operator!= (const ACE_Configuration_Win32Regist
ACE_Configuration_Win32Registry::ACE_Configuration_Win32Registry (HKEY hKey, u_long security_access)
: security_access_ (security_access)
{
ACE_Section_Key_Win32 *temp = 0;
ACE_Section_Key_Win32* temp {};

ACE_NEW (temp, ACE_Section_Key_Win32 (hKey));

Expand Down Expand Up @@ -492,7 +492,7 @@ ACE_Configuration_Win32Registry::open_section (const ACE_Configuration_Section_K
}
}

ACE_Section_Key_Win32 *temp;
ACE_Section_Key_Win32* temp {};

ACE_NEW_RETURN (temp, ACE_Section_Key_Win32 (result_key), -1);
result = ACE_Configuration_Section_Key (temp);
Expand Down Expand Up @@ -565,14 +565,14 @@ ACE_Configuration_Win32Registry::enumerate_values (const ACE_Configuration_Secti
DWORD buffer_size = ACE_DEFAULT_BUFSIZE;
DWORD value_type;

int rc = ACE_TEXT_RegEnumValue (base_key,
index,
name_buffer,
&buffer_size,
0,
&value_type,
0,
0);
int const rc = ACE_TEXT_RegEnumValue (base_key,
index,
name_buffer,
&buffer_size,
0,
&value_type,
0,
0);
if (rc == ERROR_NO_MORE_ITEMS)
return 1;
else if (rc != ERROR_SUCCESS)
Expand Down Expand Up @@ -756,7 +756,7 @@ ACE_Configuration_Win32Registry::get_string_value (const ACE_Configuration_Secti
return -1;
}

ACE_TCHAR *temp = 0;
ACE_TCHAR* temp {};
ACE_NEW_RETURN (temp,
ACE_TCHAR[buffer_length],
-1);
Expand Down Expand Up @@ -852,7 +852,7 @@ ACE_Configuration_Win32Registry::get_binary_value (

length = buffer_length;

BYTE * the_data = 0;
BYTE* the_data {};
ACE_NEW_RETURN (the_data, BYTE[length], -1);
std::unique_ptr<BYTE[]> safe_data (the_data);

Expand All @@ -863,7 +863,7 @@ ACE_Configuration_Win32Registry::get_binary_value (
the_data,
&buffer_length)) != ERROR_SUCCESS)
{
data = 0;
data = nullptr;
errno = errnum;
return -1;
}
Expand Down Expand Up @@ -969,7 +969,7 @@ ACE_Configuration_Win32Registry::resolve_key (HKEY hKey,
}

// recurse through the path
ACE_TCHAR *temp_path = 0;
ACE_TCHAR* temp_path {};
ACE_NEW_RETURN (temp_path,
ACE_TCHAR[ACE_OS::strlen (path) + 1],
0);
Expand Down Expand Up @@ -1024,7 +1024,7 @@ ACE_Configuration_Value_IntId::ACE_Configuration_Value_IntId ()
: type_ (ACE_Configuration::INVALID),
length_ (0)
{
this->data_.ptr_ = 0;
this->data_.ptr_ = nullptr;
}

ACE_Configuration_Value_IntId::ACE_Configuration_Value_IntId (ACE_TCHAR* string)
Expand Down Expand Up @@ -1201,7 +1201,7 @@ ACE_Configuration_Heap::~ACE_Configuration_Heap ()
int
ACE_Configuration_Heap::open (size_t default_map_size)
{
if (this->allocator_ != 0)
if (this->allocator_)
{
errno = EBUSY;
return -1;
Expand All @@ -1223,7 +1223,7 @@ ACE_Configuration_Heap::open (const ACE_TCHAR* file_name,
void* base_address,
size_t default_map_size)
{
if (this->allocator_ != 0)
if (this->allocator_)
{
errno = EBUSY;
return -1;
Expand Down Expand Up @@ -1262,7 +1262,7 @@ ACE_Configuration_Heap::open (const ACE_TCHAR* file_name,
int
ACE_Configuration_Heap::create_index ()
{
void *section_index = nullptr;
void* section_index {};

// This is the easy case since if we find hash table in the
// memory-mapped file we know it's already initialized.
Expand Down
45 changes: 20 additions & 25 deletions ACE/tests/Config_Test.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,6 @@
*/
//=============================================================================


#include "test_config.h"
#include "Config_Test.h"
#include "ace/Configuration_Import_Export.h"
Expand Down Expand Up @@ -95,10 +94,10 @@ test (ACE_Configuration *config,
else if (intvalue != 42)
return -9;

u_char *data_out (0);
u_char* data_out {};

{
void *data_tmp = 0; // Workaround for GCC strict aliasing warning.
void* data_tmp {}; // Workaround for GCC strict aliasing warning.
size_t length = 0;

if (config->get_binary_value (testsection,
Expand Down Expand Up @@ -244,8 +243,7 @@ test (ACE_Configuration *config,
static int
test (ACE_Configuration *config)
{
const ACE_Configuration_Section_Key& root =
config->root_section ();
const ACE_Configuration_Section_Key& root = config->root_section ();

{
// Scope this so the testsection key is closed before trying to
Expand All @@ -258,7 +256,7 @@ test (ACE_Configuration *config)
testsection))
return -2;

int ret_val = test (config, testsection);
int const ret_val = test (config, testsection);
if (ret_val)
return ret_val;
}
Expand Down Expand Up @@ -302,18 +300,17 @@ test (ACE_Configuration *config)
static int
test_subkey_path (ACE_Configuration* config)
{
ACE_Configuration_Section_Key root =
config->root_section ();
ACE_Configuration_Section_Key root = config->root_section ();

ACE_Configuration_Section_Key testsection;

if (config->open_section (root,
ACE_TEXT ("Software\\ACE\\test"),
ACE_TEXT ("Software\\ACETEST\\test"),
1,
testsection))
return -26;

int ret_val = test (config, testsection);
int const ret_val = test (config, testsection);
if (ret_val)
return ret_val;

Expand All @@ -324,7 +321,7 @@ test_subkey_path (ACE_Configuration* config)
return -27;

if (config->remove_section (testsection,
ACE_TEXT ("ACE"),
ACE_TEXT ("ACETEST"),
1))
return -28;

Expand Down Expand Up @@ -525,34 +522,32 @@ run_tests ()

#if defined (ACE_WIN32) && !defined (ACE_LACKS_WIN32_REGISTRY)
{
ACE_Configuration_Win32Registry RegConfig (HKEY_LOCAL_MACHINE);
int result = test_subkey_path (&RegConfig);
ACE_Configuration_Win32Registry RegConfig (HKEY_CURRENT_USER);
int const result = test_subkey_path (std::addressof (RegConfig));
if (result)
ACE_ERROR_RETURN ((LM_ERROR,
ACE_TEXT ("Win32Registry test HKEY_LOCAL_MACHINE")
ACE_TEXT ("Win32Registry test HKEY_CURRENT_USER")
ACE_TEXT (" failed (%d)\n"), result),
-1);
}
// test win32 registry implementation.
HKEY root =
ACE_Configuration_Win32Registry::resolve_key (HKEY_LOCAL_MACHINE,
ACE_TEXT ("Software\\ACE\\test"));
HKEY const root = ACE_Configuration_Win32Registry::resolve_key (HKEY_CURRENT_USER,
ACE_TEXT ("Software\\ACETEST\\test"));
if (!root)
ACE_ERROR_RETURN ((LM_ERROR,
ACE_TEXT ("resolve_key is broken\n")), -2);

// test resolving of forward slashes
HKEY root_fs =
ACE_Configuration_Win32Registry::resolve_key (HKEY_LOCAL_MACHINE,
ACE_TEXT ("Software/ACE/test"), 0);
HKEY const root_fs = ACE_Configuration_Win32Registry::resolve_key (HKEY_CURRENT_USER,
ACE_TEXT ("Software/ACETEST/test"), 0);
if (!root_fs)
ACE_ERROR_RETURN ((LM_ERROR,
ACE_TEXT ("resolve_key resolving slashes is broken\n")),
-2);

ACE_Configuration_Win32Registry RegConfig (root);
{
int const result = test (&RegConfig);
int const result = test (std::addressof (RegConfig));
if (result)
ACE_ERROR_RETURN ((LM_ERROR,
ACE_TEXT ("Win32 registry test root failed (%d)\n"),
Expand Down Expand Up @@ -585,7 +580,7 @@ run_tests ()
-1);
}
{
int result = test_subkey_path (&heap_config);
int const result = test_subkey_path (std::addressof(heap_config));
if (result)
ACE_ERROR_RETURN ((LM_ERROR,
ACE_TEXT ("Heap Config subkey test failed (%d)\n"),
Expand All @@ -594,7 +589,7 @@ run_tests ()
}

{
int result = test (&heap_config);
int const result = test (std::addressof(heap_config));
if (result)
ACE_ERROR_RETURN ((LM_ERROR,
ACE_TEXT ("Heap Configuration test failed (%d)\n"),
Expand Down Expand Up @@ -642,7 +637,7 @@ run_tests ()
}

{
int result = test (&pers_config);
int const result = test (std::addressof(pers_config));
if (result)
ACE_ERROR_RETURN ((LM_ERROR,
ACE_TEXT ("Persistent Heap Config test failed (%d)\n"),
Expand Down Expand Up @@ -748,7 +743,7 @@ build_config_object (ACE_Configuration& cfg)
-16);

ACE_DEBUG ((LM_DEBUG, ACE_TEXT ("here\n")));
//return 0;

//ACE_TString string;
ACE_TString name ((ACE_TCHAR*)0);
if (cfg.get_string_value (LoggerSection,
Expand Down
Loading