Fixed warnings#2369
Conversation
Mostly type conversions, const correctness, etc.
WalkthroughThis set of changes focuses primarily on improving type safety, const-correctness, and code clarity throughout the codebase. Many updates replace C-style casts with explicit C++ casts, adjust pointer and reference constness, and introduce explicit type conversions to avoid implicit or potentially unsafe conversions. Several method signatures are updated to use more semantically meaningful types (such as replacing Changes
Sequence Diagram(s)sequenceDiagram
participant User
participant ACE_Component
participant OS_API
User->>ACE_Component: Call method (e.g., control, send, find)
ACE_Component->>ACE_Component: Perform explicit type casting and pointer arithmetic
ACE_Component->>OS_API: Invoke system call with correct argument types
OS_API-->>ACE_Component: Return result
ACE_Component-->>User: Return processed result
Suggested reviewers
Poem
Warning There were issues while running some tools. Please review the errors and either fix the tool's configuration or disable the tool if it's a critical failure. 🔧 ast-grep (0.31.1)ACE/ace/Arg_Shifter.cpp📜 Recent review detailsConfiguration used: CodeRabbit UI 📒 Files selected for processing (5)
✅ Files skipped from review due to trivial changes (1)
🚧 Files skipped from review as they are similar to previous changes (4)
⏰ Context from checks skipped due to timeout of 90000ms (20)
Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out. 🪧 TipsChatThere are 3 ways to chat with CodeRabbit:
Note: Be mindful of the bot's finite context window. It's strongly recommended to break down tasks such as reading entire modules into smaller chunks. For a focused discussion, use review comments to chat about specific files and their changes, instead of using the PR comments. CodeRabbit Commands (Invoked using PR comments)
Other keywords and placeholders
CodeRabbit Configuration File (
|
There was a problem hiding this comment.
Actionable comments posted: 7
🧹 Nitpick comments (6)
ACE/ace/config-linux-common.h (1)
221-221: Add documentation for new ioctl type macro. The macroACE_IOCTL_TYPE_ARG2defines the type of the second argument forioctlcalls on Linux, but lacks context. Consider adding a brief comment or Doxygen description above this definition to explain its purpose and usage.TAO/tao/Valuetype/ValueBase.h (1)
363-369: Replace hex flags with decimal constants; consider grouping. Switching from hexadecimal literals to their decimal equivalents improves readability. To further enhance maintainability and type safety, you might refactor these related flag constants into aconstexpr enum classwithin theTAO_OBV_GIOP_Flagsnamespace.ACE/ace/Env_Value_T.h (1)
92-92: Approve: Using const_cast improves type safety and code clarityThe replacement of the C-style cast
(ACE_TCHAR *)withconst_cast<ACE_TCHAR *>makes the intent clearer and follows modern C++ best practices. This change likely addresses compiler warnings about C-style casts while maintaining the same functionality.For consistency, consider also replacing the C-style cast on line 98 with an equivalent
const_cast, though it may not trigger warnings since it's not removing constness.ACE/ace/Refcounted_Auto_Ptr.inl (1)
92-92: Approve: Improved const-correctness with explicit const_castThe change replaces a C-style cast with an explicit
const_cast, making it clear that constness is being removed intentionally. This follows modern C++ best practices and likely addresses compiler warnings about C-style casts without changing functionality.For complete consistency, you might also want to update the similar cast on lines 171-172 in the assignment operator to use the same style (though the implementation is already using const_cast there, just with different spacing).
ACE/ace/SPIPE_Stream.inl (2)
59-59: Improved const-correctness in parameter castingThe change from
(strbuf *)to(strbuf const *)properly preserves the constness of thecntlanddataparameters when casting them for theACE_OS::putmsgcall. This prevents potential accidental modification of const data and better represents the intent of the code.Consider using C++ style casts like
reinterpret_cast<strbuf const *>instead of C-style casts for improved type safety and readability:- return ACE_OS::putmsg (this->get_handle (), (strbuf const *) cntl, (strbuf const *) data, flags); + return ACE_OS::putmsg (this->get_handle (), reinterpret_cast<strbuf const *>(cntl), + reinterpret_cast<strbuf const *>(data), flags);
73-73: Improved const-correctness in parameter castingSimilar to the previous change, this modification properly preserves const-correctness when casting the parameters for the
ACE_OS::putpmsgcall.Consider using C++ style casts like
reinterpret_cast<strbuf const *>instead of C-style casts for improved type safety and readability:- return ACE_OS::putpmsg (this->get_handle (), (strbuf const *) cntl, (strbuf const *) data, band, flags); + return ACE_OS::putpmsg (this->get_handle (), reinterpret_cast<strbuf const *>(cntl), + reinterpret_cast<strbuf const *>(data), band, flags);
📜 Review details
Configuration used: CodeRabbit UI
Review profile: CHILL
Plan: Pro
📒 Files selected for processing (59)
ACE/ace/ARGV.cpp(1 hunks)ACE/ace/Acceptor.cpp(1 hunks)ACE/ace/Arg_Shifter.cpp(6 hunks)ACE/ace/Arg_Shifter.h(5 hunks)ACE/ace/Based_Pointer_T.cpp(2 hunks)ACE/ace/Based_Pointer_T.h(1 hunks)ACE/ace/Based_Pointer_T.inl(6 hunks)ACE/ace/CDR_Stream.inl(1 hunks)ACE/ace/Dynamic_Message_Strategy.inl(2 hunks)ACE/ace/Env_Value_T.h(1 hunks)ACE/ace/Functor.inl(1 hunks)ACE/ace/High_Res_Timer.inl(1 hunks)ACE/ace/INET_Addr.inl(1 hunks)ACE/ace/IO_SAP.inl(1 hunks)ACE/ace/IPC_SAP.inl(1 hunks)ACE/ace/Log_Category.inl(1 hunks)ACE/ace/Log_Msg.inl(1 hunks)ACE/ace/Malloc_T.inl(2 hunks)ACE/ace/Message_Block.inl(3 hunks)ACE/ace/Message_Queue_T.cpp(3 hunks)ACE/ace/Netlink_Addr.inl(2 hunks)ACE/ace/Null_Condition.h(1 hunks)ACE/ace/OS_NS_dirent.inl(1 hunks)ACE/ace/OS_NS_netdb.inl(2 hunks)ACE/ace/OS_NS_stdlib.cpp(1 hunks)ACE/ace/OS_NS_stdlib.h(1 hunks)ACE/ace/OS_NS_stropts.inl(1 hunks)ACE/ace/OS_NS_sys_socket.inl(2 hunks)ACE/ace/OS_NS_time.inl(2 hunks)ACE/ace/Priority_Reactor.cpp(1 hunks)ACE/ace/Priority_Reactor.h(1 hunks)ACE/ace/Refcounted_Auto_Ptr.inl(1 hunks)ACE/ace/SOCK_Dgram.inl(1 hunks)ACE/ace/SPIPE_Stream.inl(2 hunks)ACE/ace/SString.inl(2 hunks)ACE/ace/Select_Reactor_T.cpp(4 hunks)ACE/ace/Select_Reactor_T.h(1 hunks)ACE/ace/Select_Reactor_T.inl(1 hunks)ACE/ace/Signal.inl(1 hunks)ACE/ace/Strategies_T.cpp(1 hunks)ACE/ace/String_Base.cpp(2 hunks)ACE/ace/Svc_Conf_Param.h(1 hunks)ACE/ace/Svc_Handler.cpp(1 hunks)ACE/ace/Time_Value.inl(2 hunks)ACE/ace/Timer_Heap_T.cpp(1 hunks)ACE/ace/Timer_Queue_T.cpp(1 hunks)ACE/ace/Token.inl(3 hunks)ACE/ace/XML_Utils/XMLSchema/id_map.hpp(3 hunks)ACE/ace/config-linux-common.h(1 hunks)TAO/TAO_IDL/ast/ast_interface.cpp(2 hunks)TAO/TAO_IDL/driver/drv_preproc.cpp(6 hunks)TAO/TAO_IDL/include/utl_scope_T.cpp(1 hunks)TAO/tao/MProfile.inl(1 hunks)TAO/tao/Object_Reference_Traits_T.h(1 hunks)TAO/tao/String_Traits_T.h(1 hunks)TAO/tao/Transport.inl(2 hunks)TAO/tao/Transport_Cache_Manager_T.cpp(2 hunks)TAO/tao/Unbounded_Octet_Sequence_T.h(1 hunks)TAO/tao/Valuetype/ValueBase.h(1 hunks)
🧰 Additional context used
🧬 Code Graph Analysis (5)
TAO/tao/Object_Reference_Traits_T.h (1)
TAO/tao/String_Traits_T.h (6)
begin(29-33)begin(29-30)begin(35-39)begin(35-36)begin(57-61)begin(57-58)
ACE/ace/Based_Pointer_T.cpp (1)
ACE/ace/Based_Pointer_T.h (2)
based(134-134)based(135-135)
ACE/ace/Acceptor.cpp (1)
TAO/tests/Bug_2234_Regression/server.cpp (1)
const_cast(543-546)
ACE/ace/Arg_Shifter.h (1)
ACE/ace/Arg_Shifter.cpp (9)
CHAR_TYPE(15-18)get_the_parameter(101-127)get_the_parameter(102-102)cur_arg_strncasecmp(130-147)cur_arg_strncasecmp(131-131)ACE_Arg_Shifter_T(31-43)ACE_Arg_Shifter_T(77-86)temp_(21-21)argv_(22-22)
TAO/tao/String_Traits_T.h (1)
TAO/tao/Object_Reference_Traits_T.h (6)
begin(31-35)begin(31-32)begin(37-41)begin(37-38)begin(59-63)begin(59-60)
⏰ Context from checks skipped due to timeout of 90000ms (21)
- GitHub Check: alpine-3.18
- GitHub Check: Codacy Static Code Analysis
- GitHub Check: VS2022Release64
- GitHub Check: ubuntu-22.04 g++-9
- GitHub Check: ubuntu-24.04 clang++-16
- GitHub Check: ubuntu-24.04 g++-12
- GitHub Check: ubuntu-24.04 g++-11
- GitHub Check: VS2022WChar
- GitHub Check: VS2019Release32
- GitHub Check: VS2019Debug64Cxx17
- GitHub Check: VS2019Debug64Cxx20
- GitHub Check: VS2022Debug64
- GitHub Check: VS2019Release64
- GitHub Check: VS2019WChar
- GitHub Check: VS2019Debug32
- GitHub Check: VS2019Debug64
- GitHub Check: MINGW64-gcc
- GitHub Check: windows-2019 vs2019
- GitHub Check: macos-13-C++
- GitHub Check: macos-14-C++
- GitHub Check: ubuntu-24.04 g++
🔇 Additional comments (104)
ACE/ace/Signal.inl (1)
140-143: Explicit cast & clearer parameter naming
Renaming the parameter tohandler_argavoids shadowing the method name, and usingACE_SignalHandlerV(handler_arg)in place of a C‑style cast strengthens type safety and improves readability.TAO/tao/MProfile.inl (1)
149-149: Validate narrowing conversion on return. Wrappinglast_ - 1instatic_cast<int>silences the warning, but iflast_exceedsINT_MAX + 1, this will overflow/truncate the value. Consider adding a runtime check or assertion to ensure the index fits withinintbefore casting.ACE/ace/Timer_Heap_T.cpp (1)
791-793: Explicitly cast timer_node_slot to size_t for remove(). Converting the signedssize_t timer_node_slottosize_tviastatic_castcorrectly matches theremove(size_t)signature and prevents compiler warnings. The preceding validation oftimer_node_slot >= 0ensures this cast is safe.ACE/ace/OS_NS_stdlib.cpp (1)
136-136: Use static_cast for pointer difference. Casting theptrdiff_tresult ofstart - strtosize_tenforces type safety for the length variable and addresses implicit conversion warnings.TAO/tao/Transport.inl (2)
245-245: Approve: Added explicit type casting improves type safetyThe addition of
static_cast<CORBA::LongLong>makes the type conversion explicit rather than relying on implicit conversion. This change helps prevent potential issues with type conversions and addresses compiler warnings without changing the functionality.
270-270: Approve: Consistent usage of static_cast for explicit type conversionSimilar to line 245, this change introduces explicit type conversion using
static_cast<CORBA::LongLong>to prevent implicit conversion issues. This is a good practice for type safety and helps suppress compiler warnings.ACE/ace/XML_Utils/XMLSchema/id_map.hpp (3)
58-58: Approve: Improved parameter naming conventionChanging the parameter name from
messagetoa_messagedisambiguates it from the member variable, making the code clearer and eliminating potential confusion or shadowing issues.
104-105: Approve: Improved iterator naming conventionRenaming from
id_iteratortoid_iterprovides consistency with the naming pattern used throughout the class. This change improves code readability without affecting functionality.Also applies to: 107-107
121-123: Approve: Consistent iterator naming conventionRenaming variables from
idref_iteratorandid_iteratortoidref_iterandid_iterrespectively creates a consistent naming convention across the file. This change improves code readability and maintainability without altering behavior.Also applies to: 126-127, 131-132, 136-136
ACE/ace/Dynamic_Message_Strategy.inl (2)
47-47: Improved type safety with explicit castThe explicit
static_cast<suseconds_t>ensures proper type conversion when initializing theACE_Time_Valueobject, avoiding potential compiler warnings or implicit conversion issues.
67-68: Improved type safety with explicit castsThe explicit
static_cast<suseconds_t>operations ensure proper type conversion when initializingmax_late_andmin_pending_ACE_Time_Valueobjects. This change improves type safety and avoids potential compiler warnings about implicit conversions.ACE/ace/Message_Queue_T.cpp (3)
1288-1288: Replaced truncate_cast with static_castChanged
ACE_Utils::truncate_cast<int>tostatic_cast<int>for convertingthis->cur_count_to an integer return value. This simplifies the code while maintaining the intended type conversion.
1403-1403: Replaced truncate_cast with static_castChanged
ACE_Utils::truncate_cast<int>tostatic_cast<int>for convertingthis->cur_count_to an integer return value. This simplifies the code while maintaining the intended type conversion.
1743-1743: Added explicit intermediate cast to ssize_tImproved the type conversion process by adding an explicit intermediate cast to
ssize_tbefore truncating toint. This ensures proper handling of the sign during conversion.ACE/ace/Time_Value.inl (3)
153-153: Improved type safety with explicit castAdded
static_cast<ACE_UINT64>when convertingthis->tv_.tv_usecto ensure proper type conversion before adding to the milliseconds calculation. This prevents potential implicit conversion issues.
219-219: Formatting improvement - removed unnecessary spaceRemoved the space after the reference symbol in the parameter declaration
ACE_UINT64 &usec. This improves code consistency and follows the project's style conventions.
224-224: Improved type safety with explicit castAdded
static_cast<ACE_UINT64>when convertingthis->tv_.tv_usecto ensure proper type conversion before adding to the microseconds calculation. This prevents potential implicit conversion issues.TAO/TAO_IDL/include/utl_scope_T.cpp (2)
96-96: Improved code style with cleaner conditional check.Changed from the Yoda condition
if (0 != fd)to the more idiomatic C++ styleif (fd). Both are functionally identical, but the new version improves readability.
102-105:Details
✅ Verification successful
Disabling forward declaration flag logic.
This commented-out code would have set the forward declaration flag on the full interface declaration when a predefined declaration existed. By commenting it out, this behavior is now disabled.
🏁 Script executed:
#!/bin/bash # Search for references to has_fwd_decl() to understand potential impact rg "has_fwd_decl\(" -A 3 -B 3 --type cpp --type hLength of output: 51
To ensure there are truly no remaining references or definitions of
has_fwd_decl, let’s broaden the search:
🏁 Script executed:
#!/bin/bash # Search for any definitions or calls of has_fwd_decl rg "has_fwd_decl" -n # Search for any remaining mentions of forward-declaration flags rg "fwd_decl" -nLength of output: 4314
🏁 Script executed:
#!/bin/bash # Display context around the commented-out code to inspect surrounding logic sed -n '80,120p' TAO/TAO_IDL/include/utl_scope_T.cppLength of output: 1077
Safe to remove unused
has_fwd_decllogicA project‑wide search confirms there are no remaining calls or checks against
has_fwd_decl(...). Disabling this flag has no downstream impact. You may also remove the commented block outright to clean up dead code.TAO/tao/Transport_Cache_Manager_T.cpp (3)
28-29: Renamed constructor parameter for clarity.Changed parameter name from
purging_strategytopurging, which is more concise.
33-34: Updated member initializer to match renamed parameter.Correctly updated the initializer list to use the renamed parameter.
544-545: Improved type safety with explicit const_cast.Replaced C-style cast with a more explicit
const_cast<void *>before casting to the target type. This improves code clarity by making the removal of constness explicit.- const HASH_MAP_ENTRY** left = (const HASH_MAP_ENTRY**) a; - const HASH_MAP_ENTRY** right = (const HASH_MAP_ENTRY**) b; + const HASH_MAP_ENTRY** left = (const HASH_MAP_ENTRY**) const_cast<void *> (a); + const HASH_MAP_ENTRY** right = (const HASH_MAP_ENTRY**) const_cast<void *> (b);ACE/ace/Log_Msg.inl (1)
22-22: Enhanced type safety with explicit cast.Added
static_cast<u_long>to explicitly convert thelog_priorityparameter before using it in theACE_BIT_ENABLEDmacro. This improves type safety and prevents potential compiler warnings from implicit conversions.ACE/ace/Null_Condition.h (2)
42-42: Improved type safety with explicit const_cast.Replaced C-style cast with
const_cast<ACE_Null_Mutex &>to explicitly show the intent of removing constness from the mutex parameter. This is a modern C++ practice that enhances code clarity and safety.
48-48: Improved type safety with explicit const_cast.Replaced C-style cast with
const_cast<ACE_Null_Mutex &>in the second constructor, consistent with the change in the first constructor. This maintains a consistent coding style throughout the class.ACE/ace/IO_SAP.inl (1)
36-36: Good improvement for type safetyThe explicit cast to
ACE_IOCTL_TYPE_ARG2ensures thecmdparameter has the expected type for the platform-specific ioctl command argument, eliminating potential compiler warnings about implicit type conversions.TAO/tao/Unbounded_Octet_Sequence_T.h (1)
110-111: Appropriate use of explicit casting for pointer arithmeticThe addition of explicit casts to
size_tfor the pointer difference calculations improves type safety. This ensures the read and write position offsets have the correct type when used for memory operations, preventing potential implicit conversion warnings.ACE/ace/Log_Category.inl (1)
55-55: Correct explicit type cast for bitwise operationThe explicit cast of
log_prioritytou_longimproves type safety when used with theACE_BIT_ENABLEDmacro. This ensures the bitwise operation receives the expected type, avoiding potential compiler warnings.ACE/ace/ARGV.cpp (1)
352-352: Proper type conversion for buffer allocation sizeThe explicit cast of
this->argc_tounsigned intbefore adding it tothis->length_for buffer allocation size calculation improves type safety. This prevents potential sign mismatch warnings and ensures consistent unsigned arithmetic for memory allocation sizes.ACE/ace/Functor.inl (3)
48-48: Added explicit cast for improved type safetyAdded an explicit
static_cast<unsigned long>where previously there was an implicit conversion. This makes the conversion intent clear and prevents potential compiler warnings.
55-55: Added explicit cast for improved type safetyAdded an explicit
static_cast<unsigned long>where previously there was an implicit conversion. This ensures type safety and matches the pattern used in other specializations of the same template.
62-62: Added explicit cast for improved type safetyAdded an explicit
static_cast<unsigned long>where previously there was an implicit conversion. This improves code consistency and helps prevent potential issues with implicit type conversions.ACE/ace/SOCK_Dgram.inl (1)
128-128: Enhanced type safety with explicit const_castThe change properly uses
const_cast<void *>to explicitly remove constness from thebufparameter before casting tochar *. This makes the intent clearer than the previous implicit C-style cast and follows modern C++ best practices for type safety.ACE/ace/High_Res_Timer.inl (1)
29-29: Improved type safety with explicit static_castAdding the explicit
static_cast<ACE_hrtime_t>ensures proper type conversion from the return value oftv.sec()to the requiredACE_hrtime_ttype for subsequent calculations. This prevents potential issues from implicit type conversions.ACE/ace/CDR_Stream.inl (1)
333-333: Added explicit type conversion for parameter correctnessThe added
static_cast<ACE_CDR::ULong>ensures that the integern(declared on line 331) is properly converted to the expected type for thewrite_arrayfunction. This explicit cast eliminates potential issues with implicit type conversion and clarifies the intended type usage.ACE/ace/Acceptor.cpp (1)
36-36: Improved const-correctness with explicit const_castThe change properly uses
const_cast<PEER_ACCEPTOR &>to explicitly remove constness fromthis->peer_acceptor_when returning a non-const reference from a const method. This makes the intent clearer than the previous C-style cast and follows modern C++ best practices for handling constness.ACE/ace/Select_Reactor_T.inl (1)
191-191: Improved constness removal with const_castThe C-style cast has been replaced with an explicit
const_cast, which better communicates the intent of removing constness fromACE_Time_Value::zero. This is a good modernization that makes the code more maintainable and safer.TAO/tao/String_Traits_T.h (1)
32-32: Improved type safety with explicit size_t castAdding
static_cast<size_t>to the pointer difference before multiplying bysizeof(char_type*)ensures type correctness when callingACE_OS::memset. This avoids potential issues with implicit conversions between signedptrdiff_t(result of pointer subtraction) and unsignedsize_t(expected by memory functions).The change is consistent with similar code in
Object_Reference_Traits_T.h, improving codebase uniformity.ACE/ace/INET_Addr.inl (1)
53-53: Improved pointer constness handling with const_castReplacing C-style casts with explicit
const_castoperations in theip_addr_pointer()method improves code clarity by making the intention to remove constness explicit. This change makes the code more maintainable and aligns with modern C++ best practices for const-correctness.Also applies to: 55-55, 57-57
ACE/ace/Based_Pointer_T.h (1)
134-135: Added static helper methods for pointer resolutionThese new static
basedmethods centralize pointer computation logic that was previously handled by a macro. This is a good refactoring that:
- Improves type safety through compile-time checking
- Makes the code more maintainable by replacing preprocessor macros with proper C++ functions
- Centralizes the pointer conversion logic in one place
The overloaded versions appropriately handle both const and non-const cases.
ACE/ace/OS_NS_time.inl (2)
31-31: Improved type safety with explicit castThe addition of
static_cast<size_t>for thebuflenparameter ensures proper type conversion when callingACE_OS::strsncpy, making the code more type-safe by avoiding implicit conversion frominttosize_t.
407-414: Well-scoped GCC diagnostic pragma for suppressing format warningsGood implementation of compiler-specific diagnostic controls to silence the format-nonliteral warning only for the
strftimecall. The approach properly:
- Pushes the current diagnostic state
- Disables only the specific warning
- Calls the function that would trigger the warning
- Pops the diagnostic state to restore previous warning settings
This maintains warning checks elsewhere in the code while addressing specific cases where the warning isn't applicable.
ACE/ace/String_Base.cpp (2)
434-434: Improved type safety with explicit cast for pointer differenceThe addition of
static_cast<ACE_String_Base<ACE_CHAR_T>::size_type>improves type safety by explicitly converting the pointer difference (which is of typeptrdiff_t, a signed type) to the method's return type. This eliminates potential issues with implicit conversions, particularly in edge cases where signedness might matter.
447-447: Improved type safety with explicit cast for pointer differenceSimilar to the previous change, this explicit cast ensures the pointer arithmetic result is properly converted to the expected return type, improving type safety and making the conversion intention clear.
ACE/ace/SString.inl (2)
163-163: Improved type safety with explicit cast for pointer differenceThe addition of
static_cast<ACE_SString::size_type>for the pointer difference calculation ensures proper type conversion fromptrdiff_tto the method's return type, avoiding potential issues with implicit conversion between signed and unsigned types.
174-174: Improved type safety with explicit cast for pointer differenceSimilar to the previous change, this explicit cast ensures the pointer arithmetic result is properly converted to the expected return type, improving type safety and making the conversion intention clear.
ACE/ace/OS_NS_dirent.inl (1)
115-116: Improved type safety with explicit const_castThe change replaces a direct C-style cast with a two-step explicit casting process. This improves code clarity by making the constness removal explicit with
const_cast<void*>before applying the C-style cast to the target type.ACE/ace/OS_NS_netdb.inl (2)
112-113: Improved type safety with static_castReplacing the C-style cast with
static_cast<socklen_t>makes the type conversion more explicit and safer, which helps prevent unintended conversions while ensuring the socket length parameter has the correct type.
753-753: Added explicit static_cast for flags parameterThe
flagsparameter is now explicitly cast tointusingstatic_cast, making the conversion clear and preventing potential issues with implicit conversions from unsigned to signed types.ACE/ace/OS_NS_stdlib.h (1)
68-68: Corrected return type for unsigned 64-bit integer functionThe return type for
ace_strtoull_helperhas been correctly changed fromACE_INT64(signed) toACE_UINT64(unsigned), properly matching the unsigned return type of the underlyingstrtoullfunction. This prevents potential issues with sign conversions for large values.ACE/ace/Based_Pointer_T.cpp (2)
33-33: Replaced macro with static member functionThe debug output now uses the newly introduced
based(this)static member function instead of theACE_COMPUTE_BASED_POINTERmacro. This improves code maintainability and readability by encapsulating the pointer computation logic in a type-safe function.
74-74: Improved const-correctness in pointer arithmeticThe pointer arithmetic now uses
const char*casts for both pointers, maintaining const-correctness throughout the calculation. This change better respects the constness of the input parameters without affecting the calculation result.ACE/ace/OS_NS_sys_socket.inl (2)
707-707: Improved type safety with explicit cast to socklen_tAdding the explicit
static_cast<socklen_t>for theaddrlenparameter ensures proper type conversion when calling the system'ssendto()function, preventing potential compiler warnings about implicit conversions.
921-921: Improved type safety with explicit cast to socklen_tAdding the explicit
static_cast<socklen_t>for theoptlenparameter provides proper type conversion when callingsetsockopt(), aligning with POSIX standards which expect socklen_t for length parameters in socket operations.ACE/ace/IPC_SAP.inl (1)
34-34: Improved type safety with explicit cast to ACE_IOCTL_TYPE_ARG2The addition of
static_cast<ACE_IOCTL_TYPE_ARG2>ensures thecmdparameter is properly converted to the expected platform-specific type for ioctl commands. This explicit casting prevents potential implicit conversion issues and improves code clarity by making the intended type conversion obvious.ACE/ace/Message_Block.inl (3)
310-310: Improved type safety in pointer arithmetic with explicit cast to size_tAdding
static_cast<size_t>for the pointer difference calculation improves type safety by explicitly converting fromptrdiff_t(signed) tosize_t(unsigned) for thewr_ptr_member. This prevents potential issues with signed/unsigned conversions.
348-348: Improved type safety in pointer arithmetic with explicit cast to size_tAdding
static_cast<size_t>for the pointer difference calculation improves type safety by explicitly converting fromptrdiff_t(signed) tosize_t(unsigned) for therd_ptr_member. This prevents potential issues with signed/unsigned conversions.
384-384: Improved type safety in pointer arithmetic with explicit cast to size_tAdding
static_cast<size_t>for the pointer difference calculation in thespace()method ensures type safety by explicitly converting fromptrdiff_t(signed) tosize_t(unsigned) for the return value. This prevents potential issues with signed/unsigned conversions.ACE/ace/OS_NS_stropts.inl (4)
160-161: Improved type safety with explicit cast to size_tAdding
static_cast<size_t>to convertctl->lenbefore passing toACE_OS::writeensures proper type conversion for the length parameter, preventing potential compiler warnings about implicit conversions.
165-166: Improved type safety with explicit cast to size_tAdding
static_cast<size_t>to convertdata->lenbefore passing toACE_OS::writeensures proper type conversion for the length parameter, preventing potential compiler warnings about implicit conversions.
172-172: Improved safety in buffer size calculationThe use of explicit casts to
unsigned intbefore addition and storing in an intermediateallocvariable improves type safety. Using theautokeyword with explicit initialization type also helps ensure the compiler uses the correct type.
174-180: Improved type safety in memory allocation and operationsMultiple improvements in this block:
- Using
static_cast<char*>in line 174 for memory allocation- Using explicit casts to
size_tfor memory operations in lines 178-179- Using the precomputed
allocvariable for write operation in line 180These changes ensure proper type handling throughout the memory allocation, copying, and writing operations.
ACE/ace/Malloc_T.inl (2)
93-93: Improved type safety with explicit cast tosize_tThe addition of
static_cast<size_t>makes the type conversion fromssize_ttosize_texplicit, avoiding potential compiler warnings about signed-to-unsigned conversions and improving type safety.
110-110: Improved type safety with explicit cast tosize_tSimilar to the previous change, the explicit
static_cast<size_t>improves type safety when converting from signedssize_tto unsignedsize_t, eliminating potential compiler warnings about implicit conversions.ACE/ace/Token.inl (3)
36-36: Enhanced type safety by replacing C-style cast with explicitconst_castThe change from a C-style cast to an explicit
const_castprovides better clarity about the intent to remove constness fromACE_Time_Value::zero. This is more type-safe and makes the code more maintainable.
79-79: Enhanced type safety by replacing C-style cast with explicitconst_castSimilar to the previous change, this replaces a C-style cast with a more explicit
const_castwhen removing constness fromACE_Time_Value::zero, improving code clarity and type safety.
96-96: Enhanced type safety by replacing C-style cast with explicitconst_castThe third instance of replacing a C-style cast with an explicit
const_castwhen handlingACE_Time_Value::zero, maintaining consistency throughout the code and improving type safety.ACE/ace/Svc_Handler.cpp (1)
248-248: Improved code clarity with explicitconst_castThe change from a C-style cast to an explicit
const_castfor removing constness fromthis->peer_enhances code readability and type safety. This makes the intention clearer and aligns with modern C++ best practices.ACE/ace/Priority_Reactor.cpp (1)
123-123: Improved type safety with more specific parameter typeChanging the
maskparameter type from genericintto specificACE_Reactor_Maskenhances type safety and self-documentation. This provides better compile-time checking and makes the code more maintainable by clearly indicating the parameter's intended purpose.ACE/ace/Priority_Reactor.h (1)
64-64: Improved type safety with ACE_Reactor_Mask.Changing the parameter type from
inttoACE_Reactor_Maskenhances type safety by using a more specific and semantically meaningful type instead of a generic integer.ACE/ace/Svc_Conf_Param.h (1)
65-71: Improved parameter naming for clarity.Renaming the parameter from
configtogestaltbetter aligns with its typeACE_Service_Gestalt*, making the code more self-documenting. The corresponding member initializer was correctly updated to use the new parameter name.Also applies to: 77-83
ACE/ace/Select_Reactor_T.h (1)
655-655: Improved type safety with ACE_Reactor_Mask.Changing the parameter type from
inttoACE_Reactor_Maskenhances type safety by using a more specific and semantically meaningful type instead of a generic integer. This change is consistent with similar updates in related reactor classes (e.g., ACE_Priority_Reactor).ACE/ace/Netlink_Addr.inl (3)
14-15: Improved type safety with explicit casts.Adding explicit
static_cast<unsigned int>conversions clarifies the intention to convert signed integers to unsigned and prevents potential compiler warnings about signed-to-unsigned conversions.
31-31: Improved clarity with const_cast.Replacing an implicit C-style cast with an explicit
const_castmakes the code's intent clearer and follows modern C++ best practices for const-correctness.
40-40: Improved type safety with explicit size_t cast.Adding an explicit
static_cast<size_t>for the length parameter clarifies the intent and prevents potential compiler warnings about implicit conversions to size_t in memory operations.TAO/TAO_IDL/driver/drv_preproc.cpp (6)
223-233: Good addition of warning suppression scope.The changes add GCC-specific warning suppression only for the necessary code, properly isolating the
-Wformat-nonliteralwarning suppression to just theACE_OS::sprintfcall that uses a non-literal format string. The warning suppression is neatly wrapped in push/pop pragmas to limit its scope.
256-257: Improved type safety with explicit cast.Adding
static_cast<int>for the buffer size argument improves type safety by making the integer conversion explicit, preventing potential truncation issues.
299-301: Improved type safety with explicit cast.Adding
static_cast<int>for the buffer size calculation improves type safety by making the integer conversion explicit, ensuring the correct size is passed toACE_OS::fgets.
414-415: Better type safety for loop index.Changing the loop indexing to use
static_cast<size_t>explicitly converts the platform argument count to the appropriate type for array indexing, making the code more type-safe.
423-424: Improved type safety for index assignment.Adding
static_cast<long>properly convertsDRV_argcountto the expected type ofoutput_arg_index, making the type conversion explicit and preventing potential issues.
891-892: Safer pointer arithmetic with explicit cast.Using
static_cast<size_t>for the pointer difference calculation ensures that the result is properly typed, preventing potential issues when comparing or using this value.ACE/ace/Based_Pointer_T.inl (6)
6-16: Good refactoring of pointer calculation logic.The addition of two typed
basedfunctions centralizes the pointer arithmetic that was likely previously handled by a macro. This improves type safety, better handles const-correctness, and makes the code more maintainable.
22-23: Improved pointer handling using new function.Replacing direct pointer arithmetic with the new
basedfunction improves code clarity and maintainability.
53-54: Improved pointer handling using new function.Replacing direct pointer arithmetic with the new
basedfunction improves code clarity and maintainability.
64-65: Improved const-correctness with explicit casting.Using
const_castwith the newbasedfunction more clearly expresses the intent to remove constness while leveraging the centralized pointer calculation logic.
78-80: Improved pointer handling using new function.Replacing direct pointer arithmetic with the new
basedfunction improves code clarity and maintainability.
92-94: Consistent use of based function for comparison operators.All comparison operators now use the
basedfunction for pointer calculations, ensuring consistent behavior and simplifying maintenance.Also applies to: 106-108, 113-115, 120-122, 127-129
ACE/ace/Select_Reactor_T.cpp (4)
509-514: Improved type safety with explicit cast.Adding
static_cast<size_t>for the return value ofACE::max_handles()ensures the correct type is passed to theopenfunction, preventing potential type conversion issues.
1051-1054: Fixed variable naming to avoid collision with system type.Renaming the local variable from
fd_settofdsavoids confusion with the system type of the same name, which could lead to subtle bugs or maintenance issues.
1189-1194: Better type safety using domain-specific type.Changing the
maskparameter type frominttoACE_Reactor_Maskimproves type safety by using the semantically correct type for the event mask.
1214-1215: Improved type consistency.Adding
static_cast<ACE_Reactor_Mask>ensures consistent typing when callingclear_dispatch_mask, aligning with the parameter type change above.ACE/ace/Arg_Shifter.cpp (6)
16-18: Improved const-correctness in parameter types.Changing from
const CHAR_TYPE **toCHAR_TYPE const **maintains consistent const qualifier positioning throughout the codebase. This is a style improvement that doesn't change behavior but improves readability.
31-38: Improved const-correctness in parameter types and initialization.Updating parameter types and member initializations to use consistent const qualifier positioning improves code readability and maintainability.
52-57: Improved pointer type consistency in allocation.Using
CHAR_TYPE **directly instead of casting fromconst CHAR_TYPE **ensures proper type consistency, especially for memory allocation.
89-96: Consistent const qualifier positioning in return type and variable declarations.Changing from
const CHAR_TYPE *toCHAR_TYPE const *maintains consistent const qualifier positioning throughout the codebase, improving readability.
101-103: Consistent const qualifier positioning in method signature.Using
CHAR_TYPE const *rather thanconst CHAR_TYPE *maintains consistent const qualifier positioning throughout the codebase, improving readability.
131-138: Consistent const qualifier positioning in parameter type and variable declarations.Changing from
const CHAR_TYPE *toCHAR_TYPE const *maintains consistent const qualifier positioning throughout the codebase, improving readability.ACE/ace/Arg_Shifter.h (7)
78-79: Consistent const-pointer qualification in constructor parameters
The constructor signature now uniformly usesCHAR_TYPE const **for bothargvandtemp, improving style consistency without altering semantics.
125-125: Unified pointer const-qualification style inget_the_parameter
The method signature now usesCHAR_TYPE const *for both the return type and theflagparameter, aligning with the project's const-correctness conventions.
164-164: Aligned const qualification incur_arg_strncasecmp
The parameter typeCHAR_TYPE const *flagfollows the same style, enhancing readability and consistency.
190-190: Style normalization for deleted copy constructor
Swapped toACE_Arg_Shifter_T const &for the deleted copy ctor, matching the const-placement convention used elsewhere.
193-193: Style normalization for deleted assignment operator
The assignment operator deletion now usesACE_Arg_Shifter_T const &for consistency with the copy constructor.
205-205: Updatedtemp_member pointer type for consistency
Changed the temporary array member toCHAR_TYPE **temp_, matching the constructor overload and simplifying ownership semantics.
208-208: Updatedargv_member pointer type for consistency
The argument array member now usesCHAR_TYPE **argv_, consistent with non‑const operations and constructor signatures.
Fixed warnings (cherry picked from commit 5ba4a19) # Conflicts: # ACE/ace/Arg_Shifter.cpp # ACE/ace/Arg_Shifter.h # ACE/ace/Based_Pointer_T.inl # ACE/ace/Netlink_Addr.inl # ACE/ace/OS_NS_stdlib.cpp # ACE/ace/OS_NS_time.inl # ACE/ace/Signal.inl # ACE/ace/Timer_Queue_T.cpp # ACE/ace/XML_Utils/XMLSchema/id_map.hpp # TAO/TAO_IDL/driver/drv_preproc.cpp
Mostly type conversions, const correctness, etc.
Summary by CodeRabbit
Refactor
const_cast,static_cast) to improve code clarity and safety.Bug Fixes
Style
Documentation