From ac43082b768f2e9be967f8c0132d9c6fc7d0fb01 Mon Sep 17 00:00:00 2001 From: ricea Date: Sat, 19 Sep 2015 23:25:42 -0700 Subject: [PATCH] Use the appropriate variant of IntToString in //remoting Using the wrong variant of IntToString() can lead to unexpected behaviour and bugs. Use the appropriate variant for the type being converted. No behaviour change intended. BUG=505479 TEST=compiled Review URL: https://codereview.chromium.org/1359453003 Cr-Commit-Position: refs/heads/master@{#349876} --- remoting/protocol/jingle_messages.cc | 6 +++--- remoting/protocol/jingle_session.cc | 2 +- remoting/protocol/message_decoder_unittest.cc | 2 +- 3 files changed, 5 insertions(+), 5 deletions(-) diff --git a/remoting/protocol/jingle_messages.cc b/remoting/protocol/jingle_messages.cc index 85c655eab451..9896b2758e82 100644 --- a/remoting/protocol/jingle_messages.cc +++ b/remoting/protocol/jingle_messages.cc @@ -158,14 +158,14 @@ XmlElement* FormatIceCandidate(const JingleMessage::NamedCandidate& candidate) { result->SetAttr(QName(kEmptyNamespace, "address"), candidate.candidate.address().ipaddr().ToString()); result->SetAttr(QName(kEmptyNamespace, "port"), - base::IntToString(candidate.candidate.address().port())); + base::UintToString(candidate.candidate.address().port())); result->SetAttr(QName(kEmptyNamespace, "type"), candidate.candidate.type()); result->SetAttr(QName(kEmptyNamespace, "protocol"), candidate.candidate.protocol()); result->SetAttr(QName(kEmptyNamespace, "priority"), - base::DoubleToString(candidate.candidate.priority())); + base::UintToString(candidate.candidate.priority())); result->SetAttr(QName(kEmptyNamespace, "generation"), - base::IntToString(candidate.candidate.generation())); + base::UintToString(candidate.candidate.generation())); return result; } diff --git a/remoting/protocol/jingle_session.cc b/remoting/protocol/jingle_session.cc index 1dacef1f45a0..bff155d3d851 100644 --- a/remoting/protocol/jingle_session.cc +++ b/remoting/protocol/jingle_session.cc @@ -114,7 +114,7 @@ void JingleSession::StartConnection(const std::string& peer_jid, // concurrent session per host, so a random 64-bit integer provides // enough entropy. In the worst case connection will fail when two // clients generate the same session ID concurrently. - session_id_ = base::Int64ToString(base::RandGenerator(kint64max)); + session_id_ = base::Uint64ToString(base::RandGenerator(kuint64max)); quic_channel_factory_.reset(new QuicChannelFactory(session_id_, false)); diff --git a/remoting/protocol/message_decoder_unittest.cc b/remoting/protocol/message_decoder_unittest.cc index ab36b17c10a0..2c1c56ad4e5a 100644 --- a/remoting/protocol/message_decoder_unittest.cc +++ b/remoting/protocol/message_decoder_unittest.cc @@ -91,7 +91,7 @@ void SimulateReadSequence(const int read_sequence[], int sequence_size) { for (std::list::iterator it = message_list.begin(); it != message_list.end(); ++it) { - SCOPED_TRACE("Message " + base::IntToString(index)); + SCOPED_TRACE("Message " + base::UintToString(index)); EventMessage* message = *it; // Partial update stream. -- 2.11.4.GIT