This file is indexed.

/usr/include/ace/String_Base.cpp is in libace-dev 6.0.3+dfsg-0.1.

This file is owned by root:root, with mode 0o644.

The actual contents of the file can be viewed below.

  1
  2
  3
  4
  5
  6
  7
  8
  9
 10
 11
 12
 13
 14
 15
 16
 17
 18
 19
 20
 21
 22
 23
 24
 25
 26
 27
 28
 29
 30
 31
 32
 33
 34
 35
 36
 37
 38
 39
 40
 41
 42
 43
 44
 45
 46
 47
 48
 49
 50
 51
 52
 53
 54
 55
 56
 57
 58
 59
 60
 61
 62
 63
 64
 65
 66
 67
 68
 69
 70
 71
 72
 73
 74
 75
 76
 77
 78
 79
 80
 81
 82
 83
 84
 85
 86
 87
 88
 89
 90
 91
 92
 93
 94
 95
 96
 97
 98
 99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
659
660
661
662
663
664
665
// $Id: String_Base.cpp 93238 2011-02-01 14:30:38Z shuston $

#ifndef ACE_STRING_BASE_CPP
#define ACE_STRING_BASE_CPP

#include "ace/ACE.h"
#include "ace/Malloc_Base.h"
#include "ace/String_Base.h"
#include "ace/Auto_Ptr.h"
#include "ace/OS_NS_string.h"

#include <algorithm>  // For std::swap<>

#if !defined (__ACE_INLINE__)
#include "ace/String_Base.inl"
#endif /* __ACE_INLINE__ */

ACE_BEGIN_VERSIONED_NAMESPACE_DECL

ACE_ALLOC_HOOK_DEFINE(ACE_String_Base)

template <class ACE_CHAR_T>
ACE_CHAR_T ACE_String_Base<ACE_CHAR_T>::NULL_String_ = 0;

// Default constructor.

template <class ACE_CHAR_T>
ACE_String_Base<ACE_CHAR_T>::ACE_String_Base (ACE_Allocator *the_allocator)
  : allocator_ (the_allocator ? the_allocator : ACE_Allocator::instance ()),
    len_ (0),
    buf_len_ (0),
    rep_ (&ACE_String_Base<ACE_CHAR_T>::NULL_String_),
    release_ (false)
{
  ACE_TRACE ("ACE_String_Base<ACE_CHAR_T>::ACE_String_Base");
}

// Constructor that actually copies memory.

template <class ACE_CHAR_T>
ACE_String_Base<ACE_CHAR_T>::ACE_String_Base (const ACE_CHAR_T *s,
                                        ACE_Allocator *the_allocator,
                                        bool release)
  : allocator_ (the_allocator ? the_allocator : ACE_Allocator::instance ()),
    len_ (0),
    buf_len_ (0),
    rep_ (0),
    release_ (false)
{
  ACE_TRACE ("ACE_String_Base<ACE_CHAR_T>::ACE_String_Base");
  this->set (s, release);
}

template <class ACE_CHAR_T>
ACE_String_Base<ACE_CHAR_T>::ACE_String_Base (ACE_CHAR_T c,
                                        ACE_Allocator *the_allocator)
  : allocator_ (the_allocator ? the_allocator : ACE_Allocator::instance ()),
    len_ (0),
    buf_len_ (0),
    rep_ (0),
    release_ (false)
{
  ACE_TRACE ("ACE_String_Base<ACE_CHAR_T>::ACE_String_Base");

  this->set (&c, 1, true);
}

// Constructor that actually copies memory.

template <class ACE_CHAR_T>
ACE_String_Base<ACE_CHAR_T>::ACE_String_Base (
  const ACE_CHAR_T *s,
  typename ACE_String_Base<ACE_CHAR_T>::size_type  len,
  ACE_Allocator *the_allocator,
  bool release)
  : allocator_ (the_allocator ? the_allocator : ACE_Allocator::instance ()),
    len_ (0),
    buf_len_ (0),
    rep_ (0),
    release_ (false)
{
  ACE_TRACE ("ACE_String_Base<ACE_CHAR_T>::ACE_String_Base");

  this->set (s, len, release);
}

// Copy constructor.

template <class ACE_CHAR_T>
ACE_String_Base<ACE_CHAR_T>::ACE_String_Base (const ACE_String_Base<ACE_CHAR_T> &s)
  : allocator_ (s.allocator_ ? s.allocator_ : ACE_Allocator::instance ()),
    len_ (0),
    buf_len_ (0),
    rep_ (0),
    release_ (false)
{
  ACE_TRACE ("ACE_String_Base<ACE_CHAR_T>::ACE_String_Base");

  this->set (s.rep_, s.len_, true);
}

template <class ACE_CHAR_T>
ACE_String_Base<ACE_CHAR_T>::ACE_String_Base (
  typename ACE_String_Base<ACE_CHAR_T>::size_type len,
  ACE_CHAR_T c,
  ACE_Allocator *the_allocator)
  : allocator_ (the_allocator ? the_allocator : ACE_Allocator::instance ()),
    len_ (0),
    buf_len_ (0),
    rep_ (0),
    release_ (false)
{
  ACE_TRACE ("ACE_String_Base<ACE_CHAR_T>::ACE_String_Base");

  this->resize (len, c);
}

template <class ACE_CHAR_T>
ACE_String_Base<ACE_CHAR_T>::~ACE_String_Base (void)
{
  ACE_TRACE ("ACE_String_Base<ACE_CHAR_T>::~ACE_String_Base");

  if (this->buf_len_ != 0 && this->release_)
      this->allocator_->free (this->rep_);
}

// this method might benefit from a little restructuring.
template <class ACE_CHAR_T> void
ACE_String_Base<ACE_CHAR_T>::set (const ACE_CHAR_T *s,
                            typename ACE_String_Base<ACE_CHAR_T>::size_type len,
                            bool release)
{
  // Case 1. Going from memory to more memory
  size_type new_buf_len = len + 1;
  if (s != 0 && len != 0 && release && this->buf_len_ < new_buf_len)
    {
      ACE_CHAR_T *temp = 0;
      ACE_ALLOCATOR (temp,
                     (ACE_CHAR_T *) this->allocator_->malloc (new_buf_len * sizeof (ACE_CHAR_T)));

      if (this->buf_len_ != 0 && this->release_)
        this->allocator_->free (this->rep_);

      this->rep_ = temp;
      this->buf_len_ = new_buf_len;
      this->release_ = true;
      this->len_ = len;
      ACE_OS::memcpy (this->rep_, s, len * sizeof (ACE_CHAR_T));
      this->rep_[len] = 0;
    }
  else // Case 2. No memory allocation is necessary.
    {
      // Free memory if necessary and figure out future ownership
      if (!release || s == 0 || len == 0)
        {
          if (this->buf_len_ != 0 && this->release_)
            {
              this->allocator_->free (this->rep_);
              this->release_ = false;
            }
        }
      // Populate data.
      if (s == 0 || len == 0)
        {
          this->buf_len_ = 0;
          this->len_ = 0;
          this->rep_ = &ACE_String_Base<ACE_CHAR_T>::NULL_String_;
          this->release_ = false;
        }
      else if (!release) // Note: No guarantee that rep_ is null terminated.
        {
          this->buf_len_ = len;
          this->len_ = len;
          this->rep_ = const_cast <ACE_CHAR_T *> (s);
          this->release_ = false;
        }
      else
        {
          ACE_OS::memcpy (this->rep_, s, len * sizeof (ACE_CHAR_T));
          this->rep_[len] = 0;
          this->len_ = len;
        }
    }
}

// Return substring.
template <class ACE_CHAR_T> ACE_String_Base<ACE_CHAR_T>
ACE_String_Base<ACE_CHAR_T>::substring (
  typename ACE_String_Base<ACE_CHAR_T>::size_type offset,
  typename ACE_String_Base<ACE_CHAR_T>::size_type length) const
{
  ACE_String_Base<ACE_CHAR_T> nill;
  size_type count = length;

  // case 1. empty string
  if (this->len_ == 0)
    return nill;

  // case 2. start pos past our end
  if (offset >= this->len_)
    return nill;
  // No length == empty string.
  else if (length == 0)
    return nill;
  // Get all remaining bytes.
  else if (length == npos || count > (this->len_ - offset))
    count = this->len_ - offset;

  return ACE_String_Base<ACE_CHAR_T> (&this->rep_[offset], count, this->allocator_);
}

template <class ACE_CHAR_T> ACE_String_Base<ACE_CHAR_T> &
ACE_String_Base<ACE_CHAR_T>::append (const ACE_CHAR_T* s,
                               typename ACE_String_Base<ACE_CHAR_T>::size_type slen)
{
  ACE_TRACE ("ACE_String_Base<ACE_CHAR_T>::append(const ACE_CHAR_T*, size_type)");
  if (slen > 0 && slen != npos)
  {
    // case 1. No memory allocation needed.
    if (this->buf_len_ >= this->len_ + slen + 1)
    {
      // Copy in data from new string.
      ACE_OS::memcpy (this->rep_ + this->len_, s, slen * sizeof (ACE_CHAR_T));
    }
    else // case 2. Memory reallocation is needed
    {
      const size_type new_buf_len =
        ace_max(this->len_ + slen + 1, this->buf_len_ + this->buf_len_ / 2);

      ACE_CHAR_T *t = 0;

      ACE_ALLOCATOR_RETURN (t,
        (ACE_CHAR_T *) this->allocator_->malloc (new_buf_len * sizeof (ACE_CHAR_T)), *this);

      // Copy memory from old string into new string.
      ACE_OS::memcpy (t, this->rep_, this->len_ * sizeof (ACE_CHAR_T));

      ACE_OS::memcpy (t + this->len_, s, slen * sizeof (ACE_CHAR_T));

      if (this->buf_len_ != 0 && this->release_)
        this->allocator_->free (this->rep_);

      this->release_ = true;
      this->rep_ = t;
      this->buf_len_ = new_buf_len;
    }

    this->len_ += slen;
    this->rep_[this->len_] = 0;
  }

  return *this;
}

template <class ACE_CHAR_T> u_long
ACE_String_Base<ACE_CHAR_T>::hash (void) const
{
  return
    ACE::hash_pjw (reinterpret_cast<char *> (
                      const_cast<ACE_CHAR_T *> (this->rep_)),
                   this->len_ * sizeof (ACE_CHAR_T));
}

template <class ACE_CHAR_T> void
ACE_String_Base<ACE_CHAR_T>::resize (typename ACE_String_Base<ACE_CHAR_T>::size_type len,
                               ACE_CHAR_T c)
{
  ACE_TRACE ("ACE_String_Base<ACE_CHAR_T>::resize");

  fast_resize(len);
  ACE_OS::memset (this->rep_, c, this->buf_len_ * sizeof (ACE_CHAR_T));
}

template <class ACE_CHAR_T> void
ACE_String_Base<ACE_CHAR_T>::fast_resize (size_t len)
{
  ACE_TRACE ("ACE_String_Base<ACE_CHAR_T>::fast_resize");

  // Only reallocate if we don't have enough space...
  if (this->buf_len_ <= len)
    {
      if (this->buf_len_ != 0 && this->release_)
        this->allocator_->free (this->rep_);

      this->rep_ = static_cast<ACE_CHAR_T*>
                     (this->allocator_->malloc ((len + 1) * sizeof (ACE_CHAR_T)));
      this->buf_len_ = len + 1;
      this->release_ = true;
    }
  this->len_ = 0;
  if (len > 0)
    this->rep_[0] = 0;
}

template <class ACE_CHAR_T> void
ACE_String_Base<ACE_CHAR_T>::clear (bool release)
{
  // This can't use set(), because that would free memory if release=false
  if (release)
  {
    if (this->buf_len_ != 0 && this->release_)
      this->allocator_->free (this->rep_);

    this->rep_ = &ACE_String_Base<ACE_CHAR_T>::NULL_String_;
    this->len_ = 0;
    this->buf_len_ = 0;
    this->release_ = false;
  }
  else
    {
      this->fast_clear ();
    }
}

// Assignment operator (does copy memory).
template <class ACE_CHAR_T> ACE_String_Base<ACE_CHAR_T> &
ACE_String_Base<ACE_CHAR_T>::operator= (const ACE_CHAR_T *s)
{
  ACE_TRACE ("ACE_String_Base<ACE_CHAR_T>::operator=");
  if (s != 0)
    this->set (s, true);
  return *this;
}

// Assignment operator (does copy memory).
template <class ACE_CHAR_T> ACE_String_Base<ACE_CHAR_T> &
ACE_String_Base<ACE_CHAR_T>::operator= (const ACE_String_Base<ACE_CHAR_T> &s)
{
  ACE_TRACE ("ACE_String_Base<ACE_CHAR_T>::operator=");

  // Check for self-assignment.
  if (this != &s)
    {
      this->set (s.rep_, s.len_, true);
    }

  return *this;
}

template <class ACE_CHAR_T> void
ACE_String_Base<ACE_CHAR_T>::set (const ACE_CHAR_T *s, bool release)
{
  size_t length = 0;
  if (s != 0)
    length = ACE_OS::strlen (s);

  this->set (s, length, release);
}

template <class ACE_CHAR_T> void
ACE_String_Base<ACE_CHAR_T>::fast_clear (void)
{
  this->len_ = 0;
  if (this->release_)
    {
      // String retains the original buffer.
      if (this->rep_ != &ACE_String_Base<ACE_CHAR_T>::NULL_String_)
        this->rep_[0] = 0;
    }
  else
    {
      // External buffer: string relinquishes control of it.
      this->buf_len_ = 0;
      this->rep_ = &ACE_String_Base<ACE_CHAR_T>::NULL_String_;
    }
}

// Get a copy of the underlying representation.

template <class ACE_CHAR_T> ACE_CHAR_T *
ACE_String_Base<ACE_CHAR_T>::rep (void) const
{
  ACE_TRACE ("ACE_String_Base<ACE_CHAR_T>::rep");

  ACE_CHAR_T *new_string;
  ACE_NEW_RETURN (new_string, ACE_CHAR_T[this->len_ + 1], 0);
  ACE_OS::strsncpy (new_string, this->rep_, this->len_+1);

  return new_string;
}

template <class ACE_CHAR_T> int
ACE_String_Base<ACE_CHAR_T>::compare (const ACE_String_Base<ACE_CHAR_T> &s) const
{
  ACE_TRACE ("ACE_String_Base<ACE_CHAR_T>::compare");

  if (this->rep_ == s.rep_)
    return 0;

  // Pick smaller of the two lengths and perform the comparison.
  size_type smaller_length = ace_min (this->len_, s.len_);

  int result = ACE_OS::memcmp (this->rep_,
                               s.rep_,
                               smaller_length * sizeof (ACE_CHAR_T));

  if (result == 0 && this->len_ != s.len_)
    result = this->len_ > s.len_ ? 1 : -1;
  return result;
}

// Comparison operator.

template <class ACE_CHAR_T> bool
ACE_String_Base<ACE_CHAR_T>::operator== (const ACE_String_Base<ACE_CHAR_T> &s) const
{
  return this->len_ == s.len_ &&
         ACE_OS::memcmp (this->rep_,
                         s.rep_,
                         this->len_ * sizeof (ACE_CHAR_T)) == 0;
}

template <class ACE_CHAR_T> bool
ACE_String_Base<ACE_CHAR_T>::operator== (const ACE_CHAR_T *s) const
{
  size_t len = ACE_OS::strlen (s);
  return this->len_ == len &&
         ACE_OS::memcmp (this->rep_,
                         s,
                         len * sizeof (ACE_CHAR_T)) == 0;
}

template <class ACE_CHAR_T> typename ACE_String_Base<ACE_CHAR_T>::size_type
ACE_String_Base<ACE_CHAR_T>::find (
  const ACE_CHAR_T *s,
  typename ACE_String_Base<ACE_CHAR_T>::size_type pos) const
{
  ACE_CHAR_T *substr = this->rep_ + pos;
  size_t len = ACE_OS::strlen (s);
  ACE_CHAR_T *pointer = ACE_OS::strnstr (substr, s, len);
  if (pointer == 0)
    return ACE_String_Base<ACE_CHAR_T>::npos;
  else
    return pointer - this->rep_;
}

template <class ACE_CHAR_T> typename ACE_String_Base<ACE_CHAR_T>::size_type
ACE_String_Base<ACE_CHAR_T>::find (
  ACE_CHAR_T c,
  typename ACE_String_Base<ACE_CHAR_T>::size_type pos) const
{
  ACE_CHAR_T *substr = this->rep_ + pos;
  ACE_CHAR_T *pointer = ACE_OS::strnchr (substr, c, this->len_ - pos);
  if (pointer == 0)
    return ACE_String_Base<ACE_CHAR_T>::npos;
  else
    return pointer - this->rep_;
}

template <class ACE_CHAR_T> typename ACE_String_Base<ACE_CHAR_T>::size_type
ACE_String_Base<ACE_CHAR_T>::rfind (
  ACE_CHAR_T c,
  typename ACE_String_Base<ACE_CHAR_T>::size_type pos) const
{
  if (pos == npos || pos > this->len_)
    pos = this->len_;

  // Do not change to prefix operator!  Proper operation of this loop
  // depends on postfix decrement behavior.
  for (size_type i = pos; i-- != 0; )
    if (this->rep_[i] == c)
      return i;

  return ACE_String_Base<ACE_CHAR_T>::npos;
}

template <class ACE_CHAR_T> void
ACE_String_Base<ACE_CHAR_T>::swap (ACE_String_Base<ACE_CHAR_T> & str)
{
  std::swap (this->allocator_ , str.allocator_);
  std::swap (this->len_       , str.len_);
  std::swap (this->buf_len_   , str.buf_len_);
  std::swap (this->rep_       , str.rep_);
  std::swap (this->release_   , str.release_);
}

// ----------------------------------------------

template <class ACE_CHAR_T>
int ACE_String_Base_Iterator <ACE_CHAR_T>::next (ACE_CHAR_T * & ch) const
{
  ACE_TRACE ("ACE_String_Base_Iterator<ACE_CHAR_T>::next");

  if (0 == this->done ())
  {
    ch = &this->str_->rep_[this->index_];
    return 1;
  }
  else
  {
    ch = 0;
    return 0;
  }
}

template <class ACE_CHAR_T>
int ACE_String_Base_Iterator <ACE_CHAR_T>::advance (void)
{
  ACE_TRACE ("ACE_String_Base_Iterator<ACE_CHAR_T>::advance");

  if (this->index_ < this->str_->length ())
  {
    ++ this->index_;
    return 1;
  }
  else
  {
    return 0;
  }
}

template <class ACE_CHAR_T>
const ACE_String_Base_Iterator <ACE_CHAR_T> &
ACE_String_Base_Iterator <ACE_CHAR_T>::
operator = (const ACE_String_Base_Iterator <ACE_CHAR_T> & rhs)
{
  ACE_TRACE ("ACE_String_Base_Iterator<ACE_CHAR_T>::operator =");

  if (this == &rhs)
    return *this;

  this->str_ = rhs.str_;
  this->index_ = rhs.index_;
  return *this;
}

// ----------------------------------------------

template <class ACE_CHAR_T>
int ACE_String_Base_Const_Iterator <ACE_CHAR_T>::next (const ACE_CHAR_T * & ch) const
{
  ACE_TRACE ("ACE_String_Base_Const_Iterator<ACE_CHAR_T>::next");

  if (0 == this->done ())
  {
    ch = &this->str_->rep_[this->index_];
    return 1;
  }
  else
  {
    ch = 0;
    return 0;
  }
}

template <class ACE_CHAR_T>
int ACE_String_Base_Const_Iterator <ACE_CHAR_T>::advance (void)
{
  ACE_TRACE ("ACE_String_Base_Const_Iterator<ACE_CHAR_T>::advance");

  if (this->index_ < this->str_->length ())
  {
    ++ this->index_;
    return 1;
  }
  else
  {
    return 0;
  }
}

template <class ACE_CHAR_T>
const ACE_String_Base_Const_Iterator <ACE_CHAR_T> &
ACE_String_Base_Const_Iterator <ACE_CHAR_T>::
operator = (const ACE_String_Base_Const_Iterator <ACE_CHAR_T> & rhs)
{
  ACE_TRACE ("ACE_String_Base_Const_Iterator<ACE_CHAR_T>::operator =");

  if (this == &rhs)
    return *this;

  this->str_ = rhs.str_;
  this->index_ = rhs.index_;
  return *this;
}

// ----------------------------------------------

template <class ACE_CHAR_T> ACE_String_Base<ACE_CHAR_T>
operator+ (const ACE_String_Base<ACE_CHAR_T> &s, const ACE_String_Base<ACE_CHAR_T> &t)
{
  ACE_String_Base<ACE_CHAR_T> temp (s.length () + t.length ());
  temp += s;
  temp += t;
  return temp;
}

template <class ACE_CHAR_T> ACE_String_Base<ACE_CHAR_T>
operator+ (const ACE_CHAR_T *s, const ACE_String_Base<ACE_CHAR_T> &t)
{
  size_t slen = 0;
  if (s != 0)
    slen = ACE_OS::strlen (s);
  ACE_String_Base<ACE_CHAR_T> temp (slen + t.length ());
  if (slen > 0)
    temp.append (s, slen);
  temp += t;
  return temp;
}

template <class ACE_CHAR_T> ACE_String_Base<ACE_CHAR_T>
operator+ (const ACE_String_Base<ACE_CHAR_T> &s, const ACE_CHAR_T *t)
{
  size_t tlen = 0;
  if (t != 0)
    tlen = ACE_OS::strlen (t);
  ACE_String_Base<ACE_CHAR_T> temp (s.length () + tlen);
  temp += s;
  if (tlen > 0)
    temp.append (t, tlen);
  return temp;
}

template <class ACE_CHAR_T> ACE_String_Base<ACE_CHAR_T>
operator + (const ACE_String_Base<ACE_CHAR_T> &t,
            const ACE_CHAR_T c)
{
  ACE_String_Base<ACE_CHAR_T> temp (t.length () + 1);
  temp += t;
  temp += c;
  return temp;
}

template <class ACE_CHAR_T> ACE_String_Base<ACE_CHAR_T>
operator + (const ACE_CHAR_T c,
            const ACE_String_Base<ACE_CHAR_T> &t)
{
  ACE_String_Base<ACE_CHAR_T> temp (t.length () + 1);
  temp += c;
  temp += t;
  return temp;
}

template <class ACE_CHAR_T>
ACE_String_Base<ACE_CHAR_T> &
ACE_String_Base<ACE_CHAR_T>::operator+= (const ACE_CHAR_T* s)
{
  size_t slen = 0;
  if (s != 0)
    slen = ACE_OS::strlen (s);
  return this->append (s, slen);
}

template <class ACE_CHAR_T>
ACE_String_Base<ACE_CHAR_T> &
ACE_String_Base<ACE_CHAR_T>::operator+= (const ACE_String_Base<ACE_CHAR_T> &s)
{
  ACE_TRACE ("ACE_String_Base<ACE_CHAR_T>::operator+=(const ACE_String_Base<ACE_CHAR_T> &)");
  return this->append (s.rep_, s.len_);
}

template <class ACE_CHAR_T>
ACE_String_Base<ACE_CHAR_T> &
ACE_String_Base<ACE_CHAR_T>::operator+= (const ACE_CHAR_T c)
{
  ACE_TRACE ("ACE_String_Base<ACE_CHAR_T>::operator+=(const ACE_CHAR_T)");
  const size_type slen = 1;
  // This temp is silly but it quiets an optimizer warning in IBM XL C++ 10.
  ACE_String_Base<ACE_CHAR_T>& r = this->append (&c, slen);
  return r;
}

ACE_END_VERSIONED_NAMESPACE_DECL

#endif  /* ACE_STRING_BASE_CPP */