Skip to content

Commit

Permalink
Use std::string_view as part of Exception_Data
Browse files Browse the repository at this point in the history
    * TAO/tao/Exception_Data.h:
    * TAO/tao/Messaging/ExceptionHolder_i.cpp:
    * TAO/tao/operation_details.cpp:
  • Loading branch information
jwillemsen committed Jun 17, 2024
1 parent 230473b commit dee98e4
Show file tree
Hide file tree
Showing 3 changed files with 6 additions and 5 deletions.
3 changes: 2 additions & 1 deletion TAO/tao/Exception_Data.h
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,7 @@
#endif /* ACE_LACKS_PRAGMA_ONCE */

#include "tao/orbconf.h"
#include <string_view>

TAO_BEGIN_VERSIONED_NAMESPACE_DECL

Expand Down Expand Up @@ -50,7 +51,7 @@ namespace TAO
struct Exception_Data
{
/// Repository id of the exception.
const char *id;
std::string_view id;

/// The allocator for this exception.
TAO_Exception_Alloc alloc;
Expand Down
4 changes: 2 additions & 2 deletions TAO/tao/Messaging/ExceptionHolder_i.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -100,12 +100,12 @@ namespace TAO
// This is important to decode the exception.
for (CORBA::ULong i = 0; i != this->count_; ++i)
{
if (ACE_OS::strcmp (type_id.in (), this->data_[i].id) != 0)
if (this->data_[i].id.compare(type_id.in ()) != 0)
continue;

CORBA::Exception * const exception = this->data_[i].alloc ();

if (exception == 0)
if (!exception)
{
throw ::CORBA::NO_MEMORY (TAO::VMCID, CORBA::COMPLETED_YES);
}
Expand Down
4 changes: 2 additions & 2 deletions TAO/tao/operation_details.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@ TAO_Operation_Details::corba_exception (const char *id) const
{
for (CORBA::ULong i = 0; i != this->ex_count_; ++i)
{
if (ACE_OS::strcmp (id, this->ex_data_[i].id) != 0)
if (this->ex_data_[i].id.compare (id) != 0)
{
continue;
}
Expand All @@ -46,7 +46,7 @@ TAO_Operation_Details::has_exception (::CORBA::Exception& ex) const
{
for (CORBA::ULong i = 0; i != this->ex_count_; ++i)
{
if (ACE_OS::strcmp (ex._rep_id (), this->ex_data_[i].id) == 0)
if (this->ex_data_[i].id.compare(ex._rep_id ()) == 0)
{
return true;
}
Expand Down

0 comments on commit dee98e4

Please sign in to comment.