Commit fab15259 authored by Dave Tapuska's avatar Dave Tapuska Committed by Commit Bot

Fix 64 bit truncation errors in modules

Use wtf_size_t as opposed to size_t

BUG=879657

Change-Id: If00143969f0c18bbfb54b6b602e5b915e756dd3b
Reviewed-on: https://chromium-review.googlesource.com/c/1349750Reviewed-by: default avatarKentaro Hara <haraken@chromium.org>
Commit-Queue: Dave Tapuska <dtapuska@chromium.org>
Cr-Commit-Position: refs/heads/master@{#610647}
parent e8e79c7c
...@@ -440,16 +440,17 @@ static ARIARoleMap* CreateARIARoleMap() { ...@@ -440,16 +440,17 @@ static ARIARoleMap* CreateARIARoleMap() {
static Vector<AtomicString>* CreateRoleNameVector() { static Vector<AtomicString>* CreateRoleNameVector() {
Vector<AtomicString>* role_name_vector = Vector<AtomicString>* role_name_vector =
new Vector<AtomicString>(base::size(kInternalRoles)); new Vector<AtomicString>(base::size(kInternalRoles));
for (size_t i = 0; i < base::size(kInternalRoles); i++) for (wtf_size_t i = 0; i < base::size(kInternalRoles); i++)
(*role_name_vector)[i] = g_null_atom; (*role_name_vector)[i] = g_null_atom;
for (size_t i = 0; i < base::size(kRoles); ++i) { for (wtf_size_t i = 0; i < base::size(kRoles); ++i) {
(*role_name_vector)[static_cast<size_t>(kRoles[i].webcore_role)] = (*role_name_vector)[static_cast<wtf_size_t>(kRoles[i].webcore_role)] =
AtomicString(kRoles[i].aria_role); AtomicString(kRoles[i].aria_role);
} }
for (size_t i = 0; i < base::size(kReverseRoles); ++i) { for (wtf_size_t i = 0; i < base::size(kReverseRoles); ++i) {
(*role_name_vector)[static_cast<size_t>(kReverseRoles[i].webcore_role)] = (*role_name_vector)[static_cast<wtf_size_t>(
kReverseRoles[i].webcore_role)] =
AtomicString(kReverseRoles[i].aria_role); AtomicString(kReverseRoles[i].aria_role);
} }
...@@ -459,8 +460,8 @@ static Vector<AtomicString>* CreateRoleNameVector() { ...@@ -459,8 +460,8 @@ static Vector<AtomicString>* CreateRoleNameVector() {
static Vector<AtomicString>* CreateInternalRoleNameVector() { static Vector<AtomicString>* CreateInternalRoleNameVector() {
Vector<AtomicString>* internal_role_name_vector = Vector<AtomicString>* internal_role_name_vector =
new Vector<AtomicString>(base::size(kInternalRoles)); new Vector<AtomicString>(base::size(kInternalRoles));
for (size_t i = 0; i < base::size(kInternalRoles); i++) { for (wtf_size_t i = 0; i < base::size(kInternalRoles); i++) {
(*internal_role_name_vector)[static_cast<size_t>( (*internal_role_name_vector)[static_cast<wtf_size_t>(
kInternalRoles[i].webcore_role)] = kInternalRoles[i].webcore_role)] =
AtomicString(kInternalRoles[i].internal_role_name); AtomicString(kInternalRoles[i].internal_role_name);
} }
...@@ -1907,7 +1908,7 @@ int AXObject::IndexInParent() const { ...@@ -1907,7 +1908,7 @@ int AXObject::IndexInParent() const {
return 0; return 0;
const AXObjectVector& siblings = ParentObjectUnignored()->Children(); const AXObjectVector& siblings = ParentObjectUnignored()->Children();
size_t index = siblings.Find(this); wtf_size_t index = siblings.Find(this);
return (index == kNotFound) ? 0 : static_cast<int>(index); return (index == kNotFound) ? 0 : static_cast<int>(index);
} }
...@@ -3464,7 +3465,7 @@ ax::mojom::Role AXObject::ButtonRoleType() const { ...@@ -3464,7 +3465,7 @@ ax::mojom::Role AXObject::ButtonRoleType() const {
const AtomicString& AXObject::RoleName(ax::mojom::Role role) { const AtomicString& AXObject::RoleName(ax::mojom::Role role) {
static const Vector<AtomicString>* role_name_vector = CreateRoleNameVector(); static const Vector<AtomicString>* role_name_vector = CreateRoleNameVector();
return role_name_vector->at(static_cast<size_t>(role)); return role_name_vector->at(static_cast<wtf_size_t>(role));
} }
// static // static
...@@ -3472,7 +3473,7 @@ const AtomicString& AXObject::InternalRoleName(ax::mojom::Role role) { ...@@ -3472,7 +3473,7 @@ const AtomicString& AXObject::InternalRoleName(ax::mojom::Role role) {
static const Vector<AtomicString>* internal_role_name_vector = static const Vector<AtomicString>* internal_role_name_vector =
CreateInternalRoleNameVector(); CreateInternalRoleNameVector();
return internal_role_name_vector->at(static_cast<size_t>(role)); return internal_role_name_vector->at(static_cast<wtf_size_t>(role));
} }
// static // static
......
...@@ -438,7 +438,7 @@ void WorkletAnimation::Update(TimingUpdateReason reason) { ...@@ -438,7 +438,7 @@ void WorkletAnimation::Update(TimingUpdateReason reason) {
return; return;
DCHECK_EQ(effects_.size(), local_times_.size()); DCHECK_EQ(effects_.size(), local_times_.size());
for (size_t i = 0; i < effects_.size(); ++i) { for (wtf_size_t i = 0; i < effects_.size(); ++i) {
effects_[i]->UpdateInheritedTime( effects_[i]->UpdateInheritedTime(
local_times_[i] ? local_times_[i]->InSecondsF() : NullValue(), reason); local_times_[i] ? local_times_[i]->InSecondsF() : NullValue(), reason);
} }
...@@ -667,7 +667,7 @@ void WorkletAnimation::SetOutputState( ...@@ -667,7 +667,7 @@ void WorkletAnimation::SetOutputState(
// peeking state.local_times will be empty. // peeking state.local_times will be empty.
DCHECK(local_times_.size() == state.local_times.size() || DCHECK(local_times_.size() == state.local_times.size() ||
!running_on_main_thread_); !running_on_main_thread_);
for (size_t i = 0; i < state.local_times.size(); ++i) for (wtf_size_t i = 0; i < state.local_times.size(); ++i)
local_times_[i] = state.local_times[i]; local_times_[i] = state.local_times[i];
} }
......
...@@ -79,7 +79,8 @@ void WebIDBDatabaseImpl::AddObserver( ...@@ -79,7 +79,8 @@ void WebIDBDatabaseImpl::AddObserver(
static_assert(kIDBOperationTypeCount < sizeof(uint32_t) * CHAR_BIT, static_assert(kIDBOperationTypeCount < sizeof(uint32_t) * CHAR_BIT,
"IDBOperationTypeCount exceeds size of uint32_t"); "IDBOperationTypeCount exceeds size of uint32_t");
database_->AddObserver(transaction_id, observer_id, include_transaction, database_->AddObserver(transaction_id, observer_id, include_transaction,
no_records, values, operation_types.to_ulong()); no_records, values,
static_cast<uint32_t>(operation_types.to_ulong()));
} }
void WebIDBDatabaseImpl::RemoveObservers(const Vector<int32_t>& observer_ids) { void WebIDBDatabaseImpl::RemoveObservers(const Vector<int32_t>& observer_ids) {
......
...@@ -167,7 +167,7 @@ void SpeechSynthesis::FireEvent(const AtomicString& type, ...@@ -167,7 +167,7 @@ void SpeechSynthesis::FireEvent(const AtomicString& type,
} }
void SpeechSynthesis::FireErrorEvent(SpeechSynthesisUtterance* utterance, void SpeechSynthesis::FireErrorEvent(SpeechSynthesisUtterance* utterance,
unsigned long char_index, uint32_t char_index,
const String& error) { const String& error) {
double millis; double millis;
if (!GetElapsedTimeMillis(&millis)) if (!GetElapsedTimeMillis(&millis))
......
...@@ -93,7 +93,7 @@ class MODULES_EXPORT SpeechSynthesis final ...@@ -93,7 +93,7 @@ class MODULES_EXPORT SpeechSynthesis final
const String& name); const String& name);
void FireErrorEvent(SpeechSynthesisUtterance*, void FireErrorEvent(SpeechSynthesisUtterance*,
unsigned long char_index, uint32_t char_index,
const String& error); const String& error);
// Returns the utterance at the front of the queue. // Returns the utterance at the front of the queue.
......
...@@ -182,7 +182,7 @@ void DeferredTaskHandler::RemoveTailProcessingHandler(AudioHandler* handler, ...@@ -182,7 +182,7 @@ void DeferredTaskHandler::RemoveTailProcessingHandler(AudioHandler* handler,
bool disable_outputs) { bool disable_outputs) {
AssertGraphOwner(); AssertGraphOwner();
size_t index = tail_processing_handlers_.Find(handler); wtf_size_t index = tail_processing_handlers_.Find(handler);
if (index != kNotFound) { if (index != kNotFound) {
#if DEBUG_AUDIONODE_REFERENCES > 1 #if DEBUG_AUDIONODE_REFERENCES > 1
handler->RemoveTailProcessingDebug(disable_outputs); handler->RemoveTailProcessingDebug(disable_outputs);
......
...@@ -145,7 +145,7 @@ IIRFilterNode* IIRFilterNode::Create(BaseAudioContext& context, ...@@ -145,7 +145,7 @@ IIRFilterNode* IIRFilterNode::Create(BaseAudioContext& context,
bool has_non_zero_coef = false; bool has_non_zero_coef = false;
for (size_t k = 0; k < feedforward_coef.size(); ++k) { for (wtf_size_t k = 0; k < feedforward_coef.size(); ++k) {
if (feedforward_coef[k] != 0) { if (feedforward_coef[k] != 0) {
has_non_zero_coef = true; has_non_zero_coef = true;
break; break;
...@@ -164,7 +164,7 @@ IIRFilterNode* IIRFilterNode::Create(BaseAudioContext& context, ...@@ -164,7 +164,7 @@ IIRFilterNode* IIRFilterNode::Create(BaseAudioContext& context,
StringBuilder message; StringBuilder message;
message.Append("Unstable IIRFilter with feedback coefficients: ["); message.Append("Unstable IIRFilter with feedback coefficients: [");
message.AppendNumber(feedback_coef[0]); message.AppendNumber(feedback_coef[0]);
for (size_t k = 1; k < feedback_coef.size(); ++k) { for (wtf_size_t k = 1; k < feedback_coef.size(); ++k) {
message.Append(", "); message.Append(", ");
message.AppendNumber(feedback_coef[k]); message.AppendNumber(feedback_coef[k]);
} }
......
...@@ -30,7 +30,7 @@ ...@@ -30,7 +30,7 @@
namespace blink { namespace blink {
WaveShaperProcessor::WaveShaperProcessor(float sample_rate, WaveShaperProcessor::WaveShaperProcessor(float sample_rate,
size_t number_of_channels) unsigned number_of_channels)
: AudioDSPKernelProcessor(sample_rate, number_of_channels), : AudioDSPKernelProcessor(sample_rate, number_of_channels),
oversample_(kOverSampleNone) {} oversample_(kOverSampleNone) {}
......
...@@ -43,7 +43,7 @@ class WaveShaperProcessor final : public AudioDSPKernelProcessor { ...@@ -43,7 +43,7 @@ class WaveShaperProcessor final : public AudioDSPKernelProcessor {
public: public:
enum OverSampleType { kOverSampleNone, kOverSample2x, kOverSample4x }; enum OverSampleType { kOverSampleNone, kOverSample2x, kOverSample4x };
WaveShaperProcessor(float sample_rate, size_t number_of_channels); WaveShaperProcessor(float sample_rate, unsigned number_of_channels);
~WaveShaperProcessor() override; ~WaveShaperProcessor() override;
......
...@@ -95,13 +95,13 @@ class StatementCallback final : public SQLStatement::OnSuccessCallback { ...@@ -95,13 +95,13 @@ class StatementCallback final : public SQLStatement::OnSuccessCallback {
std::unique_ptr<protocol::Array<String>> column_names = std::unique_ptr<protocol::Array<String>> column_names =
protocol::Array<String>::create(); protocol::Array<String>::create();
const Vector<String>& columns = row_list->ColumnNames(); const Vector<String>& columns = row_list->ColumnNames();
for (size_t i = 0; i < columns.size(); ++i) for (wtf_size_t i = 0; i < columns.size(); ++i)
column_names->addItem(columns[i]); column_names->addItem(columns[i]);
std::unique_ptr<protocol::Array<protocol::Value>> values = std::unique_ptr<protocol::Array<protocol::Value>> values =
protocol::Array<protocol::Value>::create(); protocol::Array<protocol::Value>::create();
const Vector<SQLValue>& data = row_list->Values(); const Vector<SQLValue>& data = row_list->Values();
for (size_t i = 0; i < data.size(); ++i) { for (wtf_size_t i = 0; i < data.size(); ++i) {
const SQLValue& value = row_list->Values()[i]; const SQLValue& value = row_list->Values()[i];
switch (value.GetType()) { switch (value.GetType()) {
case SQLValue::kStringValue: case SQLValue::kStringValue:
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment