View | Details | Raw Unified | Return to bug 2726
Collapse All | Expand All

(-)a/src/core/examples/hash-example.cc (-1 / +1 lines)
 Lines 359-365    Link Here 
359
    //
359
    //
360
    // Number of buckets = k = 2^bits
360
    // Number of buckets = k = 2^bits
361
    long double k32 = 0xFFFFFFFF;
361
    long double k32 = 0xFFFFFFFF;
362
    long double k64 = 0xFFFFFFFFFFFFFFFFULL;
362
    long double k64 = static_cast<long double> (0xFFFFFFFFFFFFFFFFULL);
363
363
364
    long double n = m_nphrases;
364
    long double n = m_nphrases;
365
    long double Ec32 = n * (n - 1) / ( 2 * k32) * (1 - (n - 2)/(3 * k32));
365
    long double Ec32 = n * (n - 1) / ( 2 * k32) * (1 - (n - 2)/(3 * k32));
(-)a/src/core/helper/random-variable-stream-helper.cc (-2 / +3 lines)
 Lines 39-46    Link Here 
39
  NS_LOG_FUNCTION_NOARGS ();
39
  NS_LOG_FUNCTION_NOARGS ();
40
  NS_ASSERT (stream >= 0);
40
  NS_ASSERT (stream >= 0);
41
  Config::MatchContainer mc = Config::LookupMatches (path);
41
  Config::MatchContainer mc = Config::LookupMatches (path);
42
  int64_t i = 0;
42
43
  for (Config::MatchContainer::Iterator mci = mc.Begin (); mci != mc.End (); ++mci, ++i)
43
  std::size_t i = 0;
44
  for ( ; i < mc.GetN (); ++i)
44
    {
45
    {
45
      PointerValue ptr = mc.Get (i);
46
      PointerValue ptr = mc.Get (i);
46
      Ptr<RandomVariableStream> rvs = ptr.Get<RandomVariableStream> ();
47
      Ptr<RandomVariableStream> rvs = ptr.Get<RandomVariableStream> ();
(-)a/src/core/model/attribute-accessor-helper.h (+5 lines)
 Lines 21-26    Link Here 
21
#define ATTRIBUTE_ACCESSOR_HELPER_H
21
#define ATTRIBUTE_ACCESSOR_HELPER_H
22
22
23
#include "attribute.h"
23
#include "attribute.h"
24
#include "unused.h"
24
25
25
/**
26
/**
26
 * \file
27
 * \file
 Lines 325-330    Link Here 
325
    {}
326
    {}
326
private:
327
private:
327
    virtual bool DoSet (T *object, const V *v) const {
328
    virtual bool DoSet (T *object, const V *v) const {
329
      NS_UNUSED (object);
330
      NS_UNUSED (v);
328
      return false;
331
      return false;
329
    }
332
    }
330
    virtual bool DoGet (const T *object, V *v) const {
333
    virtual bool DoGet (const T *object, V *v) const {
 Lines 385-390    Link Here 
385
      return true;
388
      return true;
386
    }
389
    }
387
    virtual bool DoGet (const T *object, V *v) const {
390
    virtual bool DoGet (const T *object, V *v) const {
391
      NS_UNUSED (object);
392
      NS_UNUSED (v);
388
      return false;
393
      return false;
389
    }
394
    }
390
    virtual bool HasGetter (void) const {
395
    virtual bool HasGetter (void) const {
(-)a/src/core/model/cairo-wideint.c (-7 / +9 lines)
 Lines 27-32    Link Here 
27
 *
27
 *
28
 * Contributor(s):
28
 * Contributor(s):
29
 *	Keith R. Packard <keithp@keithp.com>
29
 *	Keith R. Packard <keithp@keithp.com>
30
 *
31
 * Code changes from for ns-3 from upstream are marked with `//PDB'
30
 */
32
 */
31
33
32
#include "cairo-wideint-private.h"
34
#include "cairo-wideint-private.h"
 Lines 311-321    Link Here 
311
	den = _cairo_int64_negate (den);
313
	den = _cairo_int64_negate (den);
312
    uqr = _cairo_uint64_divrem (num, den);
314
    uqr = _cairo_uint64_divrem (num, den);
313
    if (num_neg)
315
    if (num_neg)
314
	qr.rem = _cairo_int64_negate (uqr.rem);
316
        qr.rem = _cairo_int64_negate ((cairo_int64_t)uqr.rem);  //PDB
315
    else
317
    else
316
	qr.rem = uqr.rem;
318
	qr.rem = uqr.rem;
317
    if (num_neg != den_neg)
319
    if (num_neg != den_neg)
318
	qr.quo = (cairo_int64_t) _cairo_int64_negate (uqr.quo);
320
	qr.quo = (cairo_int64_t) _cairo_int64_negate ((cairo_int64_t)uqr.quo);
319
    else
321
    else
320
	qr.quo = (cairo_int64_t) uqr.quo;
322
	qr.quo = (cairo_int64_t) uqr.quo;
321
    return qr;
323
    return qr;
 Lines 689-695    Link Here 
689
    cairo_uint64_t x = _cairo_uint128_to_uint64 (_cairo_uint128_rsl(num, 32));
691
    cairo_uint64_t x = _cairo_uint128_to_uint64 (_cairo_uint128_rsl(num, 32));
690
692
691
    /* Initialise the result to indicate overflow. */
693
    /* Initialise the result to indicate overflow. */
692
    result.quo = _cairo_uint32s_to_uint64 (-1U, -1U);
694
    result.quo = _cairo_uint32s_to_uint64 (UINT_MAX, UINT_MAX);  //PDB
693
    result.rem = den;
695
    result.rem = den;
694
696
695
    /* Don't bother if the quotient is going to overflow. */
697
    /* Don't bother if the quotient is going to overflow. */
 Lines 756-762    Link Here 
756
	/* Add the main term's contribution to quotient.  Note B-v =
758
	/* Add the main term's contribution to quotient.  Note B-v =
757
	 * -v as an uint32 (unless v = 0) */
759
	 * -v as an uint32 (unless v = 0) */
758
	if (v)
760
	if (v)
759
	    quorem = _cairo_uint64_divrem (_cairo_uint32x32_64_mul (q, -v), den);
761
	    quorem = _cairo_uint64_divrem (_cairo_uint32x32_64_mul (q, -(int32_t)v), den);  //PDB
760
	else
762
	else
761
	    quorem = _cairo_uint64_divrem (_cairo_uint32s_to_uint64 (q, 0), den);
763
	    quorem = _cairo_uint64_divrem (_cairo_uint32s_to_uint64 (q, 0), den);
762
	quotient += _cairo_uint64_to_uint32 (quorem.quo);
764
	quotient += _cairo_uint64_to_uint32 (quorem.quo);
 Lines 805-821    Link Here 
805
    uqr = _cairo_uint_96by64_32x64_divrem (num, nonneg_den);
807
    uqr = _cairo_uint_96by64_32x64_divrem (num, nonneg_den);
806
    if (_cairo_uint64_eq (uqr.rem, _cairo_int64_to_uint64 (nonneg_den))) {
808
    if (_cairo_uint64_eq (uqr.rem, _cairo_int64_to_uint64 (nonneg_den))) {
807
	/* bail on overflow. */
809
	/* bail on overflow. */
808
	qr.quo = _cairo_uint32s_to_uint64 (0x7FFFFFFF, -1U);;
810
	qr.quo = _cairo_uint32s_to_uint64 (0x7FFFFFFF, UINT_MAX);  //PDB
809
	qr.rem = den;
811
	qr.rem = den;
810
	return qr;
812
	return qr;
811
    }
813
    }
812
814
813
    if (num_neg)
815
    if (num_neg)
814
	qr.rem = _cairo_int64_negate (uqr.rem);
816
	qr.rem = _cairo_int64_negate ((cairo_int64_t)uqr.rem);  //PDB
815
    else
817
    else
816
	qr.rem = uqr.rem;
818
	qr.rem = uqr.rem;
817
    if (num_neg != den_neg)
819
    if (num_neg != den_neg)
818
	qr.quo = _cairo_int64_negate (uqr.quo);
820
	qr.quo = _cairo_int64_negate ((cairo_int64_t)uqr.quo);  //PDB
819
    else
821
    else
820
	qr.quo = uqr.quo;
822
	qr.quo = uqr.quo;
821
    return qr;
823
    return qr;
(-)a/src/core/model/calendar-scheduler.cc (-5 / +5 lines)
 Lines 140-147    Link Here 
140
  uint64_t bucketTop = m_bucketTop;
140
  uint64_t bucketTop = m_bucketTop;
141
  Scheduler::Event minEvent;
141
  Scheduler::Event minEvent;
142
  minEvent.impl = 0;
142
  minEvent.impl = 0;
143
  minEvent.key.m_ts = ~0;
143
  minEvent.key.m_ts = UINT64_MAX;
144
  minEvent.key.m_uid = ~0;
144
  minEvent.key.m_uid = UINT32_MAX;
145
  minEvent.key.m_context = 0;
145
  minEvent.key.m_context = 0;
146
  do
146
  do
147
    {
147
    {
 Lines 274-280    Link Here 
274
    }
274
    }
275
}
275
}
276
276
277
uint32_t
277
uint64_t
278
CalendarScheduler::CalculateNewWidth (void)
278
CalendarScheduler::CalculateNewWidth (void)
279
{
279
{
280
  NS_LOG_FUNCTION (this);
280
  NS_LOG_FUNCTION (this);
 Lines 354-360    Link Here 
354
  return totalSeparation;
354
  return totalSeparation;
355
}
355
}
356
void
356
void
357
CalendarScheduler::DoResize (uint32_t newSize, uint32_t newWidth)
357
CalendarScheduler::DoResize (uint32_t newSize, uint64_t newWidth)
358
{
358
{
359
  NS_LOG_FUNCTION (this << newSize << newWidth);
359
  NS_LOG_FUNCTION (this << newSize << newWidth);
360
360
 Lines 378-384    Link Here 
378
  NS_LOG_FUNCTION (this << newSize);
378
  NS_LOG_FUNCTION (this << newSize);
379
379
380
  // PrintInfo ();
380
  // PrintInfo ();
381
  uint32_t newWidth = CalculateNewWidth ();
381
  uint64_t newWidth = CalculateNewWidth ();
382
  DoResize (newSize, newWidth);
382
  DoResize (newSize, newWidth);
383
}
383
}
384
384
(-)a/src/core/model/calendar-scheduler.h (-2 / +2 lines)
 Lines 90-96    Link Here 
90
   *
90
   *
91
   * \returns The new width.
91
   * \returns The new width.
92
   */
92
   */
93
  uint32_t CalculateNewWidth (void);
93
  uint64_t CalculateNewWidth (void);
94
  /**
94
  /**
95
   * Initialize the calendar queue.
95
   * Initialize the calendar queue.
96
   *
96
   *
 Lines 116-122    Link Here 
116
   * \param [in] newSize The number of buckets.
116
   * \param [in] newSize The number of buckets.
117
   * \param [in] newWidth The size of the new buckets.
117
   * \param [in] newWidth The size of the new buckets.
118
   */
118
   */
119
  void DoResize (uint32_t newSize, uint32_t newWidth);
119
  void DoResize (uint32_t newSize, uint64_t newWidth);
120
  /**
120
  /**
121
   * Remove the earliest event.
121
   * Remove the earliest event.
122
   *
122
   *
(-)a/src/core/model/config.cc (-11 / +11 lines)
 Lines 65-78    Link Here 
65
  NS_LOG_FUNCTION (this);
65
  NS_LOG_FUNCTION (this);
66
  return m_objects.end ();
66
  return m_objects.end ();
67
}
67
}
68
uint32_t
68
std::size_t
69
MatchContainer::GetN (void) const
69
MatchContainer::GetN (void) const
70
{
70
{
71
  NS_LOG_FUNCTION (this);
71
  NS_LOG_FUNCTION (this);
72
  return m_objects.size ();
72
  return m_objects.size ();
73
}
73
}
74
Ptr<Object>
74
Ptr<Object>
75
MatchContainer::Get (uint32_t i) const
75
MatchContainer::Get (std::size_t i) const
76
{
76
{
77
  NS_LOG_FUNCTION (this << i);
77
  NS_LOG_FUNCTION (this << i);
78
  return m_objects[i];
78
  return m_objects[i];
 Lines 500-512    Link Here 
500
                  continue;
500
                  continue;
501
                }
501
                }
502
              // attempt to cast to a pointer checker.
502
              // attempt to cast to a pointer checker.
503
              const PointerChecker *ptr = dynamic_cast<const PointerChecker *> (PeekPointer (info.checker));
503
              const PointerChecker *pChecker = dynamic_cast<const PointerChecker *> (PeekPointer (info.checker));
504
              if (ptr != 0)
504
              if (pChecker != 0)
505
                {
505
                {
506
                  NS_LOG_DEBUG ("GetAttribute(ptr)="<<info.name<<" on path="<<GetResolvedPath ());
506
                  NS_LOG_DEBUG ("GetAttribute(ptr)="<<info.name<<" on path="<<GetResolvedPath ());
507
                  PointerValue ptr;
507
                  PointerValue pValue;
508
                  root->GetAttribute (info.name, ptr);
508
                  root->GetAttribute (info.name, pValue);
509
                  Ptr<Object> object = ptr.Get<Object> ();
509
                  Ptr<Object> object = pValue.Get<Object> ();
510
                  if (object == 0)
510
                  if (object == 0)
511
                    {
511
                    {
512
                      NS_LOG_ERROR ("Requested object name=\""<<item<<
512
                      NS_LOG_ERROR ("Requested object name=\""<<item<<
 Lines 602-610    Link Here 
602
  void UnregisterRootNamespaceObject (Ptr<Object> obj);
602
  void UnregisterRootNamespaceObject (Ptr<Object> obj);
603
603
604
  /** \copydoc Config::GetRootNamespaceObjectN() */
604
  /** \copydoc Config::GetRootNamespaceObjectN() */
605
  uint32_t GetRootNamespaceObjectN (void) const;
605
  std::size_t GetRootNamespaceObjectN (void) const;
606
  /** \copydoc Config::GetRootNamespaceObject() */
606
  /** \copydoc Config::GetRootNamespaceObject() */
607
  Ptr<Object> GetRootNamespaceObject (uint32_t i) const;
607
  Ptr<Object> GetRootNamespaceObject (std::size_t i) const;
608
608
609
private:
609
private:
610
  /**
610
  /**
 Lines 740-753    Link Here 
740
    }
740
    }
741
}
741
}
742
742
743
uint32_t 
743
std::size_t 
744
ConfigImpl::GetRootNamespaceObjectN (void) const
744
ConfigImpl::GetRootNamespaceObjectN (void) const
745
{
745
{
746
  NS_LOG_FUNCTION (this);
746
  NS_LOG_FUNCTION (this);
747
  return m_roots.size ();
747
  return m_roots.size ();
748
}
748
}
749
Ptr<Object> 
749
Ptr<Object> 
750
ConfigImpl::GetRootNamespaceObject (uint32_t i) const
750
ConfigImpl::GetRootNamespaceObject (std::size_t i) const
751
{
751
{
752
  NS_LOG_FUNCTION (this << i);
752
  NS_LOG_FUNCTION (this << i);
753
  return m_roots[i];
753
  return m_roots[i];
(-)a/src/core/model/config.h (-2 / +2 lines)
 Lines 176-187    Link Here 
176
  /**
176
  /**
177
   * \returns The number of items in the container
177
   * \returns The number of items in the container
178
   */
178
   */
179
  uint32_t GetN (void) const;
179
  std::size_t GetN (void) const;
180
  /**
180
  /**
181
   * \param [in] i Index of item to lookup ([0,n[)
181
   * \param [in] i Index of item to lookup ([0,n[)
182
   * \returns The item requested.
182
   * \returns The item requested.
183
   */
183
   */
184
  Ptr<Object> Get (uint32_t i) const;
184
  Ptr<Object> Get (std::size_t i) const;
185
  /**
185
  /**
186
   * \param [in] i Index of item to lookup ([0,n[)
186
   * \param [in] i Index of item to lookup ([0,n[)
187
   * \returns The fully-qualified matching path associated
187
   * \returns The fully-qualified matching path associated
(-)a/src/core/model/hash-fnv.cc (-2 / +2 lines)
 Lines 159-165    Link Here 
159
/**
159
/**
160
 * 32 bit FNV-0 hash type
160
 * 32 bit FNV-0 hash type
161
 */
161
 */
162
typedef u_int32_t Fnv32_t;
162
typedef uint32_t Fnv32_t;  //PDB
163
163
164
164
165
/**
165
/**
 Lines 202-208    Link Here 
202
 * 64 bit FNV-0 hash
202
 * 64 bit FNV-0 hash
203
 */
203
 */
204
#if defined(HAVE_64BIT_LONG_LONG)
204
#if defined(HAVE_64BIT_LONG_LONG)
205
typedef u_int64_t Fnv64_t;
205
typedef uint64_t Fnv64_t;  //PDB
206
#else /* HAVE_64BIT_LONG_LONG */
206
#else /* HAVE_64BIT_LONG_LONG */
207
typedef struct {
207
typedef struct {
208
    u_int32_t w32[2]; /* w32[0] is low order, w32[1] is high order word */
208
    u_int32_t w32[2]; /* w32[0] is low order, w32[1] is high order word */
(-)a/src/core/model/hash-murmur3.cc (-6 / +8 lines)
 Lines 493-500    Link Here 
493
  h1 += h2;
493
  h1 += h2;
494
  h2 += h1;
494
  h2 += h1;
495
495
496
  ((uint32_t *)out)[0] = h1;
496
  ((uint32_t *)out)[0] = static_cast<uint32_t> (h1);  //PDB
497
  ((uint32_t *)out)[1] = h2;
497
  ((uint32_t *)out)[1] = static_cast<uint32_t> (h2);  //PDB
498
}
498
}
499
499
500
500
 Lines 521-527    Link Here 
521
{
521
{
522
  using namespace Murmur3Implementation;
522
  using namespace Murmur3Implementation;
523
523
524
  MurmurHash3_x86_32_incr (buffer, size, m_hash32, (void *) & m_hash32);
524
  MurmurHash3_x86_32_incr (buffer, static_cast<int> (size),
525
                           m_hash32, (void *) & m_hash32);
525
  m_size32 += size;
526
  m_size32 += size;
526
  uint32_t hash;
527
  uint32_t hash;
527
  MurmurHash3_x86_32_fin  (m_size32, m_hash32, (void *) & hash);
528
  MurmurHash3_x86_32_fin  (m_size32, m_hash32, (void *) & hash);
 Lines 533-539    Link Here 
533
Murmur3::GetHash64  (const char * buffer, const size_t size)
534
Murmur3::GetHash64  (const char * buffer, const size_t size)
534
{
535
{
535
  using namespace Murmur3Implementation;
536
  using namespace Murmur3Implementation;
536
  MurmurHash3_x86_128_incr (buffer, size,
537
538
  MurmurHash3_x86_128_incr (buffer, static_cast<int> (size),
537
                            (uint32_t *)(void *)m_hash64, m_hash64);
539
                            (uint32_t *)(void *)m_hash64, m_hash64);
538
  m_size64 += size;
540
  m_size64 += size;
539
541
 Lines 551-557    Link Here 
551
  // Using uint32_t here avoids the bug, and continues to works with newer gcc.
553
  // Using uint32_t here avoids the bug, and continues to works with newer gcc.
552
  uint32_t hash[4];
554
  uint32_t hash[4];
553
  
555
  
554
  MurmurHash3_x86_128_fin (m_size64,
556
  MurmurHash3_x86_128_fin (static_cast<int> (m_size64),
555
                           (uint32_t *)(void *)m_hash64, hash);
557
                           (uint32_t *)(void *)m_hash64, hash);
556
  uint64_t result = hash[1];
558
  uint64_t result = hash[1];
557
  result = (result << 32) | hash[0];
559
  result = (result << 32) | hash[0];
 Lines 563-569    Link Here 
563
{
565
{
564
  m_hash32 = (uint32_t)SEED;
566
  m_hash32 = (uint32_t)SEED;
565
  m_size32 = 0;
567
  m_size32 = 0;
566
  m_hash64[0] = m_hash64[1] = ((uint64_t)(SEED) << 32) + (uint64_t)SEED;
568
  m_hash64[0] = m_hash64[1] = ((uint64_t)SEED << 32) | (uint32_t)SEED;
567
  m_size64 = 0;
569
  m_size64 = 0;
568
}
570
}
569
571
(-)a/src/core/model/hash-murmur3.h (-1 / +1 lines)
 Lines 109-115    Link Here 
109
   */
109
   */
110
  /**@{*/
110
  /**@{*/
111
  uint32_t m_hash32;
111
  uint32_t m_hash32;
112
  uint32_t m_size32;
112
  uint64_t m_size32;
113
  /**@}*/
113
  /**@}*/
114
  
114
  
115
  /** murmur3 produces 128-bit hash and state; we use just the first 64-bits. */
115
  /** murmur3 produces 128-bit hash and state; we use just the first 64-bits. */
(-)a/src/core/model/heap-scheduler.cc (-1 / +1 lines)
 Lines 102-108    Link Here 
102
  return (id == Root ()) ? true : false;
102
  return (id == Root ()) ? true : false;
103
}
103
}
104
104
105
uint32_t
105
std::size_t
106
HeapScheduler::Last (void) const
106
HeapScheduler::Last (void) const
107
{
107
{
108
  NS_LOG_FUNCTION (this);
108
  NS_LOG_FUNCTION (this);
(-)a/src/core/model/heap-scheduler.h (-1 / +1 lines)
 Lines 113-119    Link Here 
113
   * Return the index of the last element.
113
   * Return the index of the last element.
114
   * \returns The last index.
114
   * \returns The last index.
115
   */
115
   */
116
  uint32_t Last (void) const;
116
  std::size_t Last (void) const;
117
  /**
117
  /**
118
   * Test if an index is the root.
118
   * Test if an index is the root.
119
   *
119
   *
(-)a/src/core/model/int64x64-cairo.cc (-2 / +2 lines)
 Lines 174-180    Link Here 
174
      qr = _cairo_uint128_divrem (rem, den);
174
      qr = _cairo_uint128_divrem (rem, den);
175
175
176
      // Add in the quotient as shift bits of the fraction
176
      // Add in the quotient as shift bits of the fraction
177
      result = _cairo_uint128_lsl (result, shift);
177
      result = _cairo_uint128_lsl (result, static_cast<int> (shift));
178
      result = _cairo_uint128_add (result, qr.quo);
178
      result = _cairo_uint128_add (result, qr.quo);
179
      rem = qr.rem;
179
      rem = qr.rem;
180
      digis += shift;
180
      digis += shift;
 Lines 184-190    Link Here 
184
  if (digis < DIGITS)
184
  if (digis < DIGITS)
185
    {
185
    {
186
      shift = DIGITS - digis;
186
      shift = DIGITS - digis;
187
      result = _cairo_uint128_lsl (result, shift);
187
      result = _cairo_uint128_lsl (result, static_cast<int> (shift));
188
    }
188
    }
189
  
189
  
190
  return result;
190
  return result;
(-)a/src/core/model/int64x64-cairo.h (-4 / +4 lines)
 Lines 108-115    Link Here 
108
    //   TestSuite int64x64
108
    //   TestSuite int64x64
109
    const long double round = 0.5;
109
    const long double round = 0.5;
110
    flo = flo * HP_MAX_64 + round;
110
    flo = flo * HP_MAX_64 + round;
111
    cairo_int64_t  hi = fhi;
111
    cairo_int64_t  hi = (cairo_int64_t)fhi;
112
    const cairo_uint64_t lo = flo;
112
    const cairo_uint64_t lo = (cairo_uint64_t)flo;
113
    if (flo >= HP_MAX_64)
113
    if (flo >= HP_MAX_64)
114
      {
114
      {
115
	// conversion to uint64 rolled over
115
	// conversion to uint64 rolled over
 Lines 197-208    Link Here 
197
  {
197
  {
198
    const bool negative = _cairo_int128_negative (_v);
198
    const bool negative = _cairo_int128_negative (_v);
199
    const cairo_int128_t value = negative ? _cairo_int128_negate (_v) : _v;
199
    const cairo_int128_t value = negative ? _cairo_int128_negate (_v) : _v;
200
    const long double fhi = value.hi;
200
    const long double fhi = static_cast<long double> (value.hi);
201
    const long double flo = value.lo / HP_MAX_64;
201
    const long double flo = value.lo / HP_MAX_64;
202
    long double retval = fhi;
202
    long double retval = fhi;
203
    retval += flo;
203
    retval += flo;
204
    retval = negative ? -retval : retval;
204
    retval = negative ? -retval : retval;
205
    return retval;
205
    return static_cast<double> (retval);
206
  }
206
  }
207
  /**
207
  /**
208
   * Get the integer portion.
208
   * Get the integer portion.
(-)a/src/core/model/int64x64-double.h (-5 / +6 lines)
 Lines 99-111    Link Here 
99
  inline int64x64_t (long int v)
99
  inline int64x64_t (long int v)
100
    : _v (v) {}
100
    : _v (v) {}
101
  inline int64x64_t (long long int v)
101
  inline int64x64_t (long long int v)
102
    : _v (v) {}
102
    : _v (static_cast<double> (v)) {}
103
  inline int64x64_t (unsigned int v)
103
  inline int64x64_t (unsigned int v)
104
    : _v (v) {}
104
    : _v (v) {}
105
  inline int64x64_t (unsigned long int v)
105
  inline int64x64_t (unsigned long int v)
106
    : _v (v) {}
106
    : _v (v) {}
107
  inline int64x64_t (unsigned long long int v)
107
  inline int64x64_t (unsigned long long int v)
108
    : _v (v) {}
108
    : _v (static_cast<double> (v)) {}
109
  /**@}*/
109
  /**@}*/
110
  /**
110
  /**
111
   * Construct from explicit high and low values.
111
   * Construct from explicit high and low values.
 Lines 116-122    Link Here 
116
  explicit inline int64x64_t (int64_t hi, uint64_t lo)
116
  explicit inline int64x64_t (int64_t hi, uint64_t lo)
117
  {
117
  {
118
    const bool negative = hi < 0;
118
    const bool negative = hi < 0;
119
    const long double fhi = negative ? -hi : hi;
119
    const long double hild = static_cast<long double> (hi);
120
    const long double fhi = negative ? -hild : hild;
120
    const long double flo = lo / HP_MAX_64;
121
    const long double flo = lo / HP_MAX_64;
121
    _v = negative ? - fhi : fhi;
122
    _v = negative ? - fhi : fhi;
122
    _v += flo;
123
    _v += flo;
 Lines 173-180    Link Here 
173
    //   TestSuite int64x64
174
    //   TestSuite int64x64
174
    const long double round = 0.5;
175
    const long double round = 0.5;
175
    flo = flo * HP_MAX_64 + round;
176
    flo = flo * HP_MAX_64 + round;
176
    int64_t  hi = fhi;
177
    int64_t  hi = static_cast<int64_t> (fhi);
177
    uint64_t lo = flo;
178
    uint64_t lo = static_cast<uint64_t> (flo);
178
    if (flo >= HP_MAX_64)
179
    if (flo >= HP_MAX_64)
179
      {
180
      {
180
	// conversion to uint64 rolled over
181
	// conversion to uint64 rolled over
(-)a/src/core/model/log.cc (+32 lines)
 Lines 680-683    Link Here 
680
  return *this;
680
  return *this;
681
}
681
}
682
682
683
template<>
684
ParameterLogger&
685
ParameterLogger::operator<< <int8_t>(const int8_t param)
686
{
687
  if (m_first)
688
  {
689
    m_os << static_cast<int16_t> (param);
690
    m_first = false;
691
  }
692
  else
693
  {
694
    m_os << static_cast<int16_t> (param);
695
  }
696
  return *this;
697
}
698
699
template<>
700
ParameterLogger&
701
ParameterLogger::operator<< <uint8_t>(const uint8_t param)
702
{
703
  if (m_first)
704
  {
705
    m_os << static_cast<uint16_t> (param);
706
    m_first = false;
707
  }
708
  else
709
  {
710
    m_os << static_cast<uint16_t> (param);
711
  }
712
  return *this;
713
}
714
683
} // namespace ns3
715
} // namespace ns3
(-)a/src/core/model/log.h (+18 lines)
 Lines 511-516    Link Here 
511
ParameterLogger&
511
ParameterLogger&
512
ParameterLogger::operator<< <const char *>(const char * param);
512
ParameterLogger::operator<< <const char *>(const char * param);
513
  
513
  
514
/**
515
 * Specialization for int8_t.
516
 * \param [in] param The function parameter.
517
 * \return This ParameterLogger, so it's chainable.
518
 */
519
template<>
520
ParameterLogger&
521
  ParameterLogger::operator<< <int8_t>(int8_t param);
522
523
/**
524
 * Specialization for uint8_t.
525
 * \param [in] param The function parameter.
526
 * \return This ParameterLogger, so it's chainable.
527
 */
528
template<>
529
ParameterLogger&
530
  ParameterLogger::operator<< <uint8_t>(uint8_t param);
531
514
} // namespace ns3
532
} // namespace ns3
515
533
516
/**@}*/  // \ingroup logging
534
/**@}*/  // \ingroup logging
(-)a/src/core/model/nstime.h (-1 / +1 lines)
 Lines 380-386    Link Here 
380
  }
380
  }
381
  inline double GetDouble (void) const
381
  inline double GetDouble (void) const
382
  {
382
  {
383
    return m_data;
383
    return static_cast<double> (m_data);
384
  }
384
  }
385
  inline int64_t GetInteger (void) const
385
  inline int64_t GetInteger (void) const
386
  {
386
  {
(-)a/src/core/model/object-base.cc (-2 / +2 lines)
 Lines 140-149    Link Here 
140
                  if (equal != std::string::npos)
140
                  if (equal != std::string::npos)
141
                    {
141
                    {
142
                      std::string name = tmp.substr (0, equal);
142
                      std::string name = tmp.substr (0, equal);
143
                      std::string value = tmp.substr (equal+1, tmp.size () - equal - 1);
143
                      std::string envval = tmp.substr (equal+1, tmp.size () - equal - 1);
144
                      if (name == tid.GetAttributeFullName (i))
144
                      if (name == tid.GetAttributeFullName (i))
145
                        {
145
                        {
146
                          if (DoSet (info.accessor, info.checker, StringValue (value)))
146
                          if (DoSet (info.accessor, info.checker, StringValue (envval)))
147
                            {
147
                            {
148
                              NS_LOG_DEBUG ("construct \""<< tid.GetName ()<<"::"<<
148
                              NS_LOG_DEBUG ("construct \""<< tid.GetName ()<<"::"<<
149
                                            info.name <<"\" from env var");
149
                                            info.name <<"\" from env var");
(-)a/src/core/model/object-map.h (-2 / +2 lines)
 Lines 81-87    Link Here 
81
{
81
{
82
  struct MemberStdContainer : public ObjectPtrContainerAccessor
82
  struct MemberStdContainer : public ObjectPtrContainerAccessor
83
  {
83
  {
84
    virtual bool DoGetN (const ObjectBase *object, uint32_t *n) const {
84
    virtual bool DoGetN (const ObjectBase *object, std::size_t *n) const {
85
      const T *obj = dynamic_cast<const T *> (object);
85
      const T *obj = dynamic_cast<const T *> (object);
86
      if (obj == 0)
86
      if (obj == 0)
87
        {
87
        {
 Lines 90-96    Link Here 
90
      *n = (obj->*m_memberVector).size ();
90
      *n = (obj->*m_memberVector).size ();
91
      return true;
91
      return true;
92
    }
92
    }
93
    virtual Ptr<Object> DoGet (const ObjectBase *object, uint32_t i, uint32_t *index) const {
93
    virtual Ptr<Object> DoGet (const ObjectBase *object, std::size_t i, std::size_t *index) const {
94
      const T *obj = static_cast<const T *> (object);
94
      const T *obj = static_cast<const T *> (object);
95
      typename U::const_iterator begin = (obj->*m_memberVector).begin ();
95
      typename U::const_iterator begin = (obj->*m_memberVector).begin ();
96
      typename U::const_iterator end = (obj->*m_memberVector).end ();
96
      typename U::const_iterator end = (obj->*m_memberVector).end ();
(-)a/src/core/model/object-ptr-container.cc (-4 / +4 lines)
 Lines 47-60    Link Here 
47
  NS_LOG_FUNCTION (this);
47
  NS_LOG_FUNCTION (this);
48
  return m_objects.end ();
48
  return m_objects.end ();
49
}
49
}
50
uint32_t
50
std::size_t
51
ObjectPtrContainerValue::GetN (void) const
51
ObjectPtrContainerValue::GetN (void) const
52
{
52
{
53
  NS_LOG_FUNCTION (this);
53
  NS_LOG_FUNCTION (this);
54
  return m_objects.size ();
54
  return m_objects.size ();
55
}
55
}
56
Ptr<Object>
56
Ptr<Object>
57
ObjectPtrContainerValue::Get (uint32_t i) const
57
ObjectPtrContainerValue::Get (std::size_t i) const
58
{
58
{
59
  NS_LOG_FUNCTION (this << i);
59
  NS_LOG_FUNCTION (this << i);
60
  Iterator it = m_objects.find (i); 
60
  Iterator it = m_objects.find (i); 
 Lines 113-119    Link Here 
113
      return false;
113
      return false;
114
    }
114
    }
115
  v->m_objects.clear ();
115
  v->m_objects.clear ();
116
  uint32_t n;
116
  std::size_t n;
117
  bool ok = DoGetN (object, &n);
117
  bool ok = DoGetN (object, &n);
118
  if (!ok)
118
  if (!ok)
119
    {
119
    {
 Lines 121-127    Link Here 
121
    }
121
    }
122
  for (uint32_t i = 0; i < n; i++)
122
  for (uint32_t i = 0; i < n; i++)
123
    {
123
    {
124
      uint32_t index;
124
      std::size_t index;
125
      Ptr<Object> o = DoGet (object, i, &index);
125
      Ptr<Object> o = DoGet (object, i, &index);
126
      v->m_objects.insert (std::pair <uint32_t, Ptr<Object> > (index, o));
126
      v->m_objects.insert (std::pair <uint32_t, Ptr<Object> > (index, o));
127
    }
127
    }
(-)a/src/core/model/object-ptr-container.h (-7 / +7 lines)
 Lines 68-81    Link Here 
68
   *
68
   *
69
   * \returns The number of objects.
69
   * \returns The number of objects.
70
   */
70
   */
71
  uint32_t GetN (void) const;
71
  std::size_t GetN (void) const;
72
  /**
72
  /**
73
   * Get a specific Object.
73
   * Get a specific Object.
74
   *
74
   *
75
   * \param [in] i The index of the requested object.
75
   * \param [in] i The index of the requested object.
76
   * \returns The requested object
76
   * \returns The requested object
77
   */
77
   */
78
  Ptr<Object> Get (uint32_t i) const;
78
  Ptr<Object> Get (std::size_t i) const;
79
79
80
  /**
80
  /**
81
   * Get a copy of this container.
81
   * Get a copy of this container.
 Lines 228-234    Link Here 
228
   * \param [out] n The number of instances in the container.
228
   * \param [out] n The number of instances in the container.
229
   * \returns true if the value could be obtained successfully.
229
   * \returns true if the value could be obtained successfully.
230
   */
230
   */
231
  virtual bool DoGetN (const ObjectBase *object, uint32_t *n) const = 0;
231
  virtual bool DoGetN (const ObjectBase *object, std::size_t *n) const = 0;
232
  /**
232
  /**
233
   * Get an instance from the container, identified by index.
233
   * Get an instance from the container, identified by index.
234
   *
234
   *
 Lines 237-243    Link Here 
237
   * \param [out] index The index retrieved.
237
   * \param [out] index The index retrieved.
238
   * \returns The index requested.
238
   * \returns The index requested.
239
   */
239
   */
240
  virtual Ptr<Object> DoGet (const ObjectBase *object, uint32_t i, uint32_t *index) const = 0;
240
  virtual Ptr<Object> DoGet (const ObjectBase *object, std::size_t i, std::size_t *index) const = 0;
241
};
241
};
242
242
243
template <typename T, typename U, typename INDEX>
243
template <typename T, typename U, typename INDEX>
 Lines 247-262    Link Here 
247
{
247
{
248
  struct MemberGetters : public ObjectPtrContainerAccessor
248
  struct MemberGetters : public ObjectPtrContainerAccessor
249
  {
249
  {
250
    virtual bool DoGetN (const ObjectBase *object, uint32_t *n) const {
250
    virtual bool DoGetN (const ObjectBase *object, std::size_t *n) const {
251
      const T *obj = dynamic_cast<const T *> (object);
251
      const T *obj = dynamic_cast<const T *> (object);
252
      if (obj == 0)
252
      if (obj == 0)
253
        {
253
        {
254
          return false;
254
          return false;
255
        }
255
        }
256
      *n = (obj->*m_getN)();
256
      *n = static_cast<std::size_t> ((obj->*m_getN)());
257
      return true;
257
      return true;
258
    }
258
    }
259
    virtual Ptr<Object> DoGet (const ObjectBase *object, uint32_t i, uint32_t *index) const {
259
    virtual Ptr<Object> DoGet (const ObjectBase *object, std::size_t i, std::size_t *index) const {
260
      const T *obj = static_cast<const T *> (object);
260
      const T *obj = static_cast<const T *> (object);
261
      *index = i;
261
      *index = i;
262
      return (obj->*m_get)(i);
262
      return (obj->*m_get)(i);
(-)a/src/core/model/object-vector.h (-3 / +3 lines)
 Lines 82-88    Link Here 
82
{
82
{
83
  struct MemberStdContainer : public ObjectPtrContainerAccessor
83
  struct MemberStdContainer : public ObjectPtrContainerAccessor
84
  {
84
  {
85
    virtual bool DoGetN (const ObjectBase *object, uint32_t *n) const {
85
    virtual bool DoGetN (const ObjectBase *object, std::size_t *n) const {
86
      const T *obj = dynamic_cast<const T *> (object);
86
      const T *obj = dynamic_cast<const T *> (object);
87
      if (obj == 0)
87
      if (obj == 0)
88
        {
88
        {
 Lines 91-101    Link Here 
91
      *n = (obj->*m_memberVector).size ();
91
      *n = (obj->*m_memberVector).size ();
92
      return true;
92
      return true;
93
    }
93
    }
94
    virtual Ptr<Object> DoGet (const ObjectBase *object, uint32_t i, uint32_t *index) const {
94
    virtual Ptr<Object> DoGet (const ObjectBase *object, std::size_t i, std::size_t *index) const {
95
      const T *obj = static_cast<const T *> (object);
95
      const T *obj = static_cast<const T *> (object);
96
      typename U::const_iterator begin = (obj->*m_memberVector).begin ();
96
      typename U::const_iterator begin = (obj->*m_memberVector).begin ();
97
      typename U::const_iterator end = (obj->*m_memberVector).end ();
97
      typename U::const_iterator end = (obj->*m_memberVector).end ();
98
      uint32_t k = 0;
98
      std::size_t k = 0;
99
      for (typename U::const_iterator j = begin; j != end; j++, k++)
99
      for (typename U::const_iterator j = begin; j != end; j++, k++)
100
        {
100
        {
101
          if (k == i)
101
          if (k == i)
(-)a/src/core/model/random-variable-stream.cc (-2 / +2 lines)
 Lines 1488-1494    Link Here 
1488
}
1488
}
1489
1489
1490
void
1490
void
1491
DeterministicRandomVariable::SetValueArray (double* values, uint64_t length)
1491
DeterministicRandomVariable::SetValueArray (double* values, std::size_t length)
1492
{
1492
{
1493
  NS_LOG_FUNCTION (this << values << length);
1493
  NS_LOG_FUNCTION (this << values << length);
1494
  // Delete any values currently set.
1494
  // Delete any values currently set.
 Lines 1503-1509    Link Here 
1503
  m_next = length;
1503
  m_next = length;
1504
1504
1505
  // Copy the values.
1505
  // Copy the values.
1506
  for (uint64_t i = 0; i < m_count; i++)
1506
  for (std::size_t i = 0; i < m_count; i++)
1507
    {
1507
    {
1508
      m_data[i] = values[i];
1508
      m_data[i] = values[i];
1509
    }
1509
    }
(-)a/src/core/model/random-variable-stream.h (-4 / +4 lines)
 Lines 2381-2387    Link Here 
2381
   * Note that the values in the array are copied and stored
2381
   * Note that the values in the array are copied and stored
2382
   * (deep-copy).
2382
   * (deep-copy).
2383
   */
2383
   */
2384
  void SetValueArray (double* values, uint64_t length);
2384
  void SetValueArray (double* values, std::size_t length);
2385
2385
2386
  /**
2386
  /**
2387
   * \brief Returns the next value in the sequence.
2387
   * \brief Returns the next value in the sequence.
 Lines 2396-2406    Link Here 
2396
  virtual uint32_t GetInteger (void);
2396
  virtual uint32_t GetInteger (void);
2397
2397
2398
private:
2398
private:
2399
  /** Position in the array of values. */
2399
  /** Size of the array of values. */
2400
  uint64_t   m_count;
2400
  std::size_t   m_count;
2401
2401
2402
  /** Position of the next value in the array of values. */
2402
  /** Position of the next value in the array of values. */
2403
  uint64_t   m_next;
2403
  std::size_t   m_next;
2404
2404
2405
  /** Array of values to return in sequence. */
2405
  /** Array of values to return in sequence. */
2406
  double* m_data;
2406
  double* m_data;
(-)a/src/core/model/realtime-simulator-impl.cc (-2 / +2 lines)
 Lines 373-379    Link Here 
373
            tsJitter = m_currentTs - tsFinal;
373
            tsJitter = m_currentTs - tsFinal;
374
          }
374
          }
375
375
376
        if (tsJitter > static_cast<uint64_t>(m_hardLimit.GetTimeStep ()))
376
        if (tsJitter > static_cast<uint64_t> (m_hardLimit.GetTimeStep ()))
377
          {
377
          {
378
            NS_FATAL_ERROR ("RealtimeSimulatorImpl::ProcessOneEvent (): "
378
            NS_FATAL_ERROR ("RealtimeSimulatorImpl::ProcessOneEvent (): "
379
                            "Hard real-time limit exceeded (jitter = " << tsJitter << ")");
379
                            "Hard real-time limit exceeded (jitter = " << tsJitter << ")");
 Lines 433-439    Link Here 
433
  m_synchronizer->SetOrigin (m_currentTs);
433
  m_synchronizer->SetOrigin (m_currentTs);
434
434
435
  // Sleep until signalled
435
  // Sleep until signalled
436
  uint64_t tsNow;
436
  uint64_t tsNow = 0;
437
  uint64_t tsDelay = 1000000000; // wait time of 1 second (in nanoseconds)
437
  uint64_t tsDelay = 1000000000; // wait time of 1 second (in nanoseconds)
438
 
438
 
439
  while (!m_stop) 
439
  while (!m_stop) 
(-)a/src/core/model/rng-seed-manager.cc (-11 / +11 lines)
 Lines 20-26    Link Here 
20
#include "rng-seed-manager.h"
20
#include "rng-seed-manager.h"
21
#include "global-value.h"
21
#include "global-value.h"
22
#include "attribute-helper.h"
22
#include "attribute-helper.h"
23
#include "integer.h"
23
#include "uinteger.h"
24
#include "config.h"
24
#include "config.h"
25
#include "log.h"
25
#include "log.h"
26
26
 Lines 51-58    Link Here 
51
 */
51
 */
52
static ns3::GlobalValue g_rngSeed ("RngSeed", 
52
static ns3::GlobalValue g_rngSeed ("RngSeed", 
53
                                   "The global seed of all rng streams",
53
                                   "The global seed of all rng streams",
54
                                   ns3::IntegerValue(1),
54
                                   ns3::UintegerValue(1),
55
                                   ns3::MakeIntegerChecker<uint32_t> ());
55
                                   ns3::MakeUintegerChecker<uint32_t> ());
56
/**
56
/**
57
 * \relates RngSeedManager
57
 * \relates RngSeedManager
58
 * The random number generator substream index.  This is used to generate
58
 * The random number generator substream index.  This is used to generate
 Lines 64-99    Link Here 
64
 */
64
 */
65
static ns3::GlobalValue g_rngRun ("RngRun", 
65
static ns3::GlobalValue g_rngRun ("RngRun", 
66
                                  "The substream index used for all streams",
66
                                  "The substream index used for all streams",
67
                                  ns3::IntegerValue (1),
67
                                  ns3::UintegerValue (1),
68
                                  ns3::MakeIntegerChecker<int64_t> ());
68
                                  ns3::MakeUintegerChecker<uint64_t> ());
69
69
70
70
71
uint32_t RngSeedManager::GetSeed (void)
71
uint32_t RngSeedManager::GetSeed (void)
72
{
72
{
73
  NS_LOG_FUNCTION_NOARGS ();
73
  NS_LOG_FUNCTION_NOARGS ();
74
  IntegerValue seedValue;
74
  UintegerValue seedValue;
75
  g_rngSeed.GetValue (seedValue);
75
  g_rngSeed.GetValue (seedValue);
76
  return seedValue.Get ();
76
  return static_cast<uint32_t> (seedValue.Get ());
77
}
77
}
78
void 
78
void 
79
RngSeedManager::SetSeed (uint32_t seed)
79
RngSeedManager::SetSeed (uint32_t seed)
80
{
80
{
81
  NS_LOG_FUNCTION (seed);
81
  NS_LOG_FUNCTION (seed);
82
  Config::SetGlobal ("RngSeed", IntegerValue(seed));
82
  Config::SetGlobal ("RngSeed", UintegerValue(seed));
83
}
83
}
84
84
85
void RngSeedManager::SetRun (uint64_t run)
85
void RngSeedManager::SetRun (uint64_t run)
86
{
86
{
87
  NS_LOG_FUNCTION (run);
87
  NS_LOG_FUNCTION (run);
88
  Config::SetGlobal ("RngRun", IntegerValue (run));
88
  Config::SetGlobal ("RngRun", UintegerValue (run));
89
}
89
}
90
90
91
uint64_t RngSeedManager::GetRun ()
91
uint64_t RngSeedManager::GetRun ()
92
{
92
{
93
  NS_LOG_FUNCTION_NOARGS ();
93
  NS_LOG_FUNCTION_NOARGS ();
94
  IntegerValue value;
94
  UintegerValue value;
95
  g_rngRun.GetValue (value);
95
  g_rngRun.GetValue (value);
96
  int run = value.Get();
96
  uint64_t run = value.Get();
97
  return run;
97
  return run;
98
}
98
}
99
99
(-)a/src/core/model/simple-ref-count.h (-1 / +5 lines)
 Lines 25-30    Link Here 
25
#include "empty.h"
25
#include "empty.h"
26
#include "default-deleter.h"
26
#include "default-deleter.h"
27
#include "assert.h"
27
#include "assert.h"
28
#include "unused.h"
28
#include <stdint.h>
29
#include <stdint.h>
29
#include <limits>
30
#include <limits>
30
31
 Lines 82-88    Link Here 
82
   */
83
   */
83
  SimpleRefCount (const SimpleRefCount &o)
84
  SimpleRefCount (const SimpleRefCount &o)
84
    : m_count (1)
85
    : m_count (1)
85
  {}
86
  {
87
    NS_UNUSED (o);
88
  }
86
  /**
89
  /**
87
   * Assignment operator
90
   * Assignment operator
88
   * \param [in] o The object to copy
91
   * \param [in] o The object to copy
 Lines 90-95    Link Here 
90
   */
93
   */
91
  SimpleRefCount &operator = (const SimpleRefCount &o)
94
  SimpleRefCount &operator = (const SimpleRefCount &o)
92
  {
95
  {
96
    NS_UNUSED (o);
93
    return *this;
97
    return *this;
94
  }
98
  }
95
  /**
99
  /**
(-)a/src/core/model/simulator.h (-2 / +8 lines)
 Lines 184-191    Link Here 
184
   */
184
   */
185
  static uint32_t GetContext (void);
185
  static uint32_t GetContext (void);
186
186
187
  /** Context enum values. */
187
  /**
188
  enum {
188
   * Context enum values.
189
   *
190
   * \internal
191
   * This enum type is fixed to match the representation size
192
   * of simulation context.
193
   */
194
  enum : uint32_t {
189
    /**
195
    /**
190
     * Flag for events not associated with any particular context.
196
     * Flag for events not associated with any particular context.
191
     */
197
     */
(-)a/src/core/model/synchronizer.cc (-2 / +2 lines)
 Lines 90-98    Link Here 
90
90
91
  if (tDrift < 0) 
91
  if (tDrift < 0) 
92
    {
92
    {
93
      return -NanosecondToTimeStep (-tDrift);
93
      return -static_cast<int64_t> (NanosecondToTimeStep (-tDrift));
94
    } else {
94
    } else {
95
      return NanosecondToTimeStep (tDrift);
95
      return static_cast<int64_t> (NanosecondToTimeStep (tDrift));
96
    }
96
    }
97
}
97
}
98
98
(-)a/src/core/model/system-path.cc (-2 / +2 lines)
 Lines 27-39    Link Here 
27
#include <cstring>
27
#include <cstring>
28
28
29
29
30
#if defined (HAVE_DIRENT_H) and defined (HAVE_SYS_TYPES_H)
30
#if defined (HAVE_DIRENT_H) && defined (HAVE_SYS_TYPES_H)
31
/** Do we have an \c opendir function? */
31
/** Do we have an \c opendir function? */
32
#define HAVE_OPENDIR
32
#define HAVE_OPENDIR
33
#include <sys/types.h>
33
#include <sys/types.h>
34
#include <dirent.h>
34
#include <dirent.h>
35
#endif
35
#endif
36
#if defined (HAVE_SYS_STAT_H) and defined (HAVE_SYS_TYPES_H)
36
#if defined (HAVE_SYS_STAT_H) && defined (HAVE_SYS_TYPES_H)
37
/** Do we have a \c makedir function? */
37
/** Do we have a \c makedir function? */
38
#define HAVE_MKDIR_H
38
#define HAVE_MKDIR_H
39
#include <sys/types.h>
39
#include <sys/types.h>
(-)a/src/core/model/test.h (-7 / +7 lines)
 Lines 1426-1444    Link Here 
1426
   * 
1426
   * 
1427
   * \returns The new test vector index
1427
   * \returns The new test vector index
1428
   */
1428
   */
1429
  uint32_t Add (T vector);
1429
  std::size_t Add (T vector);
1430
1430
1431
  /**
1431
  /**
1432
   * \brief Get the total number of test vectors.
1432
   * \brief Get the total number of test vectors.
1433
   * \return The number of test vectors
1433
   * \return The number of test vectors
1434
   */
1434
   */
1435
  uint32_t GetN (void) const;
1435
  std::size_t GetN (void) const;
1436
  /**
1436
  /**
1437
   * \brief Get the i'th test vector
1437
   * \brief Get the i'th test vector
1438
   * \param [in] i The requested vector index
1438
   * \param [in] i The requested vector index
1439
   * \return The requested vector
1439
   * \return The requested vector
1440
   */
1440
   */
1441
  T Get (uint32_t i) const;
1441
  T Get (std::size_t i) const;
1442
1442
1443
private:
1443
private:
1444
  typedef std::vector<T> TestVector;    //!< Container type
1444
  typedef std::vector<T> TestVector;    //!< Container type
 Lines 1464-1479    Link Here 
1464
}
1464
}
1465
1465
1466
template <typename T>
1466
template <typename T>
1467
uint32_t
1467
std::size_t
1468
TestVectors<T>::Add (T vector)
1468
TestVectors<T>::Add (T vector)
1469
{
1469
{
1470
  uint32_t index = m_vectors.size ();
1470
  std::size_t index = m_vectors.size ();
1471
  m_vectors.push_back (vector);
1471
  m_vectors.push_back (vector);
1472
  return index;
1472
  return index;
1473
}
1473
}
1474
1474
1475
template <typename T>
1475
template <typename T>
1476
uint32_t 
1476
std::size_t 
1477
TestVectors<T>::GetN (void) const
1477
TestVectors<T>::GetN (void) const
1478
{
1478
{
1479
  return m_vectors.size ();
1479
  return m_vectors.size ();
 Lines 1481-1487    Link Here 
1481
1481
1482
template <typename T>
1482
template <typename T>
1483
T
1483
T
1484
TestVectors<T>::Get (uint32_t i) const
1484
TestVectors<T>::Get (std::size_t i) const
1485
{
1485
{
1486
  NS_ABORT_MSG_UNLESS (m_vectors.size () > i, "TestVectors::Get(): Bad index");
1486
  NS_ABORT_MSG_UNLESS (m_vectors.size () > i, "TestVectors::Get(): Bad index");
1487
  return m_vectors[i];
1487
  return m_vectors[i];
(-)a/src/core/model/type-id.cc (-30 / +30 lines)
 Lines 171-177    Link Here 
171
   * Get the total number of type ids.
171
   * Get the total number of type ids.
172
   * \returns The total number.
172
   * \returns The total number.
173
   */
173
   */
174
  uint32_t GetRegisteredN (void) const;
174
  uint16_t GetRegisteredN (void) const;
175
  /**
175
  /**
176
   * Get a type id by index.
176
   * Get a type id by index.
177
   *
177
   *
 Lines 181-187    Link Here 
181
   * \param [in] i The index.
181
   * \param [in] i The index.
182
   * \returns The type id.
182
   * \returns The type id.
183
   */
183
   */
184
  uint16_t GetRegistered (uint32_t i) const;
184
  uint16_t GetRegistered (uint16_t i) const;
185
  /**
185
  /**
186
   * Record a new attribute in a type id.
186
   * Record a new attribute in a type id.
187
   * \param [in] uid The id.
187
   * \param [in] uid The id.
 Lines 214-234    Link Here 
214
   * \param [in] initialValue The new initial value to use for this attribute.
214
   * \param [in] initialValue The new initial value to use for this attribute.
215
   */
215
   */
216
  void SetAttributeInitialValue(uint16_t uid,
216
  void SetAttributeInitialValue(uint16_t uid,
217
                                uint32_t i,
217
                                std::size_t i,
218
                                Ptr<const AttributeValue> initialValue);
218
                                Ptr<const AttributeValue> initialValue);
219
  /**
219
  /**
220
   * Get the number of attributes.
220
   * Get the number of attributes.
221
   * \param [in] uid The id.
221
   * \param [in] uid The id.
222
   * \returns The number of attributes associated to this TypeId
222
   * \returns The number of attributes associated to this TypeId
223
   */
223
   */
224
  uint32_t GetAttributeN (uint16_t uid) const;
224
  std::size_t GetAttributeN (uint16_t uid) const;
225
  /**
225
  /**
226
   * Get Attribute information by index.
226
   * Get Attribute information by index.
227
   * \param [in] uid The id.
227
   * \param [in] uid The id.
228
   * \param [in] i Index into attribute array
228
   * \param [in] i Index into attribute array
229
   * \returns The information associated to attribute whose index is \p i.
229
   * \returns The information associated to attribute whose index is \p i.
230
   */
230
   */
231
  struct TypeId::AttributeInformation GetAttribute(uint16_t uid, uint32_t i) const;
231
  struct TypeId::AttributeInformation GetAttribute(uint16_t uid, std::size_t i) const;
232
  /**
232
  /**
233
   * Record a new TraceSource.
233
   * Record a new TraceSource.
234
   * \param [in] uid The id.
234
   * \param [in] uid The id.
 Lines 256-269    Link Here 
256
   * \param [in] uid The id.
256
   * \param [in] uid The id.
257
   * \returns The number of trace sources defined in this TypeId.
257
   * \returns The number of trace sources defined in this TypeId.
258
   */
258
   */
259
  uint32_t GetTraceSourceN (uint16_t uid) const;
259
  std::size_t GetTraceSourceN (uint16_t uid) const;
260
  /**
260
  /**
261
   * Get the trace source by index.
261
   * Get the trace source by index.
262
   * \param [in] uid The id.
262
   * \param [in] uid The id.
263
   * \param [in] i Index into trace source array.
263
   * \param [in] i Index into trace source array.
264
   * \returns Detailed information about the requested trace source.
264
   * \returns Detailed information about the requested trace source.
265
   */
265
   */
266
  struct TypeId::TraceSourceInformation GetTraceSource(uint16_t uid, uint32_t i) const;
266
  struct TypeId::TraceSourceInformation GetTraceSource(uint16_t uid, std::size_t i) const;
267
  /**
267
  /**
268
   * Check if this TypeId should not be listed in documentation.
268
   * Check if this TypeId should not be listed in documentation.
269
   * \param [in] uid The id.
269
   * \param [in] uid The id.
 Lines 423-429    Link Here 
423
    else
423
    else
424
      { // chain old type
424
      { // chain old type
425
        NS_LOG_LOGIC (IIDL << "Old TypeId '" << hinfo->name << "' getting chained.");
425
        NS_LOG_LOGIC (IIDL << "Old TypeId '" << hinfo->name << "' getting chained.");
426
        uint32_t oldUid = GetUid (hinfo->hash);
426
        uint16_t oldUid = GetUid (hinfo->hash);
427
        m_hashmap.erase (m_hashmap.find (hinfo->hash));
427
        m_hashmap.erase (m_hashmap.find (hinfo->hash));
428
        hinfo->hash = hash | HashChainFlag;
428
        hinfo->hash = hash | HashChainFlag;
429
        m_hashmap.insert (std::make_pair (hinfo->hash, oldUid));
429
        m_hashmap.insert (std::make_pair (hinfo->hash, oldUid));
 Lines 440-446    Link Here 
440
  information.hasConstructor = false;
440
  information.hasConstructor = false;
441
  information.mustHideFromDocumentation = false;
441
  information.mustHideFromDocumentation = false;
442
  m_information.push_back (information);
442
  m_information.push_back (information);
443
  uint32_t uid = m_information.size ();
443
  uint16_t uid = static_cast<uint16_t> (m_information.size ());
444
  NS_ASSERT (uid <= 0xffff);
444
  NS_ASSERT (uid <= 0xffff);
445
445
446
  // Add to both maps:
446
  // Add to both maps:
 Lines 594-607    Link Here 
594
  return hasC;
594
  return hasC;
595
}
595
}
596
596
597
uint32_t 
597
uint16_t
598
IidManager::GetRegisteredN (void) const
598
IidManager::GetRegisteredN (void) const
599
{
599
{
600
  NS_LOG_FUNCTION (IID << m_information.size ());
600
  NS_LOG_FUNCTION (IID << m_information.size ());
601
  return m_information.size ();
601
  return static_cast<uint16_t> (m_information.size ());
602
}
602
}
603
uint16_t 
603
uint16_t 
604
IidManager::GetRegistered (uint32_t i) const
604
IidManager::GetRegistered (uint16_t i) const
605
{
605
{
606
  NS_LOG_FUNCTION (IID << i);
606
  NS_LOG_FUNCTION (IID << i);
607
  return i + 1;
607
  return i + 1;
 Lines 679-685    Link Here 
679
}
679
}
680
void 
680
void 
681
IidManager::SetAttributeInitialValue(uint16_t uid,
681
IidManager::SetAttributeInitialValue(uint16_t uid,
682
                                     uint32_t i,
682
                                     std::size_t i,
683
                                     Ptr<const AttributeValue> initialValue)
683
                                     Ptr<const AttributeValue> initialValue)
684
{
684
{
685
  NS_LOG_FUNCTION (IID << uid << i << initialValue);
685
  NS_LOG_FUNCTION (IID << uid << i << initialValue);
 Lines 690-706    Link Here 
690
690
691
691
692
692
693
uint32_t 
693
std::size_t 
694
IidManager::GetAttributeN (uint16_t uid) const
694
IidManager::GetAttributeN (uint16_t uid) const
695
{
695
{
696
  NS_LOG_FUNCTION (IID << uid);
696
  NS_LOG_FUNCTION (IID << uid);
697
  struct IidInformation *information = LookupInformation (uid);
697
  struct IidInformation *information = LookupInformation (uid);
698
  uint32_t size = information->attributes.size ();
698
  std::size_t size = information->attributes.size ();
699
  NS_LOG_LOGIC (IIDL << size);
699
  NS_LOG_LOGIC (IIDL << size);
700
  return size;
700
  return size;
701
}
701
}
702
struct TypeId::AttributeInformation 
702
struct TypeId::AttributeInformation 
703
IidManager::GetAttribute(uint16_t uid, uint32_t i) const
703
IidManager::GetAttribute(uint16_t uid, std::size_t i) const
704
{
704
{
705
  NS_LOG_FUNCTION (IID << uid << i);
705
  NS_LOG_FUNCTION (IID << uid << i);
706
  struct IidInformation *information = LookupInformation (uid);
706
  struct IidInformation *information = LookupInformation (uid);
 Lines 768-784    Link Here 
768
  information->traceSources.push_back (source);
768
  information->traceSources.push_back (source);
769
  NS_LOG_LOGIC (IIDL << information->traceSources.size () - 1);
769
  NS_LOG_LOGIC (IIDL << information->traceSources.size () - 1);
770
}
770
}
771
uint32_t 
771
std::size_t 
772
IidManager::GetTraceSourceN (uint16_t uid) const
772
IidManager::GetTraceSourceN (uint16_t uid) const
773
{
773
{
774
  NS_LOG_FUNCTION (IID << uid);
774
  NS_LOG_FUNCTION (IID << uid);
775
  struct IidInformation *information = LookupInformation (uid);
775
  struct IidInformation *information = LookupInformation (uid);
776
  uint32_t size = information->traceSources.size ();
776
  std::size_t size = information->traceSources.size ();
777
  NS_LOG_LOGIC (IIDL << size);
777
  NS_LOG_LOGIC (IIDL << size);
778
  return size;
778
  return size;
779
}
779
}
780
struct TypeId::TraceSourceInformation 
780
struct TypeId::TraceSourceInformation 
781
IidManager::GetTraceSource(uint16_t uid, uint32_t i) const
781
IidManager::GetTraceSource(uint16_t uid, std::size_t i) const
782
{
782
{
783
  NS_LOG_FUNCTION (IID << uid << i);
783
  NS_LOG_FUNCTION (IID << uid << i);
784
  struct IidInformation *information = LookupInformation (uid);
784
  struct IidInformation *information = LookupInformation (uid);
 Lines 859-872    Link Here 
859
  return true;
859
  return true;
860
}
860
}
861
861
862
uint32_t 
862
uint16_t 
863
TypeId::GetRegisteredN (void)
863
TypeId::GetRegisteredN (void)
864
{
864
{
865
  NS_LOG_FUNCTION_NOARGS ();
865
  NS_LOG_FUNCTION_NOARGS ();
866
  return IidManager::Get ()->GetRegisteredN ();
866
  return IidManager::Get ()->GetRegisteredN ();
867
}
867
}
868
TypeId 
868
TypeId 
869
TypeId::GetRegistered (uint32_t i)
869
TypeId::GetRegistered (uint16_t i)
870
{
870
{
871
  NS_LOG_FUNCTION (i);
871
  NS_LOG_FUNCTION (i);
872
  return TypeId (IidManager::Get ()->GetRegistered (i));
872
  return TypeId (IidManager::Get ()->GetRegistered (i));
 Lines 880-886    Link Here 
880
  TypeId nextTid = *this;
880
  TypeId nextTid = *this;
881
  do {
881
  do {
882
      tid = nextTid;
882
      tid = nextTid;
883
      for (uint32_t i = 0; i < tid.GetAttributeN (); i++)
883
      for (std::size_t i = 0; i < tid.GetAttributeN (); i++)
884
        {
884
        {
885
          struct TypeId::AttributeInformation tmp = tid.GetAttribute(i);
885
          struct TypeId::AttributeInformation tmp = tid.GetAttribute(i);
886
          if (tmp.name == name)
886
          if (tmp.name == name)
 Lines 1039-1045    Link Here 
1039
}
1039
}
1040
1040
1041
bool 
1041
bool 
1042
TypeId::SetAttributeInitialValue(uint32_t i, 
1042
TypeId::SetAttributeInitialValue(std::size_t i, 
1043
                                 Ptr<const AttributeValue> initialValue)
1043
                                 Ptr<const AttributeValue> initialValue)
1044
{
1044
{
1045
  NS_LOG_FUNCTION (this << i << initialValue);
1045
  NS_LOG_FUNCTION (this << i << initialValue);
 Lines 1064-1098    Link Here 
1064
  return mustHide;
1064
  return mustHide;
1065
}
1065
}
1066
1066
1067
uint32_t 
1067
std::size_t
1068
TypeId::GetAttributeN (void) const
1068
TypeId::GetAttributeN (void) const
1069
{
1069
{
1070
  NS_LOG_FUNCTION (this);
1070
  NS_LOG_FUNCTION (this);
1071
  uint32_t n = IidManager::Get ()->GetAttributeN (m_tid);
1071
  std::size_t n = IidManager::Get ()->GetAttributeN (m_tid);
1072
  return n;
1072
  return n;
1073
}
1073
}
1074
struct TypeId::AttributeInformation 
1074
struct TypeId::AttributeInformation 
1075
TypeId::GetAttribute(uint32_t i) const
1075
TypeId::GetAttribute(std::size_t i) const
1076
{
1076
{
1077
  NS_LOG_FUNCTION (this << i);
1077
  NS_LOG_FUNCTION (this << i);
1078
  return IidManager::Get ()->GetAttribute(m_tid, i);
1078
  return IidManager::Get ()->GetAttribute(m_tid, i);
1079
}
1079
}
1080
std::string 
1080
std::string 
1081
TypeId::GetAttributeFullName (uint32_t i) const
1081
TypeId::GetAttributeFullName (std::size_t i) const
1082
{
1082
{
1083
  NS_LOG_FUNCTION (this << i);
1083
  NS_LOG_FUNCTION (this << i);
1084
  struct TypeId::AttributeInformation info = GetAttribute(i);
1084
  struct TypeId::AttributeInformation info = GetAttribute(i);
1085
  return GetName () + "::" + info.name;
1085
  return GetName () + "::" + info.name;
1086
}
1086
}
1087
1087
1088
uint32_t 
1088
std::size_t 
1089
TypeId::GetTraceSourceN (void) const
1089
TypeId::GetTraceSourceN (void) const
1090
{
1090
{
1091
  NS_LOG_FUNCTION (this);
1091
  NS_LOG_FUNCTION (this);
1092
  return IidManager::Get ()->GetTraceSourceN (m_tid);
1092
  return IidManager::Get ()->GetTraceSourceN (m_tid);
1093
}
1093
}
1094
struct TypeId::TraceSourceInformation 
1094
struct TypeId::TraceSourceInformation 
1095
TypeId::GetTraceSource(uint32_t i) const
1095
TypeId::GetTraceSource(std::size_t i) const
1096
{
1096
{
1097
  NS_LOG_FUNCTION (this << i);
1097
  NS_LOG_FUNCTION (this << i);
1098
  return IidManager::Get ()->GetTraceSource(m_tid, i);
1098
  return IidManager::Get ()->GetTraceSource(m_tid, i);
 Lines 1141-1147    Link Here 
1141
  struct TypeId::TraceSourceInformation tmp;
1141
  struct TypeId::TraceSourceInformation tmp;
1142
  do {
1142
  do {
1143
      tid = nextTid;
1143
      tid = nextTid;
1144
      for (uint32_t i = 0; i < tid.GetTraceSourceN (); i++)
1144
      for (std::size_t i = 0; i < tid.GetTraceSourceN (); i++)
1145
        {
1145
        {
1146
          tmp = tid.GetTraceSource (i);
1146
          tmp = tid.GetTraceSource (i);
1147
          if (tmp.name == name)
1147
          if (tmp.name == name)
(-)a/src/core/model/type-id.h (-8 / +8 lines)
 Lines 156-169    Link Here 
156
   *
156
   *
157
   * \returns The number of TypeId instances registered.
157
   * \returns The number of TypeId instances registered.
158
   */
158
   */
159
  static uint32_t GetRegisteredN (void);
159
  static uint16_t GetRegisteredN (void);
160
  /**
160
  /**
161
   * Get a TypeId by index.
161
   * Get a TypeId by index.
162
   *
162
   *
163
   * \param [in] i Index of the TypeId.
163
   * \param [in] i Index of the TypeId.
164
   * \returns The TypeId instance whose index is \c i.
164
   * \returns The TypeId instance whose index is \c i.
165
   */
165
   */
166
  static TypeId GetRegistered (uint32_t i);
166
  static TypeId GetRegistered (uint16_t i);
167
167
168
  /**
168
  /**
169
   * Constructor.
169
   * Constructor.
 Lines 247-267    Link Here 
247
   *
247
   *
248
   * \returns The number of attributes associated to this TypeId
248
   * \returns The number of attributes associated to this TypeId
249
   */
249
   */
250
  uint32_t GetAttributeN (void) const;
250
  std::size_t GetAttributeN (void) const;
251
  /**
251
  /**
252
   * Get Attribute information by index.
252
   * Get Attribute information by index.
253
   *
253
   *
254
   * \param [in] i Index into attribute array
254
   * \param [in] i Index into attribute array
255
   * \returns The information associated to attribute whose index is \p i.
255
   * \returns The information associated to attribute whose index is \p i.
256
   */
256
   */
257
  struct TypeId::AttributeInformation GetAttribute(uint32_t i) const;
257
  struct TypeId::AttributeInformation GetAttribute(std::size_t i) const;
258
  /**
258
  /**
259
   * Get the Attribute name by index.
259
   * Get the Attribute name by index.
260
   *
260
   *
261
   * \param [in] i Index into attribute array
261
   * \param [in] i Index into attribute array
262
   * \returns The full name associated to the attribute whose index is \p i.
262
   * \returns The full name associated to the attribute whose index is \p i.
263
   */
263
   */
264
  std::string GetAttributeFullName (uint32_t i) const;
264
  std::string GetAttributeFullName (std::size_t i) const;
265
265
266
  /**
266
  /**
267
   * Get the constructor callback.
267
   * Get the constructor callback.
 Lines 284-297    Link Here 
284
   *
284
   *
285
   * \returns The number of trace sources defined in this TypeId.
285
   * \returns The number of trace sources defined in this TypeId.
286
   */
286
   */
287
  uint32_t GetTraceSourceN (void) const;
287
  std::size_t GetTraceSourceN (void) const;
288
  /**
288
  /**
289
   * Get the trace source by index.
289
   * Get the trace source by index.
290
   *
290
   *
291
   * \param [in] i Index into trace source array.
291
   * \param [in] i Index into trace source array.
292
   * \returns Detailed information about the requested trace source.
292
   * \returns Detailed information about the requested trace source.
293
   */
293
   */
294
  struct TypeId::TraceSourceInformation GetTraceSource(uint32_t i) const;
294
  struct TypeId::TraceSourceInformation GetTraceSource(std::size_t i) const;
295
295
296
  /**
296
  /**
297
   * Set the parent TypeId.
297
   * Set the parent TypeId.
 Lines 390-396    Link Here 
390
   * \param [in] initialValue The new initial value to use for this attribute.
390
   * \param [in] initialValue The new initial value to use for this attribute.
391
   * \returns \c true if the call was successfuly.
391
   * \returns \c true if the call was successfuly.
392
   */
392
   */
393
  bool SetAttributeInitialValue(uint32_t i, 
393
  bool SetAttributeInitialValue(std::size_t i, 
394
                                Ptr<const AttributeValue> initialValue);
394
                                Ptr<const AttributeValue> initialValue);
395
395
396
  /**
396
  /**
(-)a/src/core/model/wall-clock-synchronizer.cc (-1 / +1 lines)
 Lines 391-397    Link Here 
391
{
391
{
392
  NS_LOG_FUNCTION (this << ns << tv);
392
  NS_LOG_FUNCTION (this << ns << tv);
393
  NS_ASSERT ((ns % US_PER_NS) == 0);
393
  NS_ASSERT ((ns % US_PER_NS) == 0);
394
  tv->tv_sec = ns / NS_PER_SEC;
394
  tv->tv_sec = static_cast<long> (ns / NS_PER_SEC);
395
  tv->tv_usec = (ns % NS_PER_SEC) / US_PER_NS;
395
  tv->tv_usec = (ns % NS_PER_SEC) / US_PER_NS;
396
}
396
}
397
397
(-)a/src/core/test/attribute-test-suite.cc (-5 / +23 lines)
 Lines 62-75    Link Here 
62
62
63
bool operator != (const ValueClassTest &a, const ValueClassTest &b)
63
bool operator != (const ValueClassTest &a, const ValueClassTest &b)
64
{
64
{
65
  NS_UNUSED (a);
66
  NS_UNUSED (b);
65
  return true;
67
  return true;
66
}
68
}
67
std::ostream & operator << (std::ostream &os, ValueClassTest v)
69
std::ostream & operator << (std::ostream &os, ValueClassTest v)
68
{
70
{
71
  NS_UNUSED (v);
69
  return os;
72
  return os;
70
}
73
}
71
std::istream & operator >> (std::istream &is, ValueClassTest &v)
74
std::istream & operator >> (std::istream &is, ValueClassTest &v)
72
{
75
{
76
  NS_UNUSED (v);
73
  return is;
77
  return is;
74
}
78
}
75
79
 Lines 259-266    Link Here 
259
  bool DoGetTestB (void) const { return m_boolTestA; }
263
  bool DoGetTestB (void) const { return m_boolTestA; }
260
  int16_t DoGetInt16 (void) const { return m_int16SetGet; }
264
  int16_t DoGetInt16 (void) const { return m_int16SetGet; }
261
  void DoSetInt16 (int16_t v) { m_int16SetGet = v; }
265
  void DoSetInt16 (int16_t v) { m_int16SetGet = v; }
262
  uint32_t DoGetVectorN (void) const { return m_vector2.size (); }
266
  std::size_t DoGetVectorN (void) const { return m_vector2.size (); }
263
  Ptr<Derived> DoGetVector (uint32_t i) const { return m_vector2[i]; }
267
  Ptr<Derived> DoGetVector (std::size_t i) const { return m_vector2[i]; }
264
  bool DoSetIntSrc (int8_t v) { m_intSrc2 = v; return true; }
268
  bool DoSetIntSrc (int8_t v) { m_intSrc2 = v; return true; }
265
  int8_t DoGetIntSrc (void) const { return m_intSrc2; }
269
  int8_t DoGetIntSrc (void) const { return m_intSrc2; }
266
  bool DoSetEnum (Test_e v) { m_enumSetGet = v; return true; }
270
  bool DoSetEnum (Test_e v) { m_enumSetGet = v; return true; }
 Lines 1069-1075    Link Here 
1069
private:
1073
private:
1070
  virtual void DoRun (void);
1074
  virtual void DoRun (void);
1071
1075
1072
  void NotifySource1 (int8_t old, int8_t n) { m_got1 = n; }
1076
  void NotifySource1 (int8_t old, int8_t n)
1077
  {
1078
    NS_UNUSED (old);
1079
    m_got1 = n;
1080
  }
1073
  int64_t m_got1;
1081
  int64_t m_got1;
1074
};
1082
};
1075
1083
 Lines 1141-1147    Link Here 
1141
private:
1149
private:
1142
  virtual void DoRun (void);
1150
  virtual void DoRun (void);
1143
1151
1144
  void NotifySource2 (double a, int b, float c) { m_got2 = a; }
1152
  void NotifySource2 (double a, int b, float c)
1153
  {
1154
    NS_UNUSED (b);
1155
    NS_UNUSED (c);
1156
    m_got2 = a;
1157
  }
1145
1158
1146
  double m_got2;
1159
  double m_got2;
1147
};
1160
};
 Lines 1215-1221    Link Here 
1215
private:
1228
private:
1216
  virtual void DoRun (void);
1229
  virtual void DoRun (void);
1217
1230
1218
  void NotifySource2 (double a, int b, float c) { m_got2 = a; }
1231
  void NotifySource2 (double a, int b, float c)
1232
  {
1233
    NS_UNUSED (b);
1234
    NS_UNUSED (c);
1235
    m_got2 = a;
1236
  }
1219
1237
1220
  double m_got2;
1238
  double m_got2;
1221
};
1239
};
(-)a/src/core/test/callback-test-suite.cc (-4 / +25 lines)
 Lines 18-23    Link Here 
18
18
19
#include "ns3/test.h"
19
#include "ns3/test.h"
20
#include "ns3/callback.h"
20
#include "ns3/callback.h"
21
#include "ns3/unused.h"
21
#include <stdint.h>
22
#include <stdint.h>
22
23
23
using namespace ns3;
24
using namespace ns3;
 Lines 33-40    Link Here 
33
34
34
  void Target1 (void) { m_test1 = true; }
35
  void Target1 (void) { m_test1 = true; }
35
  int Target2 (void) { m_test2 = true; return 2; }
36
  int Target2 (void) { m_test2 = true; return 2; }
36
  void Target3 (double a) { m_test3 = true; }
37
  void Target3 (double a)
37
  int Target4 (double a, int b) { m_test4 = true; return 4; }
38
  {
39
    NS_UNUSED (a);
40
    m_test3 = true;
41
  }
42
  int Target4 (double a, int b)
43
  {
44
    NS_UNUSED (a);
45
    NS_UNUSED (b);
46
    m_test4 = true;
47
    return 4;
48
  }
38
49
39
private:
50
private:
40
  virtual void DoRun (void);
51
  virtual void DoRun (void);
 Lines 163-170    Link Here 
163
174
164
  void Target1 (void) { m_test1 = true; }
175
  void Target1 (void) { m_test1 = true; }
165
  int Target2 (void) { m_test2 = true; return 2; }
176
  int Target2 (void) { m_test2 = true; return 2; }
166
  void Target3 (double a) { m_test3 = true; }
177
  void Target3 (double a)
167
  int Target4 (double a, int b) { m_test4 = true; return 4; }
178
  {
179
    NS_UNUSED (a);
180
    m_test3 = true;
181
  }
182
  int Target4 (double a, int b)
183
  {
184
    NS_UNUSED (a);
185
    NS_UNUSED (b);
186
    m_test4 = true;
187
    return 4;
188
  }
168
189
169
private:
190
private:
170
  virtual void DoRun (void);
191
  virtual void DoRun (void);
(-)a/src/core/test/config-test-suite.cc (-2 / +11 lines)
 Lines 30-35    Link Here 
30
#include "ns3/names.h"
30
#include "ns3/names.h"
31
#include "ns3/pointer.h"
31
#include "ns3/pointer.h"
32
#include "ns3/log.h"
32
#include "ns3/log.h"
33
#include "ns3/unused.h"
33
34
34
35
35
#include <sstream>
36
#include <sstream>
 Lines 621-627    Link Here 
621
   * \param oldValue The old value.
622
   * \param oldValue The old value.
622
   * \param newValue The new value.
623
   * \param newValue The new value.
623
   */
624
   */
624
  void Trace (int16_t oldValue, int16_t newValue) { m_newValue = newValue; }
625
  void Trace (int16_t oldValue, int16_t newValue)
626
  {
627
    NS_UNUSED (oldValue);
628
    m_newValue = newValue;
629
  }
625
  /**
630
  /**
626
   * Trace callback with context path.
631
   * Trace callback with context path.
627
   * \param path The context path.
632
   * \param path The context path.
 Lines 629-635    Link Here 
629
   * \param newValue The new value.
634
   * \param newValue The new value.
630
   */
635
   */
631
  void TraceWithPath (std::string path, int16_t old, int16_t newValue)
636
  void TraceWithPath (std::string path, int16_t old, int16_t newValue)
632
  { m_newValue = newValue; m_path = path; }
637
  {
638
    NS_UNUSED (old);
639
    m_newValue = newValue;
640
    m_path = path;
641
  }
633
642
634
private:
643
private:
635
  virtual void DoRun (void);
644
  virtual void DoRun (void);
(-)a/src/core/test/int64x64-test-suite.cc (-4 / +4 lines)
 Lines 171-177    Link Here 
171
  if (int64x64_t::implementation == int64x64_t::ld_impl)
171
  if (int64x64_t::implementation == int64x64_t::ld_impl)
172
    {
172
    {
173
      // Darwin 12.5.0 (Mac 10.8.5) g++ 4.2.1
173
      // Darwin 12.5.0 (Mac 10.8.5) g++ 4.2.1
174
      low = HP_MAX_64 * std::numeric_limits<long double>::epsilon ();
174
      low = static_cast<uint64_t> (HP_MAX_64 * std::numeric_limits<long double>::epsilon ());
175
    }
175
    }
176
176
177
  Check ( 0, 0);
177
  Check ( 0, 0);
 Lines 259-265    Link Here 
259
  Check ("-1.0", -1, 0, tolerance);
259
  Check ("-1.0", -1, 0, tolerance);
260
  Check ("-1.0000", -1, 0, tolerance);
260
  Check ("-1.0000", -1, 0, tolerance);
261
  Check (" 1.000000000000000000054",  1, 1, tolerance);
261
  Check (" 1.000000000000000000054",  1, 1, tolerance);
262
  Check ("-1.000000000000000000054", -2, -1, tolerance);
262
  Check ("-1.000000000000000000054", (int64_t)-2, (uint64_t)-1, tolerance);
263
}
263
}
264
264
265
265
 Lines 1078-1088    Link Here 
1078
  std::cout << GetParent ()->GetName () << " Double: "
1078
  std::cout << GetParent ()->GetName () << " Double: "
1079
	    << "integer: " << intPart
1079
	    << "integer: " << intPart
1080
	    << std::endl;
1080
	    << std::endl;
1081
  m_last = intPart;
1081
  m_last = static_cast<long double> (intPart);
1082
  m_deltaCount = 0;
1082
  m_deltaCount = 0;
1083
1083
1084
  // Nudging the integer part eliminates deltas around 0
1084
  // Nudging the integer part eliminates deltas around 0
1085
  long double v = intPart;
1085
  long double v = static_cast<long double> (intPart);
1086
  
1086
  
1087
  Check (v +0.0000000000000000000542L, intPart,                0x1ULL);
1087
  Check (v +0.0000000000000000000542L, intPart,                0x1ULL);
1088
  Check (v +0.0000000000000000001084L, intPart,                0x2ULL);
1088
  Check (v +0.0000000000000000001084L, intPart,                0x2ULL);
(-)a/src/core/test/random-variable-stream-test-suite.cc (-4 / +8 lines)
 Lines 2603-2609    Link Here 
2603
  // There are no simple analytic forms for the Riemann zeta function,
2603
  // There are no simple analytic forms for the Riemann zeta function,
2604
  // which is why the gsl library is used in this test to calculate
2604
  // which is why the gsl library is used in this test to calculate
2605
  // the known mean of the values.
2605
  // the known mean of the values.
2606
  double expectedMean = gsl_sf_zeta_int (alpha - 1) / gsl_sf_zeta_int (alpha);
2606
  double expectedMean =
2607
    gsl_sf_zeta_int (static_cast<int> (alpha - 1)) /
2608
    gsl_sf_zeta_int (static_cast<int> (alpha)        );
2607
2609
2608
  // Test that values have approximately the right mean value.
2610
  // Test that values have approximately the right mean value.
2609
  double TOLERANCE = expectedMean * 1e-2;
2611
  double TOLERANCE = expectedMean * 1e-2;
 Lines 2670-2676    Link Here 
2670
  // There are no simple analytic forms for the Riemann zeta function,
2672
  // There are no simple analytic forms for the Riemann zeta function,
2671
  // which is why the gsl library is used in this test to calculate
2673
  // which is why the gsl library is used in this test to calculate
2672
  // the known mean of the values.
2674
  // the known mean of the values.
2673
  double expectedMean = gsl_sf_zeta_int (alpha - 1) / gsl_sf_zeta_int (alpha);
2675
  double expectedMean =
2676
    gsl_sf_zeta_int (static_cast<int> (alpha) - 1) /
2677
    gsl_sf_zeta_int (static_cast<int> (alpha)         );
2674
2678
2675
  // Test that values have approximately the right mean value.
2679
  // Test that values have approximately the right mean value.
2676
  double TOLERANCE = expectedMean * 1e-2;
2680
  double TOLERANCE = expectedMean * 1e-2;
 Lines 2715-2721    Link Here 
2715
  //    4, 4, 7, 7, 10, 10 .
2719
  //    4, 4, 7, 7, 10, 10 .
2716
  //
2720
  //
2717
  double array1 [] = { 4, 4, 7, 7, 10, 10};
2721
  double array1 [] = { 4, 4, 7, 7, 10, 10};
2718
  uint64_t count1 = 6;
2722
  std::size_t count1 = 6;
2719
  s->SetValueArray (array1, count1);
2723
  s->SetValueArray (array1, count1);
2720
2724
2721
  double value;
2725
  double value;
 Lines 2739-2745    Link Here 
2739
  //    1000, 2000, 7, 7 .
2743
  //    1000, 2000, 7, 7 .
2740
  //
2744
  //
2741
  double array2 [] = { 1000, 2000, 3000, 4000};
2745
  double array2 [] = { 1000, 2000, 3000, 4000};
2742
  uint64_t count2 = 4;
2746
  std::size_t count2 = 4;
2743
  s->SetValueArray (array2, count2);
2747
  s->SetValueArray (array2, count2);
2744
2748
2745
  // Test that the second sequence is correct.
2749
  // Test that the second sequence is correct.
(-)a/src/core/test/simulator-test-suite.cc (+2 lines)
 Lines 64-69    Link Here 
64
void
64
void
65
SimulatorEventsTestCase::EventA (int a)
65
SimulatorEventsTestCase::EventA (int a)
66
{
66
{
67
  NS_UNUSED (a);
67
  m_a = false;
68
  m_a = false;
68
}
69
}
69
70
 Lines 85-90    Link Here 
85
void
86
void
86
SimulatorEventsTestCase::EventC (int c)
87
SimulatorEventsTestCase::EventC (int c)
87
{
88
{
89
  NS_UNUSED (c);
88
  m_c = false;
90
  m_c = false;
89
}
91
}
90
92
(-)a/src/core/test/traced-callback-test-suite.cc (+5 lines)
 Lines 18-23    Link Here 
18
18
19
#include "ns3/test.h"
19
#include "ns3/test.h"
20
#include "ns3/traced-callback.h"
20
#include "ns3/traced-callback.h"
21
#include "ns3/unused.h"
21
22
22
using namespace ns3;
23
using namespace ns3;
23
24
 Lines 45-56    Link Here 
45
void
46
void
46
BasicTracedCallbackTestCase::CbOne (uint8_t a, double b)
47
BasicTracedCallbackTestCase::CbOne (uint8_t a, double b)
47
{
48
{
49
  NS_UNUSED (a);
50
  NS_UNUSED (b);
48
  m_one = true;
51
  m_one = true;
49
}
52
}
50
53
51
void
54
void
52
BasicTracedCallbackTestCase::CbTwo (uint8_t a, double b)
55
BasicTracedCallbackTestCase::CbTwo (uint8_t a, double b)
53
{
56
{
57
  NS_UNUSED (a);
58
  NS_UNUSED (b);
54
  m_two = true;
59
  m_two = true;
55
}
60
}
56
61
(-)a/src/lte/examples/lena-intercell-interference.cc (-1 / +1 lines)
 Lines 60-66    Link Here 
60
  // determine the string tag that identifies this simulation run
60
  // determine the string tag that identifies this simulation run
61
  // this tag is then appended to all filenames
61
  // this tag is then appended to all filenames
62
62
63
  IntegerValue runValue;
63
  UintegerValue runValue;
64
  GlobalValue::GetValueByName ("RngRun", runValue);
64
  GlobalValue::GetValueByName ("RngRun", runValue);
65
65
66
  std::ostringstream tag;
66
  std::ostringstream tag;
(-)a/src/lte/examples/lena-pathloss-traces.cc (-1 / +1 lines)
 Lines 60-66    Link Here 
60
  // determine the string tag that identifies this simulation run
60
  // determine the string tag that identifies this simulation run
61
  // this tag is then appended to all filenames
61
  // this tag is then appended to all filenames
62
62
63
  IntegerValue runValue;
63
  UintegerValue runValue;
64
  GlobalValue::GetValueByName ("RngRun", runValue);
64
  GlobalValue::GetValueByName ("RngRun", runValue);
65
65
66
  std::ostringstream tag;
66
  std::ostringstream tag;
(-)a/src/lte/test/lte-test-cell-selection.cc (-1 / +1 lines)
 Lines 154-160    Link Here 
154
{
154
{
155
  NS_LOG_FUNCTION (this << GetName ());
155
  NS_LOG_FUNCTION (this << GetName ());
156
156
157
  Config::SetGlobal ("RngRun", IntegerValue (m_rngRun));
157
  Config::SetGlobal ("RngRun", UintegerValue (m_rngRun));
158
158
159
  Ptr<LteHelper> lteHelper = CreateObject<LteHelper> ();
159
  Ptr<LteHelper> lteHelper = CreateObject<LteHelper> ();
160
  lteHelper->SetAttribute ("PathlossModel",
160
  lteHelper->SetAttribute ("PathlossModel",
(-)a/src/lte/test/lte-test-phy-error-model.cc (-2 / +2 lines)
 Lines 166-172    Link Here 
166
  Config::SetDefault ("ns3::LteSpectrumPhy::CtrlErrorModelEnabled", BooleanValue (false));
166
  Config::SetDefault ("ns3::LteSpectrumPhy::CtrlErrorModelEnabled", BooleanValue (false));
167
  Config::SetDefault ("ns3::LteSpectrumPhy::DataErrorModelEnabled", BooleanValue (true));
167
  Config::SetDefault ("ns3::LteSpectrumPhy::DataErrorModelEnabled", BooleanValue (true));
168
  Config::SetDefault ("ns3::RrFfMacScheduler::HarqEnabled", BooleanValue (false));
168
  Config::SetDefault ("ns3::RrFfMacScheduler::HarqEnabled", BooleanValue (false));
169
  Config::SetGlobal ("RngRun", IntegerValue (m_rngRun));
169
  Config::SetGlobal ("RngRun", UintegerValue (m_rngRun));
170
170
171
  //Disable Uplink Power Control
171
  //Disable Uplink Power Control
172
  Config::SetDefault ("ns3::LteUePhy::EnableUplinkPowerControl", BooleanValue (false));
172
  Config::SetDefault ("ns3::LteUePhy::EnableUplinkPowerControl", BooleanValue (false));
 Lines 322-328    Link Here 
322
  Config::SetDefault ("ns3::LteSpectrumPhy::CtrlErrorModelEnabled", BooleanValue (true));
322
  Config::SetDefault ("ns3::LteSpectrumPhy::CtrlErrorModelEnabled", BooleanValue (true));
323
  Config::SetDefault ("ns3::LteSpectrumPhy::DataErrorModelEnabled", BooleanValue (false));
323
  Config::SetDefault ("ns3::LteSpectrumPhy::DataErrorModelEnabled", BooleanValue (false));
324
  Config::SetDefault ("ns3::RrFfMacScheduler::HarqEnabled", BooleanValue (false));
324
  Config::SetDefault ("ns3::RrFfMacScheduler::HarqEnabled", BooleanValue (false));
325
  Config::SetGlobal ("RngRun", IntegerValue (m_rngRun));
325
  Config::SetGlobal ("RngRun", UintegerValue (m_rngRun));
326
326
327
  //Disable Uplink Power Control
327
  //Disable Uplink Power Control
328
  Config::SetDefault ("ns3::LteUePhy::EnableUplinkPowerControl", BooleanValue (false));
328
  Config::SetDefault ("ns3::LteUePhy::EnableUplinkPowerControl", BooleanValue (false));
(-)a/src/lte/test/lte-test-rlc-am-e2e.cc (-1 / +1 lines)
 Lines 146-152    Link Here 
146
  // LogComponentEnable ("LteRlcUm", level);
146
  // LogComponentEnable ("LteRlcUm", level);
147
  // LogComponentEnable ("LteRlcAm", level);
147
  // LogComponentEnable ("LteRlcAm", level);
148
148
149
  Config::SetGlobal ("RngRun", IntegerValue (m_run));
149
  Config::SetGlobal ("RngRun", UintegerValue (m_run));
150
  Config::SetDefault ("ns3::LteRlcAm::PollRetransmitTimer", TimeValue (MilliSeconds (20)));
150
  Config::SetDefault ("ns3::LteRlcAm::PollRetransmitTimer", TimeValue (MilliSeconds (20)));
151
  Config::SetDefault ("ns3::LteRlcAm::ReorderingTimer", TimeValue (MilliSeconds (10)));
151
  Config::SetDefault ("ns3::LteRlcAm::ReorderingTimer", TimeValue (MilliSeconds (10)));
152
  Config::SetDefault ("ns3::LteRlcAm::StatusProhibitTimer", TimeValue (MilliSeconds (40)));
152
  Config::SetDefault ("ns3::LteRlcAm::StatusProhibitTimer", TimeValue (MilliSeconds (40)));
(-)a/src/lte/test/lte-test-secondary-cell-selection.cc (-1 / +1 lines)
 Lines 92-98    Link Here 
92
{
92
{
93
  NS_LOG_FUNCTION (this << GetName ());
93
  NS_LOG_FUNCTION (this << GetName ());
94
94
95
  Config::SetGlobal ("RngRun", IntegerValue (m_rngRun));
95
  Config::SetGlobal ("RngRun", UintegerValue (m_rngRun));
96
96
97
  // Create helpers.
97
  // Create helpers.
98
  auto lteHelper = CreateObject<LteHelper> ();
98
  auto lteHelper = CreateObject<LteHelper> ();

Return to bug 2726