Skip to content

Commit 63e7cc1

Browse files
authored
Merge pull request #2372 from mitza-oci/a6t2-warnings
[ACE 6-TAO 2] Fixed warnings
2 parents a579eb7 + d243860 commit 63e7cc1

59 files changed

Lines changed: 211 additions & 180 deletions

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

ACE/ace/ARGV.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -351,7 +351,7 @@ ACE_ARGV_T<CHAR_TYPE>::create_buf_from_queue (void)
351351
-1);
352352
#else
353353
ACE_NEW_RETURN (this->buf_,
354-
CHAR_TYPE[this->length_ + this->argc_],
354+
CHAR_TYPE[this->length_ + static_cast<unsigned int> (this->argc_)],
355355
-1);
356356
#endif /* ACE_HAS_ALLOC_HOOKS */
357357

ACE/ace/Acceptor.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -33,7 +33,7 @@ template <typename SVC_HANDLER, typename PEER_ACCEPTOR>
3333
ACE_Acceptor<SVC_HANDLER, PEER_ACCEPTOR>::operator PEER_ACCEPTOR & () const
3434
{
3535
ACE_TRACE ("ACE_Acceptor<SVC_HANDLER, PEER_ACCEPTOR>::operator PEER_ACCEPTOR &");
36-
return (PEER_ACCEPTOR &) this->peer_acceptor_;
36+
return const_cast<PEER_ACCEPTOR &> (this->peer_acceptor_);
3737
}
3838

3939
template <typename SVC_HANDLER, typename PEER_ACCEPTOR> PEER_ACCEPTOR &

ACE/ace/Arg_Shifter.cpp

Lines changed: 20 additions & 20 deletions
Original file line numberDiff line numberDiff line change
@@ -13,13 +13,13 @@
1313
ACE_BEGIN_VERSIONED_NAMESPACE_DECL
1414

1515
template <typename CHAR_TYPE>
16-
ACE_Arg_Shifter_T<CHAR_TYPE>::ACE_Arg_Shifter_T (int& argc,
17-
const CHAR_TYPE** argv,
18-
const CHAR_TYPE** temp)
16+
ACE_Arg_Shifter_T<CHAR_TYPE>::ACE_Arg_Shifter_T (int &argc,
17+
CHAR_TYPE const **argv,
18+
CHAR_TYPE const **temp)
1919
: argc_ (argc),
2020
total_size_ (argc),
21-
temp_ (temp),
22-
argv_ (argv),
21+
temp_ (const_cast<CHAR_TYPE **> (temp)),
22+
argv_ (const_cast<CHAR_TYPE **> (argv)),
2323
current_index_ (0),
2424
back_ (argc - 1),
2525
front_ (0)
@@ -28,13 +28,13 @@ ACE_Arg_Shifter_T<CHAR_TYPE>::ACE_Arg_Shifter_T (int& argc,
2828
}
2929

3030
template <typename CHAR_TYPE>
31-
ACE_Arg_Shifter_T<CHAR_TYPE>::ACE_Arg_Shifter_T (int& argc,
32-
CHAR_TYPE** argv,
33-
CHAR_TYPE** temp)
31+
ACE_Arg_Shifter_T<CHAR_TYPE>::ACE_Arg_Shifter_T (int &argc,
32+
CHAR_TYPE **argv,
33+
CHAR_TYPE **temp)
3434
: argc_ (argc),
3535
total_size_ (argc),
36-
temp_ ((const CHAR_TYPE **) temp),
37-
argv_ ((const CHAR_TYPE **) argv),
36+
temp_ (temp),
37+
argv_ (argv),
3838
current_index_ (0),
3939
back_ (argc - 1),
4040
front_ (0)
@@ -49,11 +49,11 @@ ACE_Arg_Shifter_T<CHAR_TYPE>::init (void)
4949
// If not provided with one, allocate a temporary array.
5050
if (this->temp_ == 0)
5151
#if defined (ACE_HAS_ALLOC_HOOKS)
52-
this->temp_ = reinterpret_cast<const CHAR_TYPE **>
52+
this->temp_ = reinterpret_cast<CHAR_TYPE **>
5353
(ACE_Allocator::instance ()->malloc (sizeof (CHAR_TYPE*) * this->total_size_));
5454
#else
5555
ACE_NEW (this->temp_,
56-
const CHAR_TYPE *[this->total_size_]);
56+
CHAR_TYPE *[this->total_size_]);
5757
#endif /* ACE_HAS_ALLOC_HOOKS */
5858
if (this->temp_ != 0)
5959
{
@@ -86,20 +86,20 @@ ACE_Arg_Shifter_T<CHAR_TYPE>::~ACE_Arg_Shifter_T (void)
8686
}
8787

8888
template <typename CHAR_TYPE>
89-
const CHAR_TYPE *
89+
CHAR_TYPE const *
9090
ACE_Arg_Shifter_T<CHAR_TYPE>::get_current (void) const
9191
{
92-
const CHAR_TYPE * retval = 0;
92+
CHAR_TYPE const *retval = 0;
9393

9494
if (this->is_anything_left ())
95-
retval = this->temp_[current_index_];
95+
retval = this->temp_[current_index_];
9696

9797
return retval;
9898
}
9999

100100
template <typename CHAR_TYPE>
101-
const CHAR_TYPE *
102-
ACE_Arg_Shifter_T<CHAR_TYPE>::get_the_parameter (const CHAR_TYPE *flag)
101+
CHAR_TYPE const *
102+
ACE_Arg_Shifter_T<CHAR_TYPE>::get_the_parameter (CHAR_TYPE const *flag)
103103
{
104104
// the return 0's abound because this method
105105
// would otherwise be a deep if { } else { }
@@ -128,13 +128,13 @@ ACE_Arg_Shifter_T<CHAR_TYPE>::get_the_parameter (const CHAR_TYPE *flag)
128128

129129
template <typename CHAR_TYPE>
130130
int
131-
ACE_Arg_Shifter_T<CHAR_TYPE>::cur_arg_strncasecmp (const CHAR_TYPE *flag)
131+
ACE_Arg_Shifter_T<CHAR_TYPE>::cur_arg_strncasecmp (CHAR_TYPE const *flag)
132132
{
133133
if (!this->is_anything_left ())
134134
return -1;
135135

136136
const size_t flag_length = ACE_OS::strlen (flag);
137-
const CHAR_TYPE *arg = this->temp_[this->current_index_];
137+
CHAR_TYPE const *arg = this->temp_[this->current_index_];
138138

139139
if (ACE_OS::strncasecmp (arg, flag, flag_length) != 0)
140140
return -1;
@@ -220,4 +220,4 @@ ACE_Arg_Shifter_T<CHAR_TYPE>::num_ignored_args (void) const
220220

221221
ACE_END_VERSIONED_NAMESPACE_DECL
222222

223-
#endif /* ACE_ATOMIC_OP_T_CPP */
223+
#endif

ACE/ace/Arg_Shifter.h

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -75,8 +75,8 @@ class ACE_Arg_Shifter_T
7575
* vector transparently.
7676
*/
7777
ACE_Arg_Shifter_T (int &argc,
78-
const CHAR_TYPE **argv,
79-
const CHAR_TYPE **temp = 0);
78+
CHAR_TYPE const **argv,
79+
CHAR_TYPE const **temp = 0);
8080

8181
/// Same behavior as the preceding constructor, but without the
8282
/// "const" qualifier.
@@ -122,7 +122,7 @@ class ACE_Arg_Shifter_T
122122
* together '-foobarflagVALUE', the flag is NOT consumed
123123
* and the cur arg is left pointing to the entire flag/value pair
124124
*/
125-
const CHAR_TYPE *get_the_parameter (const CHAR_TYPE *flag);
125+
CHAR_TYPE const *get_the_parameter (CHAR_TYPE const *flag);
126126

127127
/**
128128
* Check if the current argument matches (case insensitive) @a flag
@@ -161,7 +161,7 @@ class ACE_Arg_Shifter_T
161161
* Case C: If neither of Case A or B is met (no match)
162162
* then -1 is returned
163163
*/
164-
int cur_arg_strncasecmp (const CHAR_TYPE *flag);
164+
int cur_arg_strncasecmp (CHAR_TYPE const *flag);
165165

166166
/// Consume @a number argument(s) by sticking them/it on the end of
167167
/// the vector.
@@ -202,10 +202,10 @@ class ACE_Arg_Shifter_T
202202
int total_size_;
203203

204204
/// The temporary array over which we traverse.
205-
const CHAR_TYPE **temp_;
205+
CHAR_TYPE **temp_;
206206

207207
/// The array in which the arguments are reordered.
208-
const CHAR_TYPE **argv_;
208+
CHAR_TYPE **argv_;
209209

210210
/// The element in <temp_> we're currently examining.
211211
int current_index_;

ACE/ace/Based_Pointer_T.cpp

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -30,8 +30,7 @@ ACE_Based_Pointer_Basic<CONCRETE>::dump (void) const
3030
ACELIB_DEBUG ((LM_DEBUG, ACE_BEGIN_DUMP, this));
3131
ACELIB_DEBUG ((LM_DEBUG, ACE_TEXT ("\ntarget_ = %d\n"), this->target_));
3232
ACELIB_DEBUG ((LM_DEBUG, ACE_TEXT ("base_offset_ = %d\n"), this->base_offset_));
33-
ACELIB_DEBUG ((LM_DEBUG, ACE_TEXT ("computed pointer = %x\n"),
34-
(CONCRETE *)(ACE_COMPUTE_BASED_POINTER (this))));
33+
ACELIB_DEBUG ((LM_DEBUG, ACE_TEXT ("computed pointer = %x\n"), ACE_Based_Pointer_Basic::based (this)));
3534
ACELIB_DEBUG ((LM_DEBUG, ACE_END_DUMP));
3635
#endif /* ACE_HAS_DUMP */
3736
}
@@ -72,7 +71,7 @@ ACE_Based_Pointer_Basic<CONCRETE>::ACE_Based_Pointer_Basic (const void *base_add
7271
base_offset_ (0)
7372
{
7473
ACE_TRACE ("ACE_Based_Pointer_Basic<CONCRETE>::ACE_Based_Pointer_Basic");
75-
this->base_offset_ = (char *) this - (char *) base_addr;
74+
this->base_offset_ = (const char *) this - (const char *) base_addr;
7675
}
7776

7877
template <class CONCRETE>

ACE/ace/Based_Pointer_T.h

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -141,6 +141,12 @@ class ACE_Based_Pointer_Basic
141141

142142
/// Keep track of our offset from the base pointer.
143143
ptrdiff_t base_offset_;
144+
145+
/// Convert input pointer to CONCRETE using the base_offset_ and target_ adjustments
146+
static CONCRETE *based (ACE_Based_Pointer_Basic *p);
147+
148+
/// Convert input pointer to CONCRETE using the base_offset_ and target_ adjustments
149+
static CONCRETE const *based (ACE_Based_Pointer_Basic const *p);
144150
};
145151

146152
/**

ACE/ace/Based_Pointer_T.inl

Lines changed: 22 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -1,14 +1,25 @@
11
// -*- C++ -*-
2-
#define ACE_COMPUTE_BASED_POINTER(P) (((char *) (P) - (P)->base_offset_) + (P)->target_)
32
#include "ace/Global_Macros.h"
43

54
ACE_BEGIN_VERSIONED_NAMESPACE_DECL
65

76
template <class CONCRETE> ACE_INLINE CONCRETE *
8-
ACE_Based_Pointer<CONCRETE>::operator->(void)
7+
ACE_Based_Pointer_Basic<CONCRETE>::based (ACE_Based_Pointer_Basic *p)
8+
{
9+
return reinterpret_cast<CONCRETE *> (reinterpret_cast<char *> (p) - p->base_offset_ + p->target_);
10+
}
11+
12+
template <class CONCRETE> ACE_INLINE CONCRETE const *
13+
ACE_Based_Pointer_Basic<CONCRETE>::based (ACE_Based_Pointer_Basic const *p)
14+
{
15+
return reinterpret_cast<CONCRETE const *> (reinterpret_cast<const char *> (p) - p->base_offset_ + p->target_);
16+
}
17+
18+
template <class CONCRETE> ACE_INLINE CONCRETE *
19+
ACE_Based_Pointer<CONCRETE>::operator-> ()
920
{
1021
ACE_TRACE ("ACE_Based_Pointer<CONCRETE>::operator->");
11-
return reinterpret_cast<CONCRETE *> (ACE_COMPUTE_BASED_POINTER (this));
22+
return ACE_Based_Pointer::based (this);
1223
}
1324

1425
template <class CONCRETE> ACE_INLINE void
@@ -39,7 +50,7 @@ template <class CONCRETE> ACE_INLINE CONCRETE
3950
ACE_Based_Pointer_Basic<CONCRETE>::operator *(void) const
4051
{
4152
ACE_TRACE ("ACE_Based_Pointer_Basic<CONCRETE>::operator *");
42-
return *reinterpret_cast<CONCRETE *> (ACE_COMPUTE_BASED_POINTER (this));
53+
return *ACE_Based_Pointer_Basic::based (this);
4354
}
4455

4556
template <class CONCRETE> ACE_INLINE CONCRETE *
@@ -50,7 +61,7 @@ ACE_Based_Pointer_Basic<CONCRETE>::addr (void) const
5061
if (this->target_ == -1)
5162
return 0;
5263
else
53-
return reinterpret_cast<CONCRETE *> (ACE_COMPUTE_BASED_POINTER (this));
64+
return const_cast<CONCRETE *> (ACE_Based_Pointer_Basic::based (this));
5465
}
5566

5667
template <class CONCRETE> ACE_INLINE
@@ -65,9 +76,7 @@ template <class CONCRETE> ACE_INLINE CONCRETE
6576
ACE_Based_Pointer_Basic<CONCRETE>::operator [] (int index) const
6677
{
6778
ACE_TRACE ("ACE_Based_Pointer_Basic<CONCRETE>::operator []");
68-
CONCRETE *c =
69-
reinterpret_cast<CONCRETE *> (ACE_COMPUTE_BASED_POINTER (this));
70-
return c[index];
79+
return ACE_Based_Pointer_Basic::based (this)[index];
7180
}
7281

7382
template <class CONCRETE> ACE_INLINE void
@@ -81,7 +90,7 @@ template <class CONCRETE> ACE_INLINE bool
8190
ACE_Based_Pointer_Basic<CONCRETE>::operator == (const ACE_Based_Pointer_Basic<CONCRETE> &rhs) const
8291
{
8392
ACE_TRACE ("ACE_Based_Pointer_Basic<CONCRETE>::operator ==");
84-
return ACE_COMPUTE_BASED_POINTER (this) == ACE_COMPUTE_BASED_POINTER (&rhs);
93+
return ACE_Based_Pointer_Basic::based (this) == ACE_Based_Pointer_Basic::based (&rhs);
8594
}
8695

8796
template <class CONCRETE> ACE_INLINE bool
@@ -95,28 +104,28 @@ template <class CONCRETE> ACE_INLINE bool
95104
ACE_Based_Pointer_Basic<CONCRETE>::operator < (const ACE_Based_Pointer_Basic<CONCRETE> &rhs) const
96105
{
97106
ACE_TRACE ("ACE_Based_Pointer_Basic<CONCRETE>::operator <");
98-
return ACE_COMPUTE_BASED_POINTER (this) < ACE_COMPUTE_BASED_POINTER (&rhs);
107+
return ACE_Based_Pointer_Basic::based (this) < ACE_Based_Pointer_Basic::based (&rhs);
99108
}
100109

101110
template <class CONCRETE> ACE_INLINE bool
102111
ACE_Based_Pointer_Basic<CONCRETE>::operator <= (const ACE_Based_Pointer_Basic<CONCRETE> &rhs) const
103112
{
104113
ACE_TRACE ("ACE_Based_Pointer_Basic<CONCRETE>::operator <=");
105-
return ACE_COMPUTE_BASED_POINTER (this) <= ACE_COMPUTE_BASED_POINTER (&rhs);
114+
return ACE_Based_Pointer_Basic::based (this) <= ACE_Based_Pointer_Basic::based (&rhs);
106115
}
107116

108117
template <class CONCRETE> ACE_INLINE bool
109118
ACE_Based_Pointer_Basic<CONCRETE>::operator > (const ACE_Based_Pointer_Basic<CONCRETE> &rhs) const
110119
{
111120
ACE_TRACE ("ACE_Based_Pointer_Basic<CONCRETE>::operator >");
112-
return ACE_COMPUTE_BASED_POINTER (this) > ACE_COMPUTE_BASED_POINTER (&rhs);
121+
return ACE_Based_Pointer_Basic::based (this) > ACE_Based_Pointer_Basic::based (&rhs);
113122
}
114123

115124
template <class CONCRETE> ACE_INLINE bool
116125
ACE_Based_Pointer_Basic<CONCRETE>::operator >= (const ACE_Based_Pointer_Basic<CONCRETE> &rhs) const
117126
{
118127
ACE_TRACE ("ACE_Based_Pointer_Basic<CONCRETE>::operator >=");
119-
return ACE_COMPUTE_BASED_POINTER (this) >= ACE_COMPUTE_BASED_POINTER (&rhs);
128+
return ACE_Based_Pointer_Basic::based (this) >= ACE_Based_Pointer_Basic::based (&rhs);
120129
}
121130

122131
template <class CONCRETE> ACE_INLINE void

ACE/ace/CDR_Stream.inl

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -330,7 +330,7 @@ ACE_OutputCDR::write_fixed (const ACE_CDR::Fixed &x)
330330
{
331331
int n;
332332
const ACE_CDR::Octet *arr = x.to_octets (n);
333-
return this->write_array (arr, ACE_CDR::OCTET_SIZE, ACE_CDR::OCTET_ALIGN, n);
333+
return this->write_array (arr, ACE_CDR::OCTET_SIZE, ACE_CDR::OCTET_ALIGN, static_cast<ACE_CDR::ULong> (n));
334334
}
335335

336336
ACE_INLINE ACE_CDR::Boolean

ACE/ace/Dynamic_Message_Strategy.inl

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -44,7 +44,7 @@ ACE_Dynamic_Message_Strategy::dynamic_priority_max (unsigned long ul)
4444
// dynamic_priority_max_ is initialized or changes, and is stored
4545
// as a class member rather than being a derived value.
4646
dynamic_priority_max_ = ul;
47-
pending_shift_ = ACE_Time_Value (0, ul);
47+
pending_shift_ = ACE_Time_Value (0, static_cast<suseconds_t> (ul));
4848
}
4949
// set maximum supported priority value
5050

@@ -64,8 +64,8 @@ ACE_Dynamic_Message_Strategy::dynamic_priority_offset (unsigned long ul)
6464
// initialized or changes, and are stored as a class member rather
6565
// than being derived each time one of their values is needed.
6666
dynamic_priority_offset_ = ul;
67-
max_late_ = ACE_Time_Value (0, ul - 1);
68-
min_pending_ = ACE_Time_Value (0, ul);
67+
max_late_ = ACE_Time_Value (0, static_cast<suseconds_t> (ul - 1));
68+
min_pending_ = ACE_Time_Value (0, static_cast<suseconds_t> (ul));
6969
}
7070
// set offset for boundary between signed range and unsigned range
7171

ACE/ace/Env_Value_T.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -87,7 +87,7 @@ ACE_BEGIN_VERSIONED_NAMESPACE_DECL
8787
template <> inline void
8888
ACE_Convert (const ACE_TCHAR *s, ACE_TCHAR *&v)
8989
{
90-
v = (ACE_TCHAR *) s;
90+
v = const_cast<ACE_TCHAR *> (s);
9191
}
9292

9393
template <> inline void

0 commit comments

Comments
 (0)