WebRtc_Word32 -> int32_t in system_wrappers
BUG=314 Review URL: https://webrtc-codereview.appspot.com/1301004 git-svn-id: http://webrtc.googlecode.com/svn/trunk@3791 4adac7df-926f-26a2-2b94-8c16560cd09d
This commit is contained in:
parent
29758de9b6
commit
046deb9b20
@ -29,20 +29,20 @@ namespace webrtc {
|
||||
// without being careful with alignment, you should be fine.
|
||||
class Atomic32 {
|
||||
public:
|
||||
Atomic32(WebRtc_Word32 initial_value = 0);
|
||||
Atomic32(int32_t initial_value = 0);
|
||||
~Atomic32();
|
||||
|
||||
// Prefix operator!
|
||||
WebRtc_Word32 operator++();
|
||||
WebRtc_Word32 operator--();
|
||||
int32_t operator++();
|
||||
int32_t operator--();
|
||||
|
||||
WebRtc_Word32 operator+=(WebRtc_Word32 value);
|
||||
WebRtc_Word32 operator-=(WebRtc_Word32 value);
|
||||
int32_t operator+=(int32_t value);
|
||||
int32_t operator-=(int32_t value);
|
||||
|
||||
// Sets the value atomically to new_value if the value equals compare value.
|
||||
// The function returns true if the exchange happened.
|
||||
bool CompareExchange(WebRtc_Word32 new_value, WebRtc_Word32 compare_value);
|
||||
WebRtc_Word32 Value() const;
|
||||
bool CompareExchange(int32_t new_value, int32_t compare_value);
|
||||
int32_t Value() const;
|
||||
|
||||
private:
|
||||
// Disable the + and - operator since it's unclear what these operations
|
||||
@ -57,7 +57,7 @@ class Atomic32 {
|
||||
|
||||
DISALLOW_COPY_AND_ASSIGN(Atomic32);
|
||||
|
||||
WebRtc_Word32 value_;
|
||||
int32_t value_;
|
||||
};
|
||||
|
||||
} // namespace webrtc
|
||||
|
@ -17,11 +17,11 @@ namespace webrtc {
|
||||
|
||||
class CpuInfo {
|
||||
public:
|
||||
static WebRtc_UWord32 DetectNumberOfCores();
|
||||
static uint32_t DetectNumberOfCores();
|
||||
|
||||
private:
|
||||
CpuInfo() {}
|
||||
static WebRtc_UWord32 number_of_cores_;
|
||||
static uint32_t number_of_cores_;
|
||||
};
|
||||
|
||||
} // namespace webrtc
|
||||
|
@ -39,7 +39,7 @@ enum Type {
|
||||
// data_type Enum corresponding to the type of the array.
|
||||
//
|
||||
// returns 0 on success, -1 on failure.
|
||||
WebRtc_Word32 Sort(void* data, WebRtc_UWord32 num_of_elements, Type data_type);
|
||||
int32_t Sort(void* data, uint32_t num_of_elements, Type data_type);
|
||||
|
||||
// Sorts arbitrary data types. This requires an array of intrinsically typed
|
||||
// key values which will be used to sort the data array. There must be a
|
||||
@ -57,8 +57,8 @@ WebRtc_Word32 Sort(void* data, WebRtc_UWord32 num_of_elements, Type data_type);
|
||||
//
|
||||
// returns 0 on success, -1 on failure.
|
||||
//
|
||||
WebRtc_Word32 KeySort(void* data, void* key, WebRtc_UWord32 num_of_elements,
|
||||
WebRtc_UWord32 size_of_element, Type key_type);
|
||||
int32_t KeySort(void* data, void* key, uint32_t num_of_elements,
|
||||
uint32_t size_of_element, Type key_type);
|
||||
|
||||
} // namespace webrtc
|
||||
|
||||
|
@ -38,45 +38,45 @@ class TickInterval;
|
||||
class TickTime {
|
||||
public:
|
||||
TickTime();
|
||||
explicit TickTime(WebRtc_Word64 ticks);
|
||||
explicit TickTime(int64_t ticks);
|
||||
|
||||
// Current time in the tick domain.
|
||||
static TickTime Now();
|
||||
|
||||
// Now in the time domain in ms.
|
||||
static WebRtc_Word64 MillisecondTimestamp();
|
||||
static int64_t MillisecondTimestamp();
|
||||
|
||||
// Now in the time domain in us.
|
||||
static WebRtc_Word64 MicrosecondTimestamp();
|
||||
static int64_t MicrosecondTimestamp();
|
||||
|
||||
// Returns the number of ticks in the tick domain.
|
||||
WebRtc_Word64 Ticks() const;
|
||||
int64_t Ticks() const;
|
||||
|
||||
static WebRtc_Word64 MillisecondsToTicks(const WebRtc_Word64 ms);
|
||||
static int64_t MillisecondsToTicks(const int64_t ms);
|
||||
|
||||
static WebRtc_Word64 TicksToMilliseconds(const WebRtc_Word64 ticks);
|
||||
static int64_t TicksToMilliseconds(const int64_t ticks);
|
||||
|
||||
// Returns a TickTime that is ticks later than the passed TickTime.
|
||||
friend TickTime operator+(const TickTime lhs, const WebRtc_Word64 ticks);
|
||||
TickTime& operator+=(const WebRtc_Word64& ticks);
|
||||
friend TickTime operator+(const TickTime lhs, const int64_t ticks);
|
||||
TickTime& operator+=(const int64_t& ticks);
|
||||
|
||||
// Returns a TickInterval that is the difference in ticks beween rhs and lhs.
|
||||
friend TickInterval operator-(const TickTime& lhs, const TickTime& rhs);
|
||||
|
||||
// Call to engage the fake clock. This is useful for tests since relying on
|
||||
// a real clock often makes the test flaky.
|
||||
static void UseFakeClock(WebRtc_Word64 start_millisecond);
|
||||
static void UseFakeClock(int64_t start_millisecond);
|
||||
|
||||
// Advance the fake clock. Must be called after UseFakeClock.
|
||||
static void AdvanceFakeClock(WebRtc_Word64 milliseconds);
|
||||
static void AdvanceFakeClock(int64_t milliseconds);
|
||||
|
||||
private:
|
||||
static WebRtc_Word64 QueryOsForTicks();
|
||||
static int64_t QueryOsForTicks();
|
||||
|
||||
static bool use_fake_clock_;
|
||||
static WebRtc_Word64 fake_ticks_;
|
||||
static int64_t fake_ticks_;
|
||||
|
||||
WebRtc_Word64 ticks_;
|
||||
int64_t ticks_;
|
||||
};
|
||||
|
||||
// Represents a time delta in ticks.
|
||||
@ -84,8 +84,8 @@ class TickInterval {
|
||||
public:
|
||||
TickInterval();
|
||||
|
||||
WebRtc_Word64 Milliseconds() const;
|
||||
WebRtc_Word64 Microseconds() const;
|
||||
int64_t Milliseconds() const;
|
||||
int64_t Microseconds() const;
|
||||
|
||||
// Returns the sum of two TickIntervals as a TickInterval.
|
||||
friend TickInterval operator+(const TickInterval& lhs,
|
||||
@ -103,13 +103,13 @@ class TickInterval {
|
||||
friend bool operator>=(const TickInterval& lhs, const TickInterval& rhs);
|
||||
|
||||
private:
|
||||
explicit TickInterval(WebRtc_Word64 interval);
|
||||
explicit TickInterval(int64_t interval);
|
||||
|
||||
friend class TickTime;
|
||||
friend TickInterval operator-(const TickTime& lhs, const TickTime& rhs);
|
||||
|
||||
private:
|
||||
WebRtc_Word64 interval_;
|
||||
int64_t interval_;
|
||||
};
|
||||
|
||||
inline TickInterval operator+(const TickInterval& lhs,
|
||||
@ -126,7 +126,7 @@ inline TickInterval operator-(const TickTime& lhs, const TickTime& rhs) {
|
||||
return TickInterval(lhs.ticks_ - rhs.ticks_);
|
||||
}
|
||||
|
||||
inline TickTime operator+(const TickTime lhs, const WebRtc_Word64 ticks) {
|
||||
inline TickTime operator+(const TickTime lhs, const int64_t ticks) {
|
||||
TickTime time = lhs;
|
||||
time.ticks_ += ticks;
|
||||
return time;
|
||||
@ -152,7 +152,7 @@ inline TickTime::TickTime()
|
||||
: ticks_(0) {
|
||||
}
|
||||
|
||||
inline TickTime::TickTime(WebRtc_Word64 ticks)
|
||||
inline TickTime::TickTime(int64_t ticks)
|
||||
: ticks_(ticks) {
|
||||
}
|
||||
|
||||
@ -163,7 +163,7 @@ inline TickTime TickTime::Now() {
|
||||
return TickTime(QueryOsForTicks());
|
||||
}
|
||||
|
||||
inline WebRtc_Word64 TickTime::QueryOsForTicks() {
|
||||
inline int64_t TickTime::QueryOsForTicks() {
|
||||
TickTime result;
|
||||
#if _WIN32
|
||||
// TODO(wu): Remove QueryPerformanceCounter implementation.
|
||||
@ -178,7 +178,7 @@ inline WebRtc_Word64 TickTime::QueryOsForTicks() {
|
||||
result.ticks_ = qpcnt.QuadPart;
|
||||
#else
|
||||
static volatile LONG last_time_get_time = 0;
|
||||
static volatile WebRtc_Word64 num_wrap_time_get_time = 0;
|
||||
static volatile int64_t num_wrap_time_get_time = 0;
|
||||
volatile LONG* last_time_get_time_ptr = &last_time_get_time;
|
||||
DWORD now = timeGetTime();
|
||||
// Atomically update the last gotten time
|
||||
@ -202,8 +202,8 @@ inline WebRtc_Word64 TickTime::QueryOsForTicks() {
|
||||
#else
|
||||
clock_gettime(CLOCK_MONOTONIC, &ts);
|
||||
#endif
|
||||
result.ticks_ = 1000000000LL * static_cast<WebRtc_Word64>(ts.tv_sec) +
|
||||
static_cast<WebRtc_Word64>(ts.tv_nsec);
|
||||
result.ticks_ = 1000000000LL * static_cast<int64_t>(ts.tv_sec) +
|
||||
static_cast<int64_t>(ts.tv_nsec);
|
||||
#elif defined(WEBRTC_MAC)
|
||||
static mach_timebase_info_data_t timebase;
|
||||
if (timebase.denom == 0) {
|
||||
@ -225,14 +225,14 @@ inline WebRtc_Word64 TickTime::QueryOsForTicks() {
|
||||
#else
|
||||
struct timeval tv;
|
||||
gettimeofday(&tv, NULL);
|
||||
result.ticks_ = 1000000LL * static_cast<WebRtc_Word64>(tv.tv_sec) +
|
||||
static_cast<WebRtc_Word64>(tv.tv_usec);
|
||||
result.ticks_ = 1000000LL * static_cast<int64_t>(tv.tv_sec) +
|
||||
static_cast<int64_t>(tv.tv_usec);
|
||||
#endif
|
||||
return result.ticks_;
|
||||
}
|
||||
|
||||
inline WebRtc_Word64 TickTime::MillisecondTimestamp() {
|
||||
WebRtc_Word64 ticks = TickTime::Now().Ticks();
|
||||
inline int64_t TickTime::MillisecondTimestamp() {
|
||||
int64_t ticks = TickTime::Now().Ticks();
|
||||
#if _WIN32
|
||||
#ifdef USE_QUERY_PERFORMANCE_COUNTER
|
||||
LARGE_INTEGER qpfreq;
|
||||
@ -248,8 +248,8 @@ inline WebRtc_Word64 TickTime::MillisecondTimestamp() {
|
||||
#endif
|
||||
}
|
||||
|
||||
inline WebRtc_Word64 TickTime::MicrosecondTimestamp() {
|
||||
WebRtc_Word64 ticks = TickTime::Now().Ticks();
|
||||
inline int64_t TickTime::MicrosecondTimestamp() {
|
||||
int64_t ticks = TickTime::Now().Ticks();
|
||||
#if _WIN32
|
||||
#ifdef USE_QUERY_PERFORMANCE_COUNTER
|
||||
LARGE_INTEGER qpfreq;
|
||||
@ -265,11 +265,11 @@ inline WebRtc_Word64 TickTime::MicrosecondTimestamp() {
|
||||
#endif
|
||||
}
|
||||
|
||||
inline WebRtc_Word64 TickTime::Ticks() const {
|
||||
inline int64_t TickTime::Ticks() const {
|
||||
return ticks_;
|
||||
}
|
||||
|
||||
inline WebRtc_Word64 TickTime::MillisecondsToTicks(const WebRtc_Word64 ms) {
|
||||
inline int64_t TickTime::MillisecondsToTicks(const int64_t ms) {
|
||||
#if _WIN32
|
||||
#ifdef USE_QUERY_PERFORMANCE_COUNTER
|
||||
LARGE_INTEGER qpfreq;
|
||||
@ -285,7 +285,7 @@ inline WebRtc_Word64 TickTime::MillisecondsToTicks(const WebRtc_Word64 ms) {
|
||||
#endif
|
||||
}
|
||||
|
||||
inline WebRtc_Word64 TickTime::TicksToMilliseconds(const WebRtc_Word64 ticks) {
|
||||
inline int64_t TickTime::TicksToMilliseconds(const int64_t ticks) {
|
||||
#if _WIN32
|
||||
#ifdef USE_QUERY_PERFORMANCE_COUNTER
|
||||
LARGE_INTEGER qpfreq;
|
||||
@ -301,7 +301,7 @@ inline WebRtc_Word64 TickTime::TicksToMilliseconds(const WebRtc_Word64 ticks) {
|
||||
#endif
|
||||
}
|
||||
|
||||
inline TickTime& TickTime::operator+=(const WebRtc_Word64& ticks) {
|
||||
inline TickTime& TickTime::operator+=(const int64_t& ticks) {
|
||||
ticks_ += ticks;
|
||||
return *this;
|
||||
}
|
||||
@ -309,11 +309,11 @@ inline TickTime& TickTime::operator+=(const WebRtc_Word64& ticks) {
|
||||
inline TickInterval::TickInterval() : interval_(0) {
|
||||
}
|
||||
|
||||
inline TickInterval::TickInterval(const WebRtc_Word64 interval)
|
||||
inline TickInterval::TickInterval(const int64_t interval)
|
||||
: interval_(interval) {
|
||||
}
|
||||
|
||||
inline WebRtc_Word64 TickInterval::Milliseconds() const {
|
||||
inline int64_t TickInterval::Milliseconds() const {
|
||||
#if _WIN32
|
||||
#ifdef USE_QUERY_PERFORMANCE_COUNTER
|
||||
LARGE_INTEGER qpfreq;
|
||||
@ -332,7 +332,7 @@ inline WebRtc_Word64 TickInterval::Milliseconds() const {
|
||||
#endif
|
||||
}
|
||||
|
||||
inline WebRtc_Word64 TickInterval::Microseconds() const {
|
||||
inline int64_t TickInterval::Microseconds() const {
|
||||
#if _WIN32
|
||||
#ifdef USE_QUERY_PERFORMANCE_COUNTER
|
||||
LARGE_INTEGER qpfreq;
|
||||
|
@ -48,24 +48,24 @@ class Trace {
|
||||
// filter parameter is a bitmask where each message type is enumerated by the
|
||||
// TraceLevel enumerator. TODO(hellner): why is the TraceLevel enumerator not
|
||||
// defined in this file?
|
||||
static WebRtc_Word32 SetLevelFilter(const WebRtc_UWord32 filter);
|
||||
static int32_t SetLevelFilter(const uint32_t filter);
|
||||
|
||||
// Returns what type of messages are written to the trace file.
|
||||
static WebRtc_Word32 LevelFilter(WebRtc_UWord32& filter);
|
||||
static int32_t LevelFilter(uint32_t& filter);
|
||||
|
||||
// Sets the file name. If add_file_counter is false the same file will be
|
||||
// reused when it fills up. If it's true a new file with incremented name
|
||||
// will be used.
|
||||
static WebRtc_Word32 SetTraceFile(const char* file_name,
|
||||
const bool add_file_counter = false);
|
||||
static int32_t SetTraceFile(const char* file_name,
|
||||
const bool add_file_counter = false);
|
||||
|
||||
// Returns the name of the file that the trace is currently writing to.
|
||||
static WebRtc_Word32 TraceFile(char file_name[1024]);
|
||||
static int32_t TraceFile(char file_name[1024]);
|
||||
|
||||
// Registers callback to receive trace messages.
|
||||
// TODO(hellner): Why not use OutStream instead? Why is TraceCallback not
|
||||
// defined in this file?
|
||||
static WebRtc_Word32 SetTraceCallback(TraceCallback* callback);
|
||||
static int32_t SetTraceCallback(TraceCallback* callback);
|
||||
|
||||
// Adds a trace message for writing to file. The message is put in a queue
|
||||
// for writing to file whenever possible for performance reasons. I.e. there
|
||||
@ -79,7 +79,7 @@ class Trace {
|
||||
// TODO(hellner) Why is TraceModule not defined in this file?
|
||||
static void Add(const TraceLevel level,
|
||||
const TraceModule module,
|
||||
const WebRtc_Word32 id,
|
||||
const int32_t id,
|
||||
const char* msg, ...);
|
||||
};
|
||||
|
||||
|
@ -18,7 +18,7 @@
|
||||
|
||||
namespace webrtc {
|
||||
|
||||
Atomic32::Atomic32(WebRtc_Word32 initial_value)
|
||||
Atomic32::Atomic32(int32_t initial_value)
|
||||
: value_(initial_value) {
|
||||
assert(Is32bitAligned());
|
||||
}
|
||||
@ -26,28 +26,27 @@ Atomic32::Atomic32(WebRtc_Word32 initial_value)
|
||||
Atomic32::~Atomic32() {
|
||||
}
|
||||
|
||||
WebRtc_Word32 Atomic32::operator++() {
|
||||
int32_t Atomic32::operator++() {
|
||||
return OSAtomicIncrement32Barrier(&value_);
|
||||
}
|
||||
|
||||
WebRtc_Word32 Atomic32::operator--() {
|
||||
int32_t Atomic32::operator--() {
|
||||
return OSAtomicDecrement32Barrier(&value_);
|
||||
}
|
||||
|
||||
WebRtc_Word32 Atomic32::operator+=(WebRtc_Word32 value) {
|
||||
int32_t Atomic32::operator+=(int32_t value) {
|
||||
return OSAtomicAdd32Barrier(value, &value_);
|
||||
}
|
||||
|
||||
WebRtc_Word32 Atomic32::operator-=(WebRtc_Word32 value) {
|
||||
int32_t Atomic32::operator-=(int32_t value) {
|
||||
return OSAtomicAdd32Barrier(-value, &value_);
|
||||
}
|
||||
|
||||
bool Atomic32::CompareExchange(WebRtc_Word32 new_value,
|
||||
WebRtc_Word32 compare_value) {
|
||||
bool Atomic32::CompareExchange(int32_t new_value, int32_t compare_value) {
|
||||
return OSAtomicCompareAndSwap32Barrier(compare_value, new_value, &value_);
|
||||
}
|
||||
|
||||
WebRtc_Word32 Atomic32::Value() const {
|
||||
int32_t Atomic32::Value() const {
|
||||
return value_;
|
||||
}
|
||||
|
||||
|
@ -18,7 +18,7 @@
|
||||
|
||||
namespace webrtc {
|
||||
|
||||
Atomic32::Atomic32(WebRtc_Word32 initial_value)
|
||||
Atomic32::Atomic32(int32_t initial_value)
|
||||
: value_(initial_value) {
|
||||
assert(Is32bitAligned());
|
||||
}
|
||||
@ -26,32 +26,31 @@ Atomic32::Atomic32(WebRtc_Word32 initial_value)
|
||||
Atomic32::~Atomic32() {
|
||||
}
|
||||
|
||||
WebRtc_Word32 Atomic32::operator++() {
|
||||
int32_t Atomic32::operator++() {
|
||||
return __sync_fetch_and_add(&value_, 1) + 1;
|
||||
}
|
||||
|
||||
WebRtc_Word32 Atomic32::operator--() {
|
||||
int32_t Atomic32::operator--() {
|
||||
return __sync_fetch_and_sub(&value_, 1) - 1;
|
||||
}
|
||||
|
||||
WebRtc_Word32 Atomic32::operator+=(WebRtc_Word32 value) {
|
||||
WebRtc_Word32 return_value = __sync_fetch_and_add(&value_, value);
|
||||
int32_t Atomic32::operator+=(int32_t value) {
|
||||
int32_t return_value = __sync_fetch_and_add(&value_, value);
|
||||
return_value += value;
|
||||
return return_value;
|
||||
}
|
||||
|
||||
WebRtc_Word32 Atomic32::operator-=(WebRtc_Word32 value) {
|
||||
WebRtc_Word32 return_value = __sync_fetch_and_sub(&value_, value);
|
||||
int32_t Atomic32::operator-=(int32_t value) {
|
||||
int32_t return_value = __sync_fetch_and_sub(&value_, value);
|
||||
return_value -= value;
|
||||
return return_value;
|
||||
}
|
||||
|
||||
bool Atomic32::CompareExchange(WebRtc_Word32 new_value,
|
||||
WebRtc_Word32 compare_value) {
|
||||
bool Atomic32::CompareExchange(int32_t new_value, int32_t compare_value) {
|
||||
return __sync_bool_compare_and_swap(&value_, compare_value, new_value);
|
||||
}
|
||||
|
||||
WebRtc_Word32 Atomic32::Value() const {
|
||||
int32_t Atomic32::Value() const {
|
||||
return value_;
|
||||
}
|
||||
|
||||
|
@ -18,7 +18,7 @@
|
||||
|
||||
namespace webrtc {
|
||||
|
||||
Atomic32::Atomic32(WebRtc_Word32 initial_value)
|
||||
Atomic32::Atomic32(int32_t initial_value)
|
||||
: value_(initial_value) {
|
||||
// Make sure that the counter variable we're using is of the same size
|
||||
// as what the API expects.
|
||||
@ -29,28 +29,27 @@ Atomic32::Atomic32(WebRtc_Word32 initial_value)
|
||||
Atomic32::~Atomic32() {
|
||||
}
|
||||
|
||||
WebRtc_Word32 Atomic32::operator++() {
|
||||
return static_cast<WebRtc_Word32>(InterlockedIncrement(
|
||||
int32_t Atomic32::operator++() {
|
||||
return static_cast<int32_t>(InterlockedIncrement(
|
||||
reinterpret_cast<volatile LONG*>(&value_)));
|
||||
}
|
||||
|
||||
WebRtc_Word32 Atomic32::operator--() {
|
||||
return static_cast<WebRtc_Word32>(InterlockedDecrement(
|
||||
int32_t Atomic32::operator--() {
|
||||
return static_cast<int32_t>(InterlockedDecrement(
|
||||
reinterpret_cast<volatile LONG*>(&value_)));
|
||||
}
|
||||
|
||||
WebRtc_Word32 Atomic32::operator+=(WebRtc_Word32 value) {
|
||||
int32_t Atomic32::operator+=(int32_t value) {
|
||||
return InterlockedExchangeAdd(reinterpret_cast<volatile LONG*>(&value_),
|
||||
value);
|
||||
}
|
||||
|
||||
WebRtc_Word32 Atomic32::operator-=(WebRtc_Word32 value) {
|
||||
int32_t Atomic32::operator-=(int32_t value) {
|
||||
return InterlockedExchangeAdd(reinterpret_cast<volatile LONG*>(&value_),
|
||||
-value);
|
||||
}
|
||||
|
||||
bool Atomic32::CompareExchange(WebRtc_Word32 new_value,
|
||||
WebRtc_Word32 compare_value) {
|
||||
bool Atomic32::CompareExchange(int32_t new_value, int32_t compare_value) {
|
||||
const LONG old_value = InterlockedCompareExchange(
|
||||
reinterpret_cast<volatile LONG*>(&value_),
|
||||
new_value,
|
||||
@ -60,7 +59,7 @@ bool Atomic32::CompareExchange(WebRtc_Word32 new_value,
|
||||
return (old_value == compare_value);
|
||||
}
|
||||
|
||||
WebRtc_Word32 Atomic32::Value() const {
|
||||
int32_t Atomic32::Value() const {
|
||||
return value_;
|
||||
}
|
||||
|
||||
|
@ -140,24 +140,24 @@ class WindowsRealTimeClock : public RealTimeClock {
|
||||
|
||||
// Retrieve an NTP absolute timestamp.
|
||||
virtual void CurrentNtp(uint32_t& seconds, uint32_t& fractions) {
|
||||
const WebRtc_UWord64 FILETIME_1970 = 0x019db1ded53e8000;
|
||||
const uint64_t FILETIME_1970 = 0x019db1ded53e8000;
|
||||
|
||||
FILETIME StartTime;
|
||||
WebRtc_UWord64 Time;
|
||||
uint64_t Time;
|
||||
struct timeval tv;
|
||||
|
||||
// We can't use query performance counter since they can change depending on
|
||||
// speed steping
|
||||
get_time(_helpTimer, StartTime);
|
||||
|
||||
Time = (((WebRtc_UWord64) StartTime.dwHighDateTime) << 32) +
|
||||
(WebRtc_UWord64) StartTime.dwLowDateTime;
|
||||
Time = (((uint64_t) StartTime.dwHighDateTime) << 32) +
|
||||
(uint64_t) StartTime.dwLowDateTime;
|
||||
|
||||
// Convert the hecto-nano second time to tv format
|
||||
Time -= FILETIME_1970;
|
||||
|
||||
tv.tv_sec = (WebRtc_UWord32)(Time / (WebRtc_UWord64)10000000);
|
||||
tv.tv_usec = (WebRtc_UWord32)((Time % (WebRtc_UWord64)10000000) / 10);
|
||||
tv.tv_sec = (uint32_t)(Time / (uint64_t)10000000);
|
||||
tv.tv_usec = (uint32_t)((Time % (uint64_t)10000000) / 10);
|
||||
|
||||
double dtemp;
|
||||
|
||||
@ -172,7 +172,7 @@ class WindowsRealTimeClock : public RealTimeClock {
|
||||
seconds--;
|
||||
}
|
||||
dtemp *= kMagicNtpFractionalUnit;
|
||||
fractions = (WebRtc_UWord32)dtemp;
|
||||
fractions = (uint32_t)dtemp;
|
||||
}
|
||||
|
||||
private:
|
||||
@ -205,7 +205,7 @@ class UnixRealTimeClock : public RealTimeClock {
|
||||
seconds--;
|
||||
}
|
||||
dtemp *= kMagicNtpFractionalUnit;
|
||||
fractions = (WebRtc_UWord32)dtemp;
|
||||
fractions = (uint32_t)dtemp;
|
||||
}
|
||||
};
|
||||
#endif
|
||||
|
@ -50,7 +50,7 @@ class Baton {
|
||||
// Pass the baton. Returns false if baton is not picked up in |max_msecs|.
|
||||
// Only one process can pass at the same time; this property is
|
||||
// ensured by the |giver_sect_| lock.
|
||||
bool Pass(WebRtc_UWord32 max_msecs) {
|
||||
bool Pass(uint32_t max_msecs) {
|
||||
CriticalSectionScoped cs_giver(giver_sect_);
|
||||
CriticalSectionScoped cs(crit_sect_);
|
||||
SignalBatonAvailable();
|
||||
@ -62,7 +62,7 @@ class Baton {
|
||||
}
|
||||
|
||||
// Grab the baton. Returns false if baton is not passed.
|
||||
bool Grab(WebRtc_UWord32 max_msecs) {
|
||||
bool Grab(uint32_t max_msecs) {
|
||||
CriticalSectionScoped cs(crit_sect_);
|
||||
return WaitUntilBatonOffered(max_msecs);
|
||||
}
|
||||
|
@ -26,14 +26,14 @@
|
||||
|
||||
namespace webrtc {
|
||||
|
||||
WebRtc_UWord32 CpuInfo::number_of_cores_ = 0;
|
||||
uint32_t CpuInfo::number_of_cores_ = 0;
|
||||
|
||||
WebRtc_UWord32 CpuInfo::DetectNumberOfCores() {
|
||||
uint32_t CpuInfo::DetectNumberOfCores() {
|
||||
if (!number_of_cores_) {
|
||||
#if defined(_WIN32)
|
||||
SYSTEM_INFO si;
|
||||
GetSystemInfo(&si);
|
||||
number_of_cores_ = static_cast<WebRtc_UWord32>(si.dwNumberOfProcessors);
|
||||
number_of_cores_ = static_cast<uint32_t>(si.dwNumberOfProcessors);
|
||||
WEBRTC_TRACE(kTraceStateInfo, kTraceUtility, -1,
|
||||
"Available number of cores:%d", number_of_cores_);
|
||||
|
||||
@ -47,7 +47,7 @@ WebRtc_UWord32 CpuInfo::DetectNumberOfCores() {
|
||||
int ncpu;
|
||||
size_t size = sizeof(ncpu);
|
||||
if (0 == sysctl(name, 2, &ncpu, &size, NULL, 0)) {
|
||||
number_of_cores_ = static_cast<WebRtc_UWord32>(ncpu);
|
||||
number_of_cores_ = static_cast<uint32_t>(ncpu);
|
||||
WEBRTC_TRACE(kTraceStateInfo, kTraceUtility, -1,
|
||||
"Available number of cores:%d", number_of_cores_);
|
||||
} else {
|
||||
|
@ -133,12 +133,12 @@ TEST(TestDataLog, VerifySingleTable) {
|
||||
DataLog::AddColumn(DataLog::Combine("table", 1), "arrival", 1);
|
||||
DataLog::AddColumn(DataLog::Combine("table", 1), "timestamp", 1);
|
||||
DataLog::AddColumn(DataLog::Combine("table", 1), "size", 5);
|
||||
WebRtc_UWord32 sizes[5] = {1400, 1500, 1600, 1700, 1800};
|
||||
uint32_t sizes[5] = {1400, 1500, 1600, 1700, 1800};
|
||||
for (int i = 0; i < 10; ++i) {
|
||||
DataLog::InsertCell(DataLog::Combine("table", 1), "arrival",
|
||||
static_cast<double>(i));
|
||||
DataLog::InsertCell(DataLog::Combine("table", 1), "timestamp",
|
||||
static_cast<WebRtc_Word64>(4354 + i));
|
||||
static_cast<int64_t>(4354 + i));
|
||||
DataLog::InsertCell(DataLog::Combine("table", 1), "size", sizes, 5);
|
||||
DataLog::NextRow(DataLog::Combine("table", 1));
|
||||
}
|
||||
@ -188,19 +188,19 @@ TEST(TestDataLog, VerifyMultipleTables) {
|
||||
DataLog::AddColumn(DataLog::Combine("table", 3), "timestamp", 1);
|
||||
DataLog::AddColumn(DataLog::Combine("table", 3), "arrival", 1);
|
||||
DataLog::AddColumn(DataLog::Combine("table", 4), "size", 1);
|
||||
for (WebRtc_Word32 i = 0; i < 10; ++i) {
|
||||
for (int32_t i = 0; i < 10; ++i) {
|
||||
DataLog::InsertCell(DataLog::Combine("table", 2), "arrival",
|
||||
static_cast<WebRtc_Word32>(i));
|
||||
static_cast<int32_t>(i));
|
||||
DataLog::InsertCell(DataLog::Combine("table", 2), "timestamp",
|
||||
static_cast<WebRtc_Word32>(4354 + i));
|
||||
static_cast<int32_t>(4354 + i));
|
||||
DataLog::InsertCell(DataLog::Combine("table", 2), "size",
|
||||
static_cast<WebRtc_Word32>(1200 + 10 * i));
|
||||
static_cast<int32_t>(1200 + 10 * i));
|
||||
DataLog::InsertCell(DataLog::Combine("table", 3), "timestamp",
|
||||
static_cast<WebRtc_Word32>(4354 + i));
|
||||
static_cast<int32_t>(4354 + i));
|
||||
DataLog::InsertCell(DataLog::Combine("table", 3), "arrival",
|
||||
static_cast<WebRtc_Word32>(i));
|
||||
static_cast<int32_t>(i));
|
||||
DataLog::InsertCell(DataLog::Combine("table", 4), "size",
|
||||
static_cast<WebRtc_Word32>(1200 + 10 * i));
|
||||
static_cast<int32_t>(1200 + 10 * i));
|
||||
DataLog::NextRow(DataLog::Combine("table", 4));
|
||||
DataLog::NextRow(DataLog::Combine("table", 2));
|
||||
DataLog::NextRow(DataLog::Combine("table", 3));
|
||||
|
@ -33,7 +33,7 @@ class EventWindows : public EventWrapper {
|
||||
|
||||
private:
|
||||
HANDLE event_;
|
||||
WebRtc_UWord32 timerID_;
|
||||
uint32_t timerID_;
|
||||
};
|
||||
|
||||
} // namespace webrtc
|
||||
|
@ -59,7 +59,7 @@
|
||||
#define KEY_QSORT(SORT_KEY, KEY, NUM_OF_ELEMENTS, KEY_TYPE, COMPARE_FUNC) \
|
||||
do { \
|
||||
KEY_TYPE* key_type = (KEY_TYPE*)(key); \
|
||||
for (WebRtc_UWord32 i = 0; i < (NUM_OF_ELEMENTS); ++i) { \
|
||||
for (uint32_t i = 0; i < (NUM_OF_ELEMENTS); ++i) { \
|
||||
ptr_sort_key[i].key_ = &key_type[i]; \
|
||||
ptr_sort_key[i].index_ = i; \
|
||||
} \
|
||||
@ -72,13 +72,13 @@ namespace webrtc {
|
||||
#ifdef NO_STL
|
||||
struct SortKey {
|
||||
void* key_;
|
||||
WebRtc_UWord32 index_;
|
||||
uint32_t index_;
|
||||
};
|
||||
#else
|
||||
template<typename KeyType>
|
||||
struct SortKey {
|
||||
KeyType key_;
|
||||
WebRtc_UWord32 index_;
|
||||
uint32_t index_;
|
||||
};
|
||||
#endif
|
||||
|
||||
@ -86,35 +86,35 @@ namespace { // Unnamed namespace provides internal linkage.
|
||||
|
||||
#ifdef NO_STL
|
||||
int CompareWord8(const void* x, const void* y) {
|
||||
COMPARE_FOR_QSORT(x, y, WebRtc_Word8);
|
||||
COMPARE_FOR_QSORT(x, y, int8_t);
|
||||
}
|
||||
|
||||
int CompareUWord8(const void* x, const void* y) {
|
||||
COMPARE_FOR_QSORT(x, y, WebRtc_UWord8);
|
||||
COMPARE_FOR_QSORT(x, y, uint8_t);
|
||||
}
|
||||
|
||||
int CompareWord16(const void* x, const void* y) {
|
||||
COMPARE_FOR_QSORT(x, y, WebRtc_Word16);
|
||||
COMPARE_FOR_QSORT(x, y, int16_t);
|
||||
}
|
||||
|
||||
int CompareUWord16(const void* x, const void* y) {
|
||||
COMPARE_FOR_QSORT(x, y, WebRtc_UWord16);
|
||||
COMPARE_FOR_QSORT(x, y, uint16_t);
|
||||
}
|
||||
|
||||
int CompareWord32(const void* x, const void* y) {
|
||||
COMPARE_FOR_QSORT(x, y, WebRtc_Word32);
|
||||
COMPARE_FOR_QSORT(x, y, int32_t);
|
||||
}
|
||||
|
||||
int CompareUWord32(const void* x, const void* y) {
|
||||
COMPARE_FOR_QSORT(x, y, WebRtc_UWord32);
|
||||
COMPARE_FOR_QSORT(x, y, uint32_t);
|
||||
}
|
||||
|
||||
int CompareWord64(const void* x, const void* y) {
|
||||
COMPARE_FOR_QSORT(x, y, WebRtc_Word64);
|
||||
COMPARE_FOR_QSORT(x, y, int64_t);
|
||||
}
|
||||
|
||||
int CompareUWord64(const void* x, const void* y) {
|
||||
COMPARE_FOR_QSORT(x, y, WebRtc_UWord64);
|
||||
COMPARE_FOR_QSORT(x, y, uint64_t);
|
||||
}
|
||||
|
||||
int CompareFloat32(const void* x, const void* y) {
|
||||
@ -126,35 +126,35 @@ int CompareFloat64(const void* x, const void* y) {
|
||||
}
|
||||
|
||||
int CompareKeyWord8(const void* sort_key_x, const void* sort_key_y) {
|
||||
COMPARE_KEY_FOR_QSORT(sort_key_x, sort_key_y, WebRtc_Word8);
|
||||
COMPARE_KEY_FOR_QSORT(sort_key_x, sort_key_y, int8_t);
|
||||
}
|
||||
|
||||
int CompareKeyUWord8(const void* sort_key_x, const void* sort_key_y) {
|
||||
COMPARE_KEY_FOR_QSORT(sort_key_x, sort_key_y, WebRtc_UWord8);
|
||||
COMPARE_KEY_FOR_QSORT(sort_key_x, sort_key_y, uint8_t);
|
||||
}
|
||||
|
||||
int CompareKeyWord16(const void* sort_key_x, const void* sort_key_y) {
|
||||
COMPARE_KEY_FOR_QSORT(sort_key_x, sort_key_y, WebRtc_Word16);
|
||||
COMPARE_KEY_FOR_QSORT(sort_key_x, sort_key_y, int16_t);
|
||||
}
|
||||
|
||||
int CompareKeyUWord16(const void* sort_key_x, const void* sort_key_y) {
|
||||
COMPARE_KEY_FOR_QSORT(sort_key_x, sort_key_y, WebRtc_UWord16);
|
||||
COMPARE_KEY_FOR_QSORT(sort_key_x, sort_key_y, uint16_t);
|
||||
}
|
||||
|
||||
int CompareKeyWord32(const void* sort_key_x, const void* sort_key_y) {
|
||||
COMPARE_KEY_FOR_QSORT(sort_key_x, sort_key_y, WebRtc_Word32);
|
||||
COMPARE_KEY_FOR_QSORT(sort_key_x, sort_key_y, int32_t);
|
||||
}
|
||||
|
||||
int CompareKeyUWord32(const void* sort_key_x, const void* sort_key_y) {
|
||||
COMPARE_KEY_FOR_QSORT(sort_key_x, sort_key_y, WebRtc_UWord32);
|
||||
COMPARE_KEY_FOR_QSORT(sort_key_x, sort_key_y, uint32_t);
|
||||
}
|
||||
|
||||
int CompareKeyWord64(const void* sort_key_x, const void* sort_key_y) {
|
||||
COMPARE_KEY_FOR_QSORT(sort_key_x, sort_key_y, WebRtc_Word64);
|
||||
COMPARE_KEY_FOR_QSORT(sort_key_x, sort_key_y, int64_t);
|
||||
}
|
||||
|
||||
int CompareKeyUWord64(const void* sort_key_x, const void* sort_key_y) {
|
||||
COMPARE_KEY_FOR_QSORT(sort_key_x, sort_key_y, WebRtc_UWord64);
|
||||
COMPARE_KEY_FOR_QSORT(sort_key_x, sort_key_y, uint64_t);
|
||||
}
|
||||
|
||||
int CompareKeyFloat32(const void* sort_key_x, const void* sort_key_y) {
|
||||
@ -182,35 +182,35 @@ struct KeyRightShift {
|
||||
};
|
||||
|
||||
template <typename DataType>
|
||||
inline void IntegerSort(void* data, WebRtc_UWord32 num_of_elements) {
|
||||
inline void IntegerSort(void* data, uint32_t num_of_elements) {
|
||||
DataType* data_type = static_cast<DataType*>(data);
|
||||
boost::integer_sort(data_type, data_type + num_of_elements);
|
||||
}
|
||||
|
||||
template <typename DataType, typename IntegerType>
|
||||
inline void FloatSort(void* data, WebRtc_UWord32 num_of_elements) {
|
||||
inline void FloatSort(void* data, uint32_t num_of_elements) {
|
||||
DataType* data_type = static_cast<DataType*>(data);
|
||||
IntegerType c_val = 0;
|
||||
boost::float_sort_cast(data_type, data_type + num_of_elements, c_val);
|
||||
}
|
||||
|
||||
template <typename DataType>
|
||||
inline void StdSort(void* data, WebRtc_UWord32 num_of_elements) {
|
||||
inline void StdSort(void* data, uint32_t num_of_elements) {
|
||||
DataType* data_type = static_cast<DataType*>(data);
|
||||
std::sort(data_type, data_type + num_of_elements);
|
||||
}
|
||||
|
||||
template<typename KeyType>
|
||||
inline WebRtc_Word32 SetupKeySort(void* key,
|
||||
SortKey<KeyType>*& ptr_sort_key,
|
||||
WebRtc_UWord32 num_of_elements) {
|
||||
inline int32_t SetupKeySort(void* key,
|
||||
SortKey<KeyType>*& ptr_sort_key,
|
||||
uint32_t num_of_elements) {
|
||||
ptr_sort_key = new(std::nothrow) SortKey<KeyType>[num_of_elements];
|
||||
if (ptr_sort_key == NULL) {
|
||||
return -1;
|
||||
}
|
||||
|
||||
KeyType* key_type = static_cast<KeyType*>(key);
|
||||
for (WebRtc_UWord32 i = 0; i < num_of_elements; i++) {
|
||||
for (uint32_t i = 0; i < num_of_elements; i++) {
|
||||
ptr_sort_key[i].key_ = key_type[i];
|
||||
ptr_sort_key[i].index_ = i;
|
||||
}
|
||||
@ -219,18 +219,18 @@ inline WebRtc_Word32 SetupKeySort(void* key,
|
||||
}
|
||||
|
||||
template<typename KeyType>
|
||||
inline WebRtc_Word32 TeardownKeySort(void* data,
|
||||
SortKey<KeyType>* ptr_sort_key,
|
||||
WebRtc_UWord32 num_of_elements,
|
||||
WebRtc_UWord32 size_of_element) {
|
||||
WebRtc_UWord8* ptr_data = static_cast<WebRtc_UWord8*>(data);
|
||||
WebRtc_UWord8* ptr_data_sorted =
|
||||
new(std::nothrow) WebRtc_UWord8[num_of_elements * size_of_element];
|
||||
inline int32_t TeardownKeySort(void* data,
|
||||
SortKey<KeyType>* ptr_sort_key,
|
||||
uint32_t num_of_elements,
|
||||
uint32_t size_of_element) {
|
||||
uint8_t* ptr_data = static_cast<uint8_t*>(data);
|
||||
uint8_t* ptr_data_sorted =
|
||||
new(std::nothrow) uint8_t[num_of_elements * size_of_element];
|
||||
if (ptr_data_sorted == NULL) {
|
||||
return -1;
|
||||
}
|
||||
|
||||
for (WebRtc_UWord32 i = 0; i < num_of_elements; i++) {
|
||||
for (uint32_t i = 0; i < num_of_elements; i++) {
|
||||
memcpy(ptr_data_sorted + i * size_of_element, ptr_data +
|
||||
ptr_sort_key[i].index_ * size_of_element, size_of_element);
|
||||
}
|
||||
@ -241,9 +241,9 @@ inline WebRtc_Word32 TeardownKeySort(void* data,
|
||||
}
|
||||
|
||||
template<typename KeyType>
|
||||
inline WebRtc_Word32 IntegerKeySort(void* data, void* key,
|
||||
WebRtc_UWord32 num_of_elements,
|
||||
WebRtc_UWord32 size_of_element) {
|
||||
inline int32_t IntegerKeySort(void* data, void* key,
|
||||
uint32_t num_of_elements,
|
||||
uint32_t size_of_element) {
|
||||
SortKey<KeyType>* ptr_sort_key;
|
||||
if (SetupKeySort<KeyType>(key, ptr_sort_key, num_of_elements) != 0) {
|
||||
return -1;
|
||||
@ -261,9 +261,9 @@ inline WebRtc_Word32 IntegerKeySort(void* data, void* key,
|
||||
}
|
||||
|
||||
template<typename KeyType>
|
||||
inline WebRtc_Word32 StdKeySort(void* data, void* key,
|
||||
WebRtc_UWord32 num_of_elements,
|
||||
WebRtc_UWord32 size_of_element) {
|
||||
inline int32_t StdKeySort(void* data, void* key,
|
||||
uint32_t num_of_elements,
|
||||
uint32_t size_of_element) {
|
||||
SortKey<KeyType>* ptr_sort_key;
|
||||
if (SetupKeySort<KeyType>(key, ptr_sort_key, num_of_elements) != 0) {
|
||||
return -1;
|
||||
@ -282,7 +282,7 @@ inline WebRtc_Word32 StdKeySort(void* data, void* key,
|
||||
#endif
|
||||
}
|
||||
|
||||
WebRtc_Word32 Sort(void* data, WebRtc_UWord32 num_of_elements, Type type) {
|
||||
int32_t Sort(void* data, uint32_t num_of_elements, Type type) {
|
||||
if (data == NULL) {
|
||||
return -1;
|
||||
}
|
||||
@ -290,28 +290,28 @@ WebRtc_Word32 Sort(void* data, WebRtc_UWord32 num_of_elements, Type type) {
|
||||
#ifdef NO_STL
|
||||
switch (type) {
|
||||
case TYPE_Word8:
|
||||
qsort(data, num_of_elements, sizeof(WebRtc_Word8), CompareWord8);
|
||||
qsort(data, num_of_elements, sizeof(int8_t), CompareWord8);
|
||||
break;
|
||||
case TYPE_UWord8:
|
||||
qsort(data, num_of_elements, sizeof(WebRtc_UWord8), CompareUWord8);
|
||||
qsort(data, num_of_elements, sizeof(uint8_t), CompareUWord8);
|
||||
break;
|
||||
case TYPE_Word16:
|
||||
qsort(data, num_of_elements, sizeof(WebRtc_Word16), CompareWord16);
|
||||
qsort(data, num_of_elements, sizeof(int16_t), CompareWord16);
|
||||
break;
|
||||
case TYPE_UWord16:
|
||||
qsort(data, num_of_elements, sizeof(WebRtc_UWord16), CompareUWord16);
|
||||
qsort(data, num_of_elements, sizeof(uint16_t), CompareUWord16);
|
||||
break;
|
||||
case TYPE_Word32:
|
||||
qsort(data, num_of_elements, sizeof(WebRtc_Word32), CompareWord32);
|
||||
qsort(data, num_of_elements, sizeof(int32_t), CompareWord32);
|
||||
break;
|
||||
case TYPE_UWord32:
|
||||
qsort(data, num_of_elements, sizeof(WebRtc_UWord32), CompareUWord32);
|
||||
qsort(data, num_of_elements, sizeof(uint32_t), CompareUWord32);
|
||||
break;
|
||||
case TYPE_Word64:
|
||||
qsort(data, num_of_elements, sizeof(WebRtc_Word64), CompareWord64);
|
||||
qsort(data, num_of_elements, sizeof(int64_t), CompareWord64);
|
||||
break;
|
||||
case TYPE_UWord64:
|
||||
qsort(data, num_of_elements, sizeof(WebRtc_UWord64), CompareUWord64);
|
||||
qsort(data, num_of_elements, sizeof(uint64_t), CompareUWord64);
|
||||
break;
|
||||
case TYPE_Float32:
|
||||
qsort(data, num_of_elements, sizeof(float), CompareFloat32);
|
||||
@ -327,28 +327,28 @@ WebRtc_Word32 Sort(void* data, WebRtc_UWord32 num_of_elements, Type type) {
|
||||
// warnings and VS 2003 build crashes respectively with spreadsort.
|
||||
switch (type) {
|
||||
case TYPE_Word8:
|
||||
IntegerSort<WebRtc_Word8>(data, num_of_elements);
|
||||
IntegerSort<int8_t>(data, num_of_elements);
|
||||
break;
|
||||
case TYPE_UWord8:
|
||||
IntegerSort<WebRtc_UWord8>(data, num_of_elements);
|
||||
IntegerSort<uint8_t>(data, num_of_elements);
|
||||
break;
|
||||
case TYPE_Word16:
|
||||
IntegerSort<WebRtc_Word16>(data, num_of_elements);
|
||||
IntegerSort<int16_t>(data, num_of_elements);
|
||||
break;
|
||||
case TYPE_UWord16:
|
||||
IntegerSort<WebRtc_UWord16>(data, num_of_elements);
|
||||
IntegerSort<uint16_t>(data, num_of_elements);
|
||||
break;
|
||||
case TYPE_Word32:
|
||||
IntegerSort<WebRtc_Word32>(data, num_of_elements);
|
||||
IntegerSort<int32_t>(data, num_of_elements);
|
||||
break;
|
||||
case TYPE_UWord32:
|
||||
IntegerSort<WebRtc_UWord32>(data, num_of_elements);
|
||||
IntegerSort<uint32_t>(data, num_of_elements);
|
||||
break;
|
||||
case TYPE_Word64:
|
||||
StdSort<WebRtc_Word64>(data, num_of_elements);
|
||||
StdSort<int64_t>(data, num_of_elements);
|
||||
break;
|
||||
case TYPE_UWord64:
|
||||
StdSort<WebRtc_UWord64>(data, num_of_elements);
|
||||
StdSort<uint64_t>(data, num_of_elements);
|
||||
break;
|
||||
case TYPE_Float32:
|
||||
StdSort<float>(data, num_of_elements);
|
||||
@ -361,8 +361,8 @@ WebRtc_Word32 Sort(void* data, WebRtc_UWord32 num_of_elements, Type type) {
|
||||
return 0;
|
||||
}
|
||||
|
||||
WebRtc_Word32 KeySort(void* data, void* key, WebRtc_UWord32 num_of_elements,
|
||||
WebRtc_UWord32 size_of_element, Type key_type) {
|
||||
int32_t KeySort(void* data, void* key, uint32_t num_of_elements,
|
||||
uint32_t size_of_element, Type key_type) {
|
||||
if (data == NULL) {
|
||||
return -1;
|
||||
}
|
||||
@ -371,7 +371,7 @@ WebRtc_Word32 KeySort(void* data, void* key, WebRtc_UWord32 num_of_elements,
|
||||
return -1;
|
||||
}
|
||||
|
||||
if ((WebRtc_UWord64)num_of_elements * size_of_element > 0xffffffff) {
|
||||
if ((uint64_t)num_of_elements * size_of_element > 0xffffffff) {
|
||||
return -1;
|
||||
}
|
||||
|
||||
@ -383,35 +383,35 @@ WebRtc_Word32 KeySort(void* data, void* key, WebRtc_UWord32 num_of_elements,
|
||||
|
||||
switch (key_type) {
|
||||
case TYPE_Word8:
|
||||
KEY_QSORT(ptr_sort_key, key, num_of_elements, WebRtc_Word8,
|
||||
KEY_QSORT(ptr_sort_key, key, num_of_elements, int8_t,
|
||||
CompareKeyWord8);
|
||||
break;
|
||||
case TYPE_UWord8:
|
||||
KEY_QSORT(ptr_sort_key, key, num_of_elements, WebRtc_UWord8,
|
||||
KEY_QSORT(ptr_sort_key, key, num_of_elements, uint8_t,
|
||||
CompareKeyUWord8);
|
||||
break;
|
||||
case TYPE_Word16:
|
||||
KEY_QSORT(ptr_sort_key, key, num_of_elements, WebRtc_Word16,
|
||||
KEY_QSORT(ptr_sort_key, key, num_of_elements, int16_t,
|
||||
CompareKeyWord16);
|
||||
break;
|
||||
case TYPE_UWord16:
|
||||
KEY_QSORT(ptr_sort_key, key, num_of_elements, WebRtc_UWord16,
|
||||
KEY_QSORT(ptr_sort_key, key, num_of_elements, uint16_t,
|
||||
CompareKeyUWord16);
|
||||
break;
|
||||
case TYPE_Word32:
|
||||
KEY_QSORT(ptr_sort_key, key, num_of_elements, WebRtc_Word32,
|
||||
KEY_QSORT(ptr_sort_key, key, num_of_elements, int32_t,
|
||||
CompareKeyWord32);
|
||||
break;
|
||||
case TYPE_UWord32:
|
||||
KEY_QSORT(ptr_sort_key, key, num_of_elements, WebRtc_UWord32,
|
||||
KEY_QSORT(ptr_sort_key, key, num_of_elements, uint32_t,
|
||||
CompareKeyUWord32);
|
||||
break;
|
||||
case TYPE_Word64:
|
||||
KEY_QSORT(ptr_sort_key, key, num_of_elements, WebRtc_Word64,
|
||||
KEY_QSORT(ptr_sort_key, key, num_of_elements, int64_t,
|
||||
CompareKeyWord64);
|
||||
break;
|
||||
case TYPE_UWord64:
|
||||
KEY_QSORT(ptr_sort_key, key, num_of_elements, WebRtc_UWord64,
|
||||
KEY_QSORT(ptr_sort_key, key, num_of_elements, uint64_t,
|
||||
CompareKeyUWord64);
|
||||
break;
|
||||
case TYPE_Float32:
|
||||
@ -427,14 +427,14 @@ WebRtc_Word32 KeySort(void* data, void* key, WebRtc_UWord32 num_of_elements,
|
||||
}
|
||||
|
||||
// Shuffle into sorted position based on index map.
|
||||
WebRtc_UWord8* ptr_data = static_cast<WebRtc_UWord8*>(data);
|
||||
WebRtc_UWord8* ptr_data_sorted =
|
||||
new(std::nothrow) WebRtc_UWord8[num_of_elements * size_of_element];
|
||||
uint8_t* ptr_data = static_cast<uint8_t*>(data);
|
||||
uint8_t* ptr_data_sorted =
|
||||
new(std::nothrow) uint8_t[num_of_elements * size_of_element];
|
||||
if (ptr_data_sorted == NULL) {
|
||||
return -1;
|
||||
}
|
||||
|
||||
for (WebRtc_UWord32 i = 0; i < num_of_elements; i++) {
|
||||
for (uint32_t i = 0; i < num_of_elements; i++) {
|
||||
memcpy(ptr_data_sorted + i * size_of_element, ptr_data +
|
||||
ptr_sort_key[i].index_ * size_of_element, size_of_element);
|
||||
}
|
||||
@ -449,29 +449,29 @@ WebRtc_Word32 KeySort(void* data, void* key, WebRtc_UWord32 num_of_elements,
|
||||
// warnings and errors respectively with spreadsort.
|
||||
switch (key_type) {
|
||||
case TYPE_Word8:
|
||||
return IntegerKeySort<WebRtc_Word8>(data, key, num_of_elements,
|
||||
size_of_element);
|
||||
return IntegerKeySort<int8_t>(data, key, num_of_elements,
|
||||
size_of_element);
|
||||
case TYPE_UWord8:
|
||||
return IntegerKeySort<WebRtc_UWord8>(data, key, num_of_elements,
|
||||
size_of_element);
|
||||
return IntegerKeySort<uint8_t>(data, key, num_of_elements,
|
||||
size_of_element);
|
||||
case TYPE_Word16:
|
||||
return IntegerKeySort<WebRtc_Word16>(data, key, num_of_elements,
|
||||
size_of_element);
|
||||
return IntegerKeySort<int16_t>(data, key, num_of_elements,
|
||||
size_of_element);
|
||||
case TYPE_UWord16:
|
||||
return IntegerKeySort<WebRtc_UWord16>(data, key, num_of_elements,
|
||||
size_of_element);
|
||||
return IntegerKeySort<uint16_t>(data, key, num_of_elements,
|
||||
size_of_element);
|
||||
case TYPE_Word32:
|
||||
return IntegerKeySort<WebRtc_Word32>(data, key, num_of_elements,
|
||||
size_of_element);
|
||||
return IntegerKeySort<int32_t>(data, key, num_of_elements,
|
||||
size_of_element);
|
||||
case TYPE_UWord32:
|
||||
return IntegerKeySort<WebRtc_UWord32>(data, key, num_of_elements,
|
||||
size_of_element);
|
||||
return IntegerKeySort<uint32_t>(data, key, num_of_elements,
|
||||
size_of_element);
|
||||
case TYPE_Word64:
|
||||
return StdKeySort<WebRtc_Word64>(data, key, num_of_elements,
|
||||
size_of_element);
|
||||
return StdKeySort<int64_t>(data, key, num_of_elements,
|
||||
size_of_element);
|
||||
case TYPE_UWord64:
|
||||
return StdKeySort<WebRtc_UWord64>(data, key, num_of_elements,
|
||||
size_of_element);
|
||||
return StdKeySort<uint64_t>(data, key, num_of_elements,
|
||||
size_of_element);
|
||||
case TYPE_Float32:
|
||||
return StdKeySort<float>(data, key, num_of_elements, size_of_element);
|
||||
case TYPE_Float64:
|
||||
|
@ -15,14 +15,14 @@
|
||||
namespace webrtc {
|
||||
|
||||
bool TickTime::use_fake_clock_ = false;
|
||||
WebRtc_Word64 TickTime::fake_ticks_ = 0;
|
||||
int64_t TickTime::fake_ticks_ = 0;
|
||||
|
||||
void TickTime::UseFakeClock(WebRtc_Word64 start_millisecond) {
|
||||
void TickTime::UseFakeClock(int64_t start_millisecond) {
|
||||
use_fake_clock_ = true;
|
||||
fake_ticks_ = MillisecondsToTicks(start_millisecond);
|
||||
}
|
||||
|
||||
void TickTime::AdvanceFakeClock(WebRtc_Word64 milliseconds) {
|
||||
void TickTime::AdvanceFakeClock(int64_t milliseconds) {
|
||||
assert(use_fake_clock_);
|
||||
fake_ticks_ += MillisecondsToTicks(milliseconds);
|
||||
}
|
||||
|
@ -35,7 +35,7 @@ const int Trace::kBoilerplateLength = 71;
|
||||
const int Trace::kTimestampPosition = 13;
|
||||
const int Trace::kTimestampLength = 12;
|
||||
|
||||
static WebRtc_UWord32 level_filter = kTraceDefault;
|
||||
static uint32_t level_filter = kTraceDefault;
|
||||
|
||||
// Construct On First Use idiom. Avoids "static initialization order fiasco".
|
||||
TraceImpl* TraceImpl::StaticInstance(CountOperation count_operation,
|
||||
@ -131,14 +131,13 @@ TraceImpl::~TraceImpl() {
|
||||
}
|
||||
}
|
||||
|
||||
WebRtc_Word32 TraceImpl::AddThreadId(char* trace_message) const {
|
||||
WebRtc_UWord32 thread_id = ThreadWrapper::GetThreadId();
|
||||
int32_t TraceImpl::AddThreadId(char* trace_message) const {
|
||||
uint32_t thread_id = ThreadWrapper::GetThreadId();
|
||||
// Messages is 12 characters.
|
||||
return sprintf(trace_message, "%10u; ", thread_id);
|
||||
}
|
||||
|
||||
WebRtc_Word32 TraceImpl::AddLevel(char* sz_message,
|
||||
const TraceLevel level) const {
|
||||
int32_t TraceImpl::AddLevel(char* sz_message, const TraceLevel level) const {
|
||||
const int kMessageLength = 12;
|
||||
switch (level) {
|
||||
case kTraceTerseInfo:
|
||||
@ -187,13 +186,13 @@ WebRtc_Word32 TraceImpl::AddLevel(char* sz_message,
|
||||
return kMessageLength;
|
||||
}
|
||||
|
||||
WebRtc_Word32 TraceImpl::AddModuleAndId(char* trace_message,
|
||||
const TraceModule module,
|
||||
const WebRtc_Word32 id) const {
|
||||
int32_t TraceImpl::AddModuleAndId(char* trace_message,
|
||||
const TraceModule module,
|
||||
const int32_t id) const {
|
||||
// Use long int to prevent problems with different definitions of
|
||||
// WebRtc_Word32.
|
||||
// int32_t.
|
||||
// TODO(hellner): is this actually a problem? If so, it should be better to
|
||||
// clean up WebRtc_Word32
|
||||
// clean up int32_t
|
||||
const long int idl = id;
|
||||
const int kMessageLength = 25;
|
||||
if (idl != -1) {
|
||||
@ -339,8 +338,8 @@ WebRtc_Word32 TraceImpl::AddModuleAndId(char* trace_message,
|
||||
return kMessageLength;
|
||||
}
|
||||
|
||||
WebRtc_Word32 TraceImpl::SetTraceFileImpl(const char* file_name_utf8,
|
||||
const bool add_file_counter) {
|
||||
int32_t TraceImpl::SetTraceFileImpl(const char* file_name_utf8,
|
||||
const bool add_file_counter) {
|
||||
CriticalSectionScoped lock(critsect_interface_);
|
||||
|
||||
trace_file_.Flush();
|
||||
@ -368,22 +367,22 @@ WebRtc_Word32 TraceImpl::SetTraceFileImpl(const char* file_name_utf8,
|
||||
return 0;
|
||||
}
|
||||
|
||||
WebRtc_Word32 TraceImpl::TraceFileImpl(
|
||||
int32_t TraceImpl::TraceFileImpl(
|
||||
char file_name_utf8[FileWrapper::kMaxFileNameSize]) {
|
||||
CriticalSectionScoped lock(critsect_interface_);
|
||||
return trace_file_.FileName(file_name_utf8, FileWrapper::kMaxFileNameSize);
|
||||
}
|
||||
|
||||
WebRtc_Word32 TraceImpl::SetTraceCallbackImpl(TraceCallback* callback) {
|
||||
int32_t TraceImpl::SetTraceCallbackImpl(TraceCallback* callback) {
|
||||
CriticalSectionScoped lock(critsect_interface_);
|
||||
callback_ = callback;
|
||||
return 0;
|
||||
}
|
||||
|
||||
WebRtc_Word32 TraceImpl::AddMessage(
|
||||
int32_t TraceImpl::AddMessage(
|
||||
char* trace_message,
|
||||
const char msg[WEBRTC_TRACE_MAX_MESSAGE_SIZE],
|
||||
const WebRtc_UWord16 written_so_far) const {
|
||||
const uint16_t written_so_far) const {
|
||||
int length = 0;
|
||||
if (written_so_far >= WEBRTC_TRACE_MAX_MESSAGE_SIZE) {
|
||||
return -1;
|
||||
@ -413,7 +412,7 @@ WebRtc_Word32 TraceImpl::AddMessage(
|
||||
|
||||
void TraceImpl::AddMessageToList(
|
||||
const char trace_message[WEBRTC_TRACE_MAX_MESSAGE_SIZE],
|
||||
const WebRtc_UWord16 length,
|
||||
const uint16_t length,
|
||||
const TraceLevel level) {
|
||||
CriticalSectionScoped lock(critsect_array_);
|
||||
|
||||
@ -442,7 +441,7 @@ void TraceImpl::AddMessageToList(
|
||||
}
|
||||
}
|
||||
|
||||
WebRtc_UWord16 idx = next_free_idx_[active_queue_];
|
||||
uint16_t idx = next_free_idx_[active_queue_];
|
||||
next_free_idx_[active_queue_]++;
|
||||
|
||||
level_[active_queue_][idx] = level;
|
||||
@ -482,8 +481,8 @@ bool TraceImpl::Process() {
|
||||
}
|
||||
|
||||
void TraceImpl::WriteToFile() {
|
||||
WebRtc_UWord8 local_queue_active = 0;
|
||||
WebRtc_UWord16 local_next_free_idx = 0;
|
||||
uint8_t local_queue_active = 0;
|
||||
uint16_t local_next_free_idx = 0;
|
||||
|
||||
// There are two buffers. One for reading (for writing to file) and one for
|
||||
// writing (for storing new messages). Let new messages be posted to the
|
||||
@ -505,7 +504,7 @@ void TraceImpl::WriteToFile() {
|
||||
|
||||
CriticalSectionScoped lock(critsect_interface_);
|
||||
|
||||
for (WebRtc_UWord16 idx = 0; idx < local_next_free_idx; ++idx) {
|
||||
for (uint16_t idx = 0; idx < local_next_free_idx; ++idx) {
|
||||
TraceLevel local_level = level_[local_queue_active][idx];
|
||||
if (callback_) {
|
||||
callback_->Print(local_level, message_queue_[local_queue_active][idx],
|
||||
@ -540,7 +539,7 @@ void TraceImpl::WriteToFile() {
|
||||
}
|
||||
if (row_count_text_ == 0) {
|
||||
char message[WEBRTC_TRACE_MAX_MESSAGE_SIZE + 1];
|
||||
WebRtc_Word32 length = AddDateTimeInfo(message);
|
||||
int32_t length = AddDateTimeInfo(message);
|
||||
if (length != -1) {
|
||||
message[length] = 0;
|
||||
message[length - 1] = '\n';
|
||||
@ -557,7 +556,7 @@ void TraceImpl::WriteToFile() {
|
||||
row_count_text_++;
|
||||
}
|
||||
}
|
||||
WebRtc_UWord16 length = length_[local_queue_active][idx];
|
||||
uint16_t length = length_[local_queue_active][idx];
|
||||
message_queue_[local_queue_active][idx][length] = 0;
|
||||
message_queue_[local_queue_active][idx][length - 1] = '\n';
|
||||
trace_file_.Write(message_queue_[local_queue_active][idx], length);
|
||||
@ -567,14 +566,14 @@ void TraceImpl::WriteToFile() {
|
||||
}
|
||||
|
||||
void TraceImpl::AddImpl(const TraceLevel level, const TraceModule module,
|
||||
const WebRtc_Word32 id,
|
||||
const int32_t id,
|
||||
const char msg[WEBRTC_TRACE_MAX_MESSAGE_SIZE]) {
|
||||
if (TraceCheck(level)) {
|
||||
char trace_message[WEBRTC_TRACE_MAX_MESSAGE_SIZE];
|
||||
char* message_ptr = trace_message;
|
||||
|
||||
WebRtc_Word32 len = 0;
|
||||
WebRtc_Word32 ack_len = 0;
|
||||
int32_t len = 0;
|
||||
int32_t ack_len = 0;
|
||||
|
||||
len = AddLevel(message_ptr, level);
|
||||
if (len == -1) {
|
||||
@ -604,12 +603,12 @@ void TraceImpl::AddImpl(const TraceLevel level, const TraceModule module,
|
||||
message_ptr += len;
|
||||
ack_len += len;
|
||||
|
||||
len = AddMessage(message_ptr, msg, (WebRtc_UWord16)ack_len);
|
||||
len = AddMessage(message_ptr, msg, (uint16_t)ack_len);
|
||||
if (len == -1) {
|
||||
return;
|
||||
}
|
||||
ack_len += len;
|
||||
AddMessageToList(trace_message, (WebRtc_UWord16)ack_len, level);
|
||||
AddMessageToList(trace_message, (uint16_t)ack_len, level);
|
||||
|
||||
// Make sure that messages are written as soon as possible.
|
||||
event_.Set();
|
||||
@ -623,13 +622,13 @@ bool TraceImpl::TraceCheck(const TraceLevel level) const {
|
||||
bool TraceImpl::UpdateFileName(
|
||||
const char file_name_utf8[FileWrapper::kMaxFileNameSize],
|
||||
char file_name_with_counter_utf8[FileWrapper::kMaxFileNameSize],
|
||||
const WebRtc_UWord32 new_count) const {
|
||||
WebRtc_Word32 length = (WebRtc_Word32)strlen(file_name_utf8);
|
||||
const uint32_t new_count) const {
|
||||
int32_t length = (int32_t)strlen(file_name_utf8);
|
||||
if (length < 0) {
|
||||
return false;
|
||||
}
|
||||
|
||||
WebRtc_Word32 length_without_file_ending = length - 1;
|
||||
int32_t length_without_file_ending = length - 1;
|
||||
while (length_without_file_ending > 0) {
|
||||
if (file_name_utf8[length_without_file_ending] == '.') {
|
||||
break;
|
||||
@ -640,7 +639,7 @@ bool TraceImpl::UpdateFileName(
|
||||
if (length_without_file_ending == 0) {
|
||||
length_without_file_ending = length;
|
||||
}
|
||||
WebRtc_Word32 length_to_ = length_without_file_ending - 1;
|
||||
int32_t length_to_ = length_without_file_ending - 1;
|
||||
while (length_to_ > 0) {
|
||||
if (file_name_utf8[length_to_] == '_') {
|
||||
break;
|
||||
@ -659,13 +658,13 @@ bool TraceImpl::UpdateFileName(
|
||||
bool TraceImpl::CreateFileName(
|
||||
const char file_name_utf8[FileWrapper::kMaxFileNameSize],
|
||||
char file_name_with_counter_utf8[FileWrapper::kMaxFileNameSize],
|
||||
const WebRtc_UWord32 new_count) const {
|
||||
WebRtc_Word32 length = (WebRtc_Word32)strlen(file_name_utf8);
|
||||
const uint32_t new_count) const {
|
||||
int32_t length = (int32_t)strlen(file_name_utf8);
|
||||
if (length < 0) {
|
||||
return false;
|
||||
}
|
||||
|
||||
WebRtc_Word32 length_without_file_ending = length - 1;
|
||||
int32_t length_without_file_ending = length - 1;
|
||||
while (length_without_file_ending > 0) {
|
||||
if (file_name_utf8[length_without_file_ending] == '.') {
|
||||
break;
|
||||
@ -692,17 +691,17 @@ void Trace::ReturnTrace() {
|
||||
TraceImpl::StaticInstance(kRelease);
|
||||
}
|
||||
|
||||
WebRtc_Word32 Trace::SetLevelFilter(WebRtc_UWord32 filter) {
|
||||
int32_t Trace::SetLevelFilter(uint32_t filter) {
|
||||
level_filter = filter;
|
||||
return 0;
|
||||
}
|
||||
|
||||
WebRtc_Word32 Trace::LevelFilter(WebRtc_UWord32& filter) {
|
||||
int32_t Trace::LevelFilter(uint32_t& filter) {
|
||||
filter = level_filter;
|
||||
return 0;
|
||||
}
|
||||
|
||||
WebRtc_Word32 Trace::TraceFile(char file_name[FileWrapper::kMaxFileNameSize]) {
|
||||
int32_t Trace::TraceFile(char file_name[FileWrapper::kMaxFileNameSize]) {
|
||||
TraceImpl* trace = TraceImpl::GetTrace();
|
||||
if (trace) {
|
||||
int ret_val = trace->TraceFileImpl(file_name);
|
||||
@ -712,8 +711,8 @@ WebRtc_Word32 Trace::TraceFile(char file_name[FileWrapper::kMaxFileNameSize]) {
|
||||
return -1;
|
||||
}
|
||||
|
||||
WebRtc_Word32 Trace::SetTraceFile(const char* file_name,
|
||||
const bool add_file_counter) {
|
||||
int32_t Trace::SetTraceFile(const char* file_name,
|
||||
const bool add_file_counter) {
|
||||
TraceImpl* trace = TraceImpl::GetTrace();
|
||||
if (trace) {
|
||||
int ret_val = trace->SetTraceFileImpl(file_name, add_file_counter);
|
||||
@ -723,7 +722,7 @@ WebRtc_Word32 Trace::SetTraceFile(const char* file_name,
|
||||
return -1;
|
||||
}
|
||||
|
||||
WebRtc_Word32 Trace::SetTraceCallback(TraceCallback* callback) {
|
||||
int32_t Trace::SetTraceCallback(TraceCallback* callback) {
|
||||
TraceImpl* trace = TraceImpl::GetTrace();
|
||||
if (trace) {
|
||||
int ret_val = trace->SetTraceCallbackImpl(callback);
|
||||
@ -734,7 +733,7 @@ WebRtc_Word32 Trace::SetTraceCallback(TraceCallback* callback) {
|
||||
}
|
||||
|
||||
void Trace::Add(const TraceLevel level, const TraceModule module,
|
||||
const WebRtc_Word32 id, const char* msg, ...) {
|
||||
const int32_t id, const char* msg, ...) {
|
||||
TraceImpl* trace = TraceImpl::GetTrace(level);
|
||||
if (trace) {
|
||||
if (trace->TraceCheck(level)) {
|
||||
|
@ -48,15 +48,13 @@ class TraceImpl : public Trace {
|
||||
static TraceImpl* CreateInstance();
|
||||
static TraceImpl* GetTrace(const TraceLevel level = kTraceAll);
|
||||
|
||||
WebRtc_Word32 SetTraceFileImpl(const char* file_name,
|
||||
const bool add_file_counter);
|
||||
WebRtc_Word32 TraceFileImpl(
|
||||
char file_name[FileWrapper::kMaxFileNameSize]);
|
||||
int32_t SetTraceFileImpl(const char* file_name, const bool add_file_counter);
|
||||
int32_t TraceFileImpl(char file_name[FileWrapper::kMaxFileNameSize]);
|
||||
|
||||
WebRtc_Word32 SetTraceCallbackImpl(TraceCallback* callback);
|
||||
int32_t SetTraceCallbackImpl(TraceCallback* callback);
|
||||
|
||||
void AddImpl(const TraceLevel level, const TraceModule module,
|
||||
const WebRtc_Word32 id, const char* msg);
|
||||
const int32_t id, const char* msg);
|
||||
|
||||
bool StopThread();
|
||||
|
||||
@ -68,14 +66,14 @@ class TraceImpl : public Trace {
|
||||
static TraceImpl* StaticInstance(CountOperation count_operation,
|
||||
const TraceLevel level = kTraceAll);
|
||||
|
||||
WebRtc_Word32 AddThreadId(char* trace_message) const;
|
||||
int32_t AddThreadId(char* trace_message) const;
|
||||
|
||||
// OS specific implementations.
|
||||
virtual WebRtc_Word32 AddTime(char* trace_message,
|
||||
const TraceLevel level) const = 0;
|
||||
virtual int32_t AddTime(char* trace_message,
|
||||
const TraceLevel level) const = 0;
|
||||
|
||||
virtual WebRtc_Word32 AddBuildInfo(char* trace_message) const = 0;
|
||||
virtual WebRtc_Word32 AddDateTimeInfo(char* trace_message) const = 0;
|
||||
virtual int32_t AddBuildInfo(char* trace_message) const = 0;
|
||||
virtual int32_t AddDateTimeInfo(char* trace_message) const = 0;
|
||||
|
||||
static bool Run(void* obj);
|
||||
bool Process();
|
||||
@ -83,36 +81,36 @@ class TraceImpl : public Trace {
|
||||
private:
|
||||
friend class Trace;
|
||||
|
||||
WebRtc_Word32 AddLevel(char* sz_message, const TraceLevel level) const;
|
||||
int32_t AddLevel(char* sz_message, const TraceLevel level) const;
|
||||
|
||||
WebRtc_Word32 AddModuleAndId(char* trace_message, const TraceModule module,
|
||||
const WebRtc_Word32 id) const;
|
||||
int32_t AddModuleAndId(char* trace_message, const TraceModule module,
|
||||
const int32_t id) const;
|
||||
|
||||
WebRtc_Word32 AddMessage(char* trace_message,
|
||||
const char msg[WEBRTC_TRACE_MAX_MESSAGE_SIZE],
|
||||
const WebRtc_UWord16 written_so_far) const;
|
||||
int32_t AddMessage(char* trace_message,
|
||||
const char msg[WEBRTC_TRACE_MAX_MESSAGE_SIZE],
|
||||
const uint16_t written_so_far) const;
|
||||
|
||||
void AddMessageToList(
|
||||
const char trace_message[WEBRTC_TRACE_MAX_MESSAGE_SIZE],
|
||||
const WebRtc_UWord16 length,
|
||||
const uint16_t length,
|
||||
const TraceLevel level);
|
||||
|
||||
bool UpdateFileName(
|
||||
const char file_name_utf8[FileWrapper::kMaxFileNameSize],
|
||||
char file_name_with_counter_utf8[FileWrapper::kMaxFileNameSize],
|
||||
const WebRtc_UWord32 new_count) const;
|
||||
const uint32_t new_count) const;
|
||||
|
||||
bool CreateFileName(
|
||||
const char file_name_utf8[FileWrapper::kMaxFileNameSize],
|
||||
char file_name_with_counter_utf8[FileWrapper::kMaxFileNameSize],
|
||||
const WebRtc_UWord32 new_count) const;
|
||||
const uint32_t new_count) const;
|
||||
|
||||
void WriteToFile();
|
||||
|
||||
CriticalSectionWrapper* critsect_interface_;
|
||||
TraceCallback* callback_;
|
||||
WebRtc_UWord32 row_count_text_;
|
||||
WebRtc_UWord32 file_count_text_;
|
||||
uint32_t row_count_text_;
|
||||
uint32_t file_count_text_;
|
||||
|
||||
FileWrapper& trace_file_;
|
||||
ThreadWrapper& thread_;
|
||||
@ -120,11 +118,11 @@ class TraceImpl : public Trace {
|
||||
|
||||
// critsect_array_ protects active_queue_.
|
||||
CriticalSectionWrapper* critsect_array_;
|
||||
WebRtc_UWord16 next_free_idx_[WEBRTC_TRACE_NUM_ARRAY];
|
||||
uint16_t next_free_idx_[WEBRTC_TRACE_NUM_ARRAY];
|
||||
TraceLevel level_[WEBRTC_TRACE_NUM_ARRAY][WEBRTC_TRACE_MAX_QUEUE];
|
||||
WebRtc_UWord16 length_[WEBRTC_TRACE_NUM_ARRAY][WEBRTC_TRACE_MAX_QUEUE];
|
||||
uint16_t length_[WEBRTC_TRACE_NUM_ARRAY][WEBRTC_TRACE_MAX_QUEUE];
|
||||
char* message_queue_[WEBRTC_TRACE_NUM_ARRAY][WEBRTC_TRACE_MAX_QUEUE];
|
||||
WebRtc_UWord8 active_queue_;
|
||||
uint8_t active_queue_;
|
||||
};
|
||||
|
||||
} // namespace webrtc
|
||||
|
@ -18,29 +18,29 @@ void Trace::CreateTrace() {
|
||||
void Trace::ReturnTrace() {
|
||||
}
|
||||
|
||||
WebRtc_Word32 Trace::SetLevelFilter(WebRtc_UWord32 filter) {
|
||||
int32_t Trace::SetLevelFilter(uint32_t filter) {
|
||||
return 0;
|
||||
}
|
||||
|
||||
WebRtc_Word32 Trace::LevelFilter(WebRtc_UWord32& filter) {
|
||||
int32_t Trace::LevelFilter(uint32_t& filter) {
|
||||
return 0;
|
||||
}
|
||||
|
||||
WebRtc_Word32 Trace::TraceFile(char file_name[1024]) {
|
||||
int32_t Trace::TraceFile(char file_name[1024]) {
|
||||
return -1;
|
||||
}
|
||||
|
||||
WebRtc_Word32 Trace::SetTraceFile(const char* file_name,
|
||||
const bool add_file_counter) {
|
||||
int32_t Trace::SetTraceFile(const char* file_name,
|
||||
const bool add_file_counter) {
|
||||
return -1;
|
||||
}
|
||||
|
||||
WebRtc_Word32 Trace::SetTraceCallback(TraceCallback* callback) {
|
||||
int32_t Trace::SetTraceCallback(TraceCallback* callback) {
|
||||
return -1;
|
||||
}
|
||||
|
||||
void Trace::Add(const TraceLevel level, const TraceModule module,
|
||||
const WebRtc_Word32 id, const char* msg, ...) {
|
||||
const int32_t id, const char* msg, ...) {
|
||||
}
|
||||
|
||||
} // namespace webrtc
|
||||
|
@ -50,8 +50,7 @@ TracePosix::~TracePosix() {
|
||||
StopThread();
|
||||
}
|
||||
|
||||
WebRtc_Word32 TracePosix::AddTime(char* trace_message,
|
||||
const TraceLevel level) const {
|
||||
int32_t TracePosix::AddTime(char* trace_message, const TraceLevel level) const {
|
||||
struct timeval system_time_high_res;
|
||||
if (gettimeofday(&system_time_high_res, 0) == -1) {
|
||||
return -1;
|
||||
@ -60,8 +59,8 @@ WebRtc_Word32 TracePosix::AddTime(char* trace_message,
|
||||
const struct tm* system_time =
|
||||
localtime_r(&system_time_high_res.tv_sec, &buffer);
|
||||
|
||||
const WebRtc_UWord32 ms_time = system_time_high_res.tv_usec / 1000;
|
||||
WebRtc_UWord32 prev_tickCount = 0;
|
||||
const uint32_t ms_time = system_time_high_res.tv_usec / 1000;
|
||||
uint32_t prev_tickCount = 0;
|
||||
{
|
||||
CriticalSectionScoped lock(&crit_sect_);
|
||||
if (level == kTraceApiCall) {
|
||||
@ -73,7 +72,7 @@ WebRtc_Word32 TracePosix::AddTime(char* trace_message,
|
||||
}
|
||||
}
|
||||
|
||||
WebRtc_UWord32 dw_delta_time = ms_time - prev_tickCount;
|
||||
uint32_t dw_delta_time = ms_time - prev_tickCount;
|
||||
if (prev_tickCount == 0) {
|
||||
dw_delta_time = 0;
|
||||
}
|
||||
@ -92,18 +91,18 @@ WebRtc_Word32 TracePosix::AddTime(char* trace_message,
|
||||
return 22;
|
||||
}
|
||||
|
||||
WebRtc_Word32 TracePosix::AddBuildInfo(char* trace_message) const {
|
||||
int32_t TracePosix::AddBuildInfo(char* trace_message) const {
|
||||
sprintf(trace_message, "Build info: %s", BUILDINFO);
|
||||
// Include NULL termination (hence + 1).
|
||||
return strlen(trace_message) + 1;
|
||||
}
|
||||
|
||||
WebRtc_Word32 TracePosix::AddDateTimeInfo(char* trace_message) const {
|
||||
int32_t TracePosix::AddDateTimeInfo(char* trace_message) const {
|
||||
time_t t;
|
||||
time(&t);
|
||||
char buffer[26]; // man ctime says buffer should have room for >=26 bytes.
|
||||
sprintf(trace_message, "Local Date: %s", ctime_r(&t, buffer));
|
||||
WebRtc_Word32 len = static_cast<WebRtc_Word32>(strlen(trace_message));
|
||||
int32_t len = static_cast<int32_t>(strlen(trace_message));
|
||||
|
||||
if ('\n' == trace_message[len - 1]) {
|
||||
trace_message[len - 1] = '\0';
|
||||
|
@ -23,15 +23,14 @@ class TracePosix : public TraceImpl {
|
||||
|
||||
// This method can be called on several different threads different from
|
||||
// the creating thread.
|
||||
virtual WebRtc_Word32 AddTime(char* trace_message,
|
||||
const TraceLevel level) const;
|
||||
virtual int32_t AddTime(char* trace_message, const TraceLevel level) const;
|
||||
|
||||
virtual WebRtc_Word32 AddBuildInfo(char* trace_message) const;
|
||||
virtual WebRtc_Word32 AddDateTimeInfo(char* trace_message) const;
|
||||
virtual int32_t AddBuildInfo(char* trace_message) const;
|
||||
virtual int32_t AddDateTimeInfo(char* trace_message) const;
|
||||
|
||||
private:
|
||||
volatile mutable WebRtc_UWord32 prev_api_tick_count_;
|
||||
volatile mutable WebRtc_UWord32 prev_tick_count_;
|
||||
volatile mutable uint32_t prev_api_tick_count_;
|
||||
volatile mutable uint32_t prev_tick_count_;
|
||||
|
||||
CriticalSectionWrapper& crit_sect_;
|
||||
};
|
||||
|
@ -39,14 +39,14 @@ TraceWindows::~TraceWindows() {
|
||||
StopThread();
|
||||
}
|
||||
|
||||
WebRtc_Word32 TraceWindows::AddTime(char* trace_message,
|
||||
const TraceLevel level) const {
|
||||
WebRtc_UWord32 dw_current_time = timeGetTime();
|
||||
int32_t TraceWindows::AddTime(char* trace_message,
|
||||
const TraceLevel level) const {
|
||||
uint32_t dw_current_time = timeGetTime();
|
||||
SYSTEMTIME system_time;
|
||||
GetSystemTime(&system_time);
|
||||
|
||||
if (level == kTraceApiCall) {
|
||||
WebRtc_UWord32 dw_delta_time = dw_current_time - prev_tick_count_;
|
||||
uint32_t dw_delta_time = dw_current_time - prev_tick_count_;
|
||||
prev_tick_count_ = dw_current_time;
|
||||
|
||||
if (prev_tick_count_ == 0) {
|
||||
@ -64,7 +64,7 @@ WebRtc_Word32 TraceWindows::AddTime(char* trace_message,
|
||||
system_time.wMinute, system_time.wSecond,
|
||||
system_time.wMilliseconds, dw_delta_time);
|
||||
} else {
|
||||
WebRtc_UWord32 dw_delta_time = dw_current_time - prev_api_tick_count_;
|
||||
uint32_t dw_delta_time = dw_current_time - prev_api_tick_count_;
|
||||
prev_api_tick_count_ = dw_current_time;
|
||||
|
||||
if (prev_api_tick_count_ == 0) {
|
||||
@ -84,14 +84,14 @@ WebRtc_Word32 TraceWindows::AddTime(char* trace_message,
|
||||
return 22;
|
||||
}
|
||||
|
||||
WebRtc_Word32 TraceWindows::AddBuildInfo(char* trace_message) const {
|
||||
int32_t TraceWindows::AddBuildInfo(char* trace_message) const {
|
||||
// write data and time to text file
|
||||
sprintf(trace_message, "Build info: %s", BUILDINFO);
|
||||
// Include NULL termination (hence + 1).
|
||||
return static_cast<WebRtc_Word32>(strlen(trace_message) + 1);
|
||||
return static_cast<int32_t>(strlen(trace_message) + 1);
|
||||
}
|
||||
|
||||
WebRtc_Word32 TraceWindows::AddDateTimeInfo(char* trace_message) const {
|
||||
int32_t TraceWindows::AddDateTimeInfo(char* trace_message) const {
|
||||
prev_api_tick_count_ = timeGetTime();
|
||||
prev_tick_count_ = prev_api_tick_count_;
|
||||
|
||||
@ -113,7 +113,7 @@ WebRtc_Word32 TraceWindows::AddDateTimeInfo(char* trace_message) const {
|
||||
sz_time_str);
|
||||
|
||||
// Include NULL termination (hence + 1).
|
||||
return static_cast<WebRtc_Word32>(strlen(trace_message) + 1);
|
||||
return static_cast<int32_t>(strlen(trace_message) + 1);
|
||||
}
|
||||
|
||||
} // namespace webrtc
|
||||
|
@ -23,14 +23,13 @@ class TraceWindows : public TraceImpl {
|
||||
TraceWindows();
|
||||
virtual ~TraceWindows();
|
||||
|
||||
virtual WebRtc_Word32 AddTime(char* trace_message,
|
||||
const TraceLevel level) const;
|
||||
virtual int32_t AddTime(char* trace_message, const TraceLevel level) const;
|
||||
|
||||
virtual WebRtc_Word32 AddBuildInfo(char* trace_message) const;
|
||||
virtual WebRtc_Word32 AddDateTimeInfo(char* trace_message) const;
|
||||
virtual int32_t AddBuildInfo(char* trace_message) const;
|
||||
virtual int32_t AddDateTimeInfo(char* trace_message) const;
|
||||
private:
|
||||
volatile mutable WebRtc_UWord32 prev_api_tick_count_;
|
||||
volatile mutable WebRtc_UWord32 prev_tick_count_;
|
||||
volatile mutable uint32_t prev_api_tick_count_;
|
||||
volatile mutable uint32_t prev_tick_count_;
|
||||
};
|
||||
|
||||
} // namespace webrtc
|
||||
|
@ -132,7 +132,7 @@ void RunSortTest(webrtc::Type sortType, bool keySort)
|
||||
KeyType keyRef[DataLength];
|
||||
LotsOfData<KeyType> data[DataLength];
|
||||
LotsOfData<KeyType> dataRef[DataLength];
|
||||
WebRtc_Word32 retVal = 0;
|
||||
int32_t retVal = 0;
|
||||
|
||||
if (keySort)
|
||||
{
|
||||
@ -235,7 +235,7 @@ void RunSortTest(webrtc::Type sortType, bool keySort)
|
||||
|
||||
printf("Compliance test passed over %d iterations\n", NumOfTests);
|
||||
|
||||
WebRtc_Word64 executeTime = accTicks.Milliseconds();
|
||||
int64_t executeTime = accTicks.Milliseconds();
|
||||
printf("Execute time: %.2f s\n\n", (float)executeTime / 1000);
|
||||
}
|
||||
|
||||
@ -245,14 +245,14 @@ int main()
|
||||
srand(42);
|
||||
bool keySort = false;
|
||||
for (int i = 0; i < 2; i++) {
|
||||
RunSortTest<WebRtc_Word8>(webrtc::TYPE_Word8, keySort);
|
||||
RunSortTest<WebRtc_UWord8>(webrtc::TYPE_UWord8, keySort);
|
||||
RunSortTest<WebRtc_Word16>(webrtc::TYPE_Word16, keySort);
|
||||
RunSortTest<WebRtc_UWord16>(webrtc::TYPE_UWord16, keySort);
|
||||
RunSortTest<WebRtc_Word32>(webrtc::TYPE_Word32, keySort);
|
||||
RunSortTest<WebRtc_UWord32>(webrtc::TYPE_UWord32, keySort);
|
||||
RunSortTest<WebRtc_Word64>(webrtc::TYPE_Word64, keySort);
|
||||
RunSortTest<WebRtc_UWord64>(webrtc::TYPE_UWord64, keySort);
|
||||
RunSortTest<int8_t>(webrtc::TYPE_Word8, keySort);
|
||||
RunSortTest<uint8_t>(webrtc::TYPE_UWord8, keySort);
|
||||
RunSortTest<int16_t>(webrtc::TYPE_Word16, keySort);
|
||||
RunSortTest<uint16_t>(webrtc::TYPE_UWord16, keySort);
|
||||
RunSortTest<int32_t>(webrtc::TYPE_Word32, keySort);
|
||||
RunSortTest<uint32_t>(webrtc::TYPE_UWord32, keySort);
|
||||
RunSortTest<int64_t>(webrtc::TYPE_Word64, keySort);
|
||||
RunSortTest<uint64_t>(webrtc::TYPE_UWord64, keySort);
|
||||
RunSortTest<float>(webrtc::TYPE_Float32, keySort);
|
||||
RunSortTest<double>(webrtc::TYPE_Float64, keySort);
|
||||
|
||||
|
Loading…
x
Reference in New Issue
Block a user