Commit 5a080f01 authored by avi's avatar avi Committed by Commit bot

Switch to standard integer types in remoting/.

BUG=138542
TBR=wez@chromium.org

Review URL: https://codereview.chromium.org/1542203002

Cr-Commit-Position: refs/heads/master@{#366684}
parent 4bcdaa93
......@@ -6,10 +6,11 @@
#include "base/bind.h"
#include "base/lazy_instance.h"
#include "base/synchronization/waitable_event.h"
#include "base/third_party/dynamic_annotations/dynamic_annotations.h"
#include "base/threading/thread_local.h"
#include "base/threading/thread_restrictions.h"
#include "base/synchronization/waitable_event.h"
#include "build/build_config.h"
#include "remoting/base/auto_thread_task_runner.h"
#if defined(OS_WIN)
......
......@@ -7,8 +7,10 @@
#include <string>
#include "base/macros.h"
#include "base/message_loop/message_loop.h"
#include "base/threading/platform_thread.h"
#include "build/build_config.h"
#include "remoting/base/auto_thread_task_runner.h"
namespace remoting {
......
......@@ -5,8 +5,8 @@
#ifndef REMOTING_BASE_AUTO_THREAD_TASK_RUNNER_H_
#define REMOTING_BASE_AUTO_THREAD_TASK_RUNNER_H_
#include "base/basictypes.h"
#include "base/callback.h"
#include "base/macros.h"
#include "base/memory/scoped_ptr.h"
#include "base/message_loop/message_loop.h"
#include "base/single_thread_task_runner.h"
......
......@@ -6,6 +6,7 @@
#include "base/files/file_path.h"
#include "base/memory/ref_counted.h"
#include "base/scoped_native_library.h"
#include "build/build_config.h"
#include "remoting/base/auto_thread.h"
#include "testing/gtest/include/gtest/gtest.h"
......
......@@ -16,6 +16,7 @@
#include "base/file_version_info.h"
#include "base/lazy_instance.h"
#include "base/logging.h"
#include "base/macros.h"
#include "base/memory/scoped_ptr.h"
#include "base/process/memory.h"
#include "base/strings/utf_string_conversions.h"
......
......@@ -4,6 +4,7 @@
#include "remoting/base/buffered_socket_writer.h"
#include <stddef.h>
#include <stdlib.h>
#include "base/bind.h"
......
......@@ -7,7 +7,6 @@
#include <string>
#include "base/basictypes.h"
namespace remoting {
......
......@@ -2,9 +2,12 @@
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
#include <stddef.h>
#include <algorithm>
#include <vector>
#include "base/macros.h"
#include "base/strings/string_split.h"
#include "base/strings/string_util.h"
#include "remoting/base/capabilities.h"
......
......@@ -272,7 +272,7 @@ bool CompoundBufferInputStream::Skip(int count) {
return count == 0;
}
int64 CompoundBufferInputStream::ByteCount() const {
int64_t CompoundBufferInputStream::ByteCount() const {
return position_;
}
......
......@@ -18,9 +18,12 @@
#ifndef REMOTING_BASE_COMPOUND_BUFFER_H_
#define REMOTING_BASE_COMPOUND_BUFFER_H_
#include <stddef.h>
#include <stdint.h>
#include <deque>
#include "base/basictypes.h"
#include "base/macros.h"
#include "base/memory/ref_counted.h"
#include "google/protobuf/io/zero_copy_stream.h"
......@@ -111,7 +114,7 @@ class CompoundBufferInputStream
bool Next(const void** data, int* size) override;
void BackUp(int count) override;
bool Skip(int count) override;
int64 ByteCount() const override;
int64_t ByteCount() const override;
private:
const CompoundBuffer* buffer_;
......
......@@ -2,6 +2,9 @@
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
#include <stddef.h>
#include <stdint.h>
#include <string>
#include "base/bind.h"
......@@ -108,7 +111,7 @@ class CompoundBufferTest : public testing::Test {
static size_t ReadFromInput(CompoundBufferInputStream* input,
void* data, size_t size) {
uint8* out = reinterpret_cast<uint8*>(data);
uint8_t* out = reinterpret_cast<uint8_t*>(data);
int out_size = size;
const void* in;
......
......@@ -11,7 +11,7 @@
#include <oaidl.h>
#include "base/basictypes.h"
#include "base/macros.h"
#include "base/template_util.h"
#include "base/win/scoped_variant.h"
......
......@@ -17,6 +17,7 @@ $var MAX_ARITY = 7
#include <oaidl.h>
#include "base/basictypes.h"
#include "base/macros.h"
#include "base/template_util.h"
#include "base/win/scoped_variant.h"
......
......@@ -17,7 +17,7 @@ RateCounter::RateCounter(base::TimeDelta time_window)
RateCounter::~RateCounter() {
}
void RateCounter::Record(int64 value) {
void RateCounter::Record(int64_t value) {
DCHECK(CalledOnValidThread());
base::Time current_time = CurrentTime();
......
......@@ -5,10 +5,12 @@
#ifndef REMOTING_BASE_RATE_COUNTER_H_
#define REMOTING_BASE_RATE_COUNTER_H_
#include <stdint.h>
#include <queue>
#include <utility>
#include "base/basictypes.h"
#include "base/macros.h"
#include "base/threading/non_thread_safe.h"
#include "base/time/time.h"
......@@ -24,7 +26,7 @@ class RateCounter : public base::NonThreadSafe {
virtual ~RateCounter();
// Records a point event count to include in the rate.
void Record(int64 value);
void Record(int64_t value);
// Returns the rate-per-second of values recorded over the time window.
// Note that rates reported before |time_window| has elapsed are not accurate.
......@@ -35,7 +37,7 @@ class RateCounter : public base::NonThreadSafe {
private:
// Type used to store data points with timestamps.
typedef std::pair<base::Time, int64> DataPoint;
typedef std::pair<base::Time, int64_t> DataPoint;
// Removes data points more than |time_window| older than |current_time|.
void EvictOldDataPoints(base::Time current_time);
......@@ -50,7 +52,7 @@ class RateCounter : public base::NonThreadSafe {
std::queue<DataPoint> data_points_;
// Sum of values in |data_points_|.
int64 sum_;
int64_t sum_;
// If set, used to calculate the running average, in place of Now().
base::Time current_time_for_test_;
......
......@@ -2,12 +2,16 @@
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
#include <stddef.h>
#include <stdint.h>
#include "base/macros.h"
#include "remoting/base/rate_counter.h"
#include "testing/gtest/include/gtest/gtest.h"
namespace remoting {
static const int64 kTestValues[] = { 10, 20, 30, 10, 25, 16, 15 };
static const int64_t kTestValues[] = { 10, 20, 30, 10, 25, 16, 15 };
// One second window and one sample per second, so rate equals each sample.
TEST(RateCounterTest, OneSecondWindow) {
......
......@@ -4,6 +4,8 @@
#include "remoting/base/rsa_key_pair.h"
#include <stdint.h>
#include <limits>
#include <string>
#include <vector>
......@@ -44,7 +46,7 @@ scoped_refptr<RsaKeyPair> RsaKeyPair::FromString(
return NULL;
}
std::vector<uint8> key_buf(key_str.begin(), key_str.end());
std::vector<uint8_t> key_buf(key_str.begin(), key_str.end());
scoped_ptr<crypto::RSAPrivateKey> key(
crypto::RSAPrivateKey::CreateFromPrivateKeyInfo(key_buf));
if (!key) {
......@@ -59,7 +61,7 @@ std::string RsaKeyPair::ToString() const {
// Check that the key initialized.
DCHECK(key_.get() != NULL);
std::vector<uint8> key_buf;
std::vector<uint8_t> key_buf;
CHECK(key_->ExportPrivateKey(&key_buf));
std::string key_str(key_buf.begin(), key_buf.end());
std::string key_base64;
......@@ -68,7 +70,7 @@ std::string RsaKeyPair::ToString() const {
}
std::string RsaKeyPair::GetPublicKey() const {
std::vector<uint8> public_key;
std::vector<uint8_t> public_key;
CHECK(key_->ExportPublicKey(&public_key));
std::string public_key_str(public_key.begin(), public_key.end());
std::string public_key_base64;
......@@ -80,9 +82,9 @@ std::string RsaKeyPair::SignMessage(const std::string& message) const {
scoped_ptr<crypto::SignatureCreator> signature_creator(
crypto::SignatureCreator::Create(key_.get(),
crypto::SignatureCreator::SHA1));
signature_creator->Update(reinterpret_cast<const uint8*>(message.c_str()),
signature_creator->Update(reinterpret_cast<const uint8_t*>(message.c_str()),
message.length());
std::vector<uint8> signature_buf;
std::vector<uint8_t> signature_buf;
signature_creator->Final(&signature_buf);
std::string signature_str(signature_buf.begin(), signature_buf.end());
std::string signature_base64;
......
......@@ -7,6 +7,7 @@
#include <string>
#include "base/macros.h"
#include "base/memory/ref_counted.h"
#include "base/memory/scoped_ptr.h"
......
......@@ -5,9 +5,12 @@
#ifndef REMOTING_BASE_RUNNING_AVERAGE_H_
#define REMOTING_BASE_RUNNING_AVERAGE_H_
#include <stddef.h>
#include <stdint.h>
#include <deque>
#include "base/basictypes.h"
#include "base/macros.h"
#include "base/threading/thread_checker.h"
namespace remoting {
......
......@@ -2,12 +2,16 @@
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
#include <stddef.h>
#include <stdint.h>
#include "base/macros.h"
#include "remoting/base/running_average.h"
#include "testing/gtest/include/gtest/gtest.h"
namespace remoting {
static const int64 kTestValues[] = { 10, 20, 30, 10, 25, 16, 15 };
static const int64_t kTestValues[] = { 10, 20, 30, 10, 25, 16, 15 };
// Average across a single element, i.e. just return the most recent.
TEST(RunningAverageTest, OneElementWindow) {
......
......@@ -7,6 +7,7 @@
#include <windows.h>
#include "base/macros.h"
#include "base/win/scoped_handle.h"
namespace remoting {
......
......@@ -7,7 +7,7 @@
#include <string>
#include "base/basictypes.h"
#include "base/macros.h"
#include "base/memory/singleton.h"
namespace remoting {
......
......@@ -5,9 +5,10 @@
#ifndef REMOTING_BASE_SOCKET_READER_H_
#define REMOTING_BASE_SOCKET_READER_H_
#include "base/macros.h"
#include "base/memory/ref_counted.h"
#include "net/base/completion_callback.h"
#include "base/memory/weak_ptr.h"
#include "net/base/completion_callback.h"
namespace net {
class IOBuffer;
......
......@@ -6,10 +6,10 @@
#define REMOTING_BASE_TYPED_BUFFER_H_
#include <assert.h>
#include <stdint.h>
#include <algorithm>
#include "base/basictypes.h"
#include "base/logging.h"
#include "base/move.h"
......@@ -27,16 +27,16 @@ class TypedBuffer {
TypedBuffer() : TypedBuffer(0) {}
// Creates an instance of the object allocating a buffer of the given size.
explicit TypedBuffer(uint32 length) : buffer_(NULL), length_(length) {
explicit TypedBuffer(uint32_t length) : buffer_(NULL), length_(length) {
if (length_ > 0)
buffer_ = reinterpret_cast<T*>(new uint8[length_]);
buffer_ = reinterpret_cast<T*>(new uint8_t[length_]);
}
TypedBuffer(TypedBuffer&& rvalue) : TypedBuffer() { Swap(rvalue); }
~TypedBuffer() {
if (buffer_) {
delete[] reinterpret_cast<uint8*>(buffer_);
delete[] reinterpret_cast<uint8_t*>(buffer_);
buffer_ = NULL;
}
}
......@@ -58,12 +58,12 @@ class TypedBuffer {
}
T* get() const { return buffer_; }
uint32 length() const { return length_; }
uint32_t length() const { return length_; }
// Helper returning a pointer to the structure starting at a specified byte
// offset.
T* GetAtOffset(uint32 offset) {
return reinterpret_cast<T*>(reinterpret_cast<uint8*>(buffer_) + offset);
T* GetAtOffset(uint32_t offset) {
return reinterpret_cast<T*>(reinterpret_cast<uint8_t*>(buffer_) + offset);
}
// Allow TypedBuffer<T> to be used in boolean expressions, but not
......@@ -82,7 +82,7 @@ class TypedBuffer {
T* buffer_;
// Length of the owned buffer in bytes.
uint32 length_;
uint32_t length_;
};
} // namespace remoting
......
......@@ -5,7 +5,7 @@
#ifndef REMOTING_BASE_URL_REQUEST_CONTEXT_GETTER_H_
#define REMOTING_BASE_URL_REQUEST_CONTEXT_GETTER_H_
#include "base/basictypes.h"
#include "base/macros.h"
#include "base/memory/scoped_ptr.h"
#include "net/url_request/url_request_context_getter.h"
......
......@@ -5,6 +5,7 @@
#ifndef REMOTING_BASE_UTIL_H_
#define REMOTING_BASE_UTIL_H_
#include <stddef.h>
#include <stdint.h>
#include <string>
......
......@@ -2,6 +2,8 @@
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
#include <stddef.h>
#include <algorithm>
#include "remoting/base/util.h"
......
......@@ -6,6 +6,7 @@
#include "base/json/json_writer.h"
#include "base/logging.h"
#include "base/macros.h"
#include "base/memory/scoped_ptr.h"
#include "base/threading/thread_restrictions.h"
#include "base/time/time.h"
......
......@@ -5,6 +5,7 @@
#ifndef REMOTING_BASE_VLOG_NET_LOG_H_
#define REMOTING_BASE_VLOG_NET_LOG_H_
#include "base/macros.h"
#include "base/memory/scoped_ptr.h"
#include "net/log/net_log.h"
......
......@@ -6,6 +6,7 @@
#include "base/bind.h"
#include "base/location.h"
#include "base/macros.h"
#include "base/single_thread_task_runner.h"
#include "remoting/client/audio_player.h"
#include "remoting/codec/audio_decoder.h"
......
......@@ -5,6 +5,7 @@
#ifndef REMOTING_CLIENT_AUDIO_DECODE_SCHEDULER_H_
#define REMOTING_CLIENT_AUDIO_DECODE_SCHEDULER_H_
#include "base/macros.h"
#include "base/memory/ref_counted.h"
#include "base/memory/scoped_ptr.h"
#include "remoting/protocol/audio_stub.h"
......
......@@ -80,7 +80,7 @@ void AudioPlayer::ProcessAudioPacket(scoped_ptr<AudioPacket> packet) {
// static
void AudioPlayer::AudioPlayerCallback(void* samples,
uint32 buffer_size,
uint32_t buffer_size,
void* data) {
AudioPlayer* audio_player = static_cast<AudioPlayer*>(data);
audio_player->FillWithSamples(samples, buffer_size);
......@@ -93,7 +93,7 @@ void AudioPlayer::ResetQueue() {
bytes_consumed_ = 0;
}
void AudioPlayer::FillWithSamples(void* samples, uint32 buffer_size) {
void AudioPlayer::FillWithSamples(void* samples, uint32_t buffer_size) {
base::AutoLock auto_lock(lock_);
const size_t bytes_needed = kChannels * kSampleSizeBytes *
......
......@@ -5,8 +5,12 @@
#ifndef REMOTING_CLIENT_AUDIO_PLAYER_H_
#define REMOTING_CLIENT_AUDIO_PLAYER_H_
#include <stddef.h>
#include <stdint.h>
#include <list>
#include "base/macros.h"
#include "base/memory/scoped_ptr.h"
#include "base/synchronization/lock.h"
#include "remoting/proto/audio.pb.h"
......@@ -23,7 +27,7 @@ class AudioPlayer {
AudioPlayer();
// Return the recommended number of samples to include in a frame.
virtual uint32 GetSamplesPerFrame() = 0;
virtual uint32_t GetSamplesPerFrame() = 0;
// Resets the audio player and starts playback.
// Returns true on success.
......@@ -31,7 +35,7 @@ class AudioPlayer {
// Function called by the browser when it needs more audio samples.
static void AudioPlayerCallback(void* samples,
uint32 buffer_size,
uint32_t buffer_size,
void* data);
private:
......@@ -40,7 +44,7 @@ class AudioPlayer {
typedef std::list<AudioPacket*> AudioPacketQueue;
void ResetQueue();
void FillWithSamples(void* samples, uint32 buffer_size);
void FillWithSamples(void* samples, uint32_t buffer_size);
AudioPacket::SamplingRate sampling_rate_;
......
......@@ -4,6 +4,8 @@
#include "remoting/client/audio_player.h"
#include <stdint.h>
#include "base/compiler_specific.h"
#include "base/memory/scoped_ptr.h"
#include "testing/gtest/include/gtest/gtest.h"
......@@ -17,8 +19,8 @@ const int kPaddingBytes = 16;
// TODO(garykac): Generate random audio data in the tests rather than having
// a single constant value.
const uint8 kDefaultBufferData = 0x5A;
const uint8 kDummyAudioData = 0x8B;
const uint8_t kDefaultBufferData = 0x5A;
const uint8_t kDummyAudioData = 0x8B;
} // namespace
......@@ -31,7 +33,7 @@ class FakeAudioPlayer : public AudioPlayer {
bool ResetAudioPlayer(AudioPacket::SamplingRate) override { return true; }
uint32 GetSamplesPerFrame() override { return kAudioSamplesPerFrame; }
uint32_t GetSamplesPerFrame() override { return kAudioSamplesPerFrame; }
};
class AudioPlayerTest : public ::testing::Test {
......@@ -44,7 +46,7 @@ class AudioPlayerTest : public ::testing::Test {
void TearDown() override {}
void ConsumeAudioFrame() {
uint8* buffer = reinterpret_cast<uint8*>(buffer_.get());
uint8_t* buffer = reinterpret_cast<uint8_t*>(buffer_.get());
memset(buffer, kDefaultBufferData, kAudioFrameBytes + kPaddingBytes);
AudioPlayer::AudioPlayerCallback(reinterpret_cast<void*>(buffer_.get()),
kAudioFrameBytes,
......@@ -57,7 +59,7 @@ class AudioPlayerTest : public ::testing::Test {
// Check that the first |num_bytes| bytes are filled with audio data and
// the rest of the buffer is zero-filled.
void CheckAudioFrameBytes(int num_bytes) {
uint8* buffer = reinterpret_cast<uint8*>(buffer_.get());
uint8_t* buffer = reinterpret_cast<uint8_t*>(buffer_.get());
int i = 0;
for (; i < num_bytes; i++) {
ASSERT_EQ(kDummyAudioData, *(buffer + i));
......
......@@ -10,6 +10,7 @@
#include <string>
#include "base/callback.h"
#include "base/macros.h"
#include "base/memory/scoped_ptr.h"
#include "remoting/protocol/client_stub.h"
#include "remoting/protocol/clipboard_stub.h"
......
......@@ -7,6 +7,7 @@
#include <string>
#include "base/macros.h"
#include "base/threading/thread.h"
namespace base {
......
......@@ -5,6 +5,7 @@
#ifndef REMOTING_CLIENT_CLIENT_STATUS_LOGGER_H_
#define REMOTING_CLIENT_CLIENT_STATUS_LOGGER_H_
#include "base/macros.h"
#include "base/threading/non_thread_safe.h"
#include "base/time/time.h"
#include "remoting/protocol/connection_to_host.h"
......
......@@ -7,7 +7,6 @@
#include <string>
#include "base/basictypes.h"
#include "base/memory/scoped_ptr.h"
#include "remoting/protocol/connection_to_host.h"
#include "remoting/protocol/third_party_client_authenticator.h"
......
......@@ -4,8 +4,11 @@
#include "remoting/client/empty_cursor_filter.h"
#include <stdint.h>
#include <algorithm>
#include "build/build_config.h"
#include "remoting/proto/control.pb.h"
namespace remoting {
......
......@@ -5,6 +5,7 @@
#ifndef REMOTING_CLIENT_EMPTY_CURSOR_FILTER_H_
#define REMOTING_CLIENT_EMPTY_CURSOR_FILTER_H_