Bug 1197328 - Remove PR_snprintf calls in media/{webrtc,mtransport}/. r=froydnj

--HG--
extra : rebase_source : fec06fd57c8142008e9c2978ed685ce6811e9750
This commit is contained in:
Igor 2016-08-16 19:54:00 -04:00
Родитель dc0ebbd114
Коммит 71691f0323
4 изменённых файлов: 29 добавлений и 25 удалений

Просмотреть файл

@ -11,10 +11,11 @@
#include "keyhi.h"
#include "nsError.h"
#include "pk11pub.h"
#include "prprf.h"
#include "sechash.h"
#include "ssl.h"
#include "mozilla/Sprintf.h"
namespace mozilla {
DtlsIdentity::~DtlsIdentity() {
@ -39,7 +40,7 @@ RefPtr<DtlsIdentity> DtlsIdentity::Generate() {
std::string name;
char chunk[3];
for (size_t i = 0; i < sizeof(random_name); ++i) {
PR_snprintf(chunk, sizeof(chunk), "%.2x", random_name[i]);
SprintfLiteral(chunk, "%.2x", random_name[i]);
name += chunk;
}

Просмотреть файл

@ -11,6 +11,7 @@
#include "nspr.h"
#include "YuvStamper.h"
#include "mozilla/Sprintf.h"
typedef uint32_t UINT4; //Needed for r_crc32() call
extern "C" {
@ -415,7 +416,7 @@ static unsigned char *DIGITS[] = {
bool YuvStamper::WriteDigits(uint32_t value)
{
char buf[20];
PR_snprintf(buf, sizeof(buf), "%.5u", value);
SprintfLiteral(buf, "%.5u", value);
size_t size = strlen(buf);
if (Capacity() < size) {

Просмотреть файл

@ -54,6 +54,7 @@
#include "mozilla/gfx/Types.h"
#include "mozilla/UniquePtr.h"
#include "mozilla/UniquePtrExtensions.h"
#include "mozilla/Sprintf.h"
#include "webrtc/common_types.h"
#include "webrtc/common_video/interface/native_handle.h"
@ -1075,11 +1076,11 @@ void MediaPipeline::RtpPacketReceived(TransportLayer *layer,
if (!NS_SUCCEEDED(res)) {
char tmp[16];
PR_snprintf(tmp, sizeof(tmp), "%.2x %.2x %.2x %.2x",
inner_data[0],
inner_data[1],
inner_data[2],
inner_data[3]);
SprintfLiteral(tmp, "%.2x %.2x %.2x %.2x",
inner_data[0],
inner_data[1],
inner_data[2],
inner_data[3]);
MOZ_MTLOG(ML_NOTICE, "Error unprotecting RTP in " << description_
<< "len= " << len << "[" << tmp << "...]");

Просмотреть файл

@ -46,6 +46,9 @@
#include "signaling/src/jsep/JsepSession.h"
#include "signaling/src/jsep/JsepSessionImpl.h"
#include "mozilla/IntegerPrintfMacros.h"
#include "mozilla/Sprintf.h"
#if !defined(MOZILLA_EXTERNAL_LINKAGE)
#ifdef XP_WIN
// We need to undef the MS macro for nsIDocument::CreateEvent
@ -643,16 +646,14 @@ PeerConnectionImpl::Initialize(PeerConnectionObserver& aObserver,
strlen(HELLO_INITIATOR_URL_START)) == 0);
}
PR_snprintf(
temp,
sizeof(temp),
"%llu (id=%llu url=%s)",
static_cast<unsigned long long>(timestamp),
static_cast<unsigned long long>(mWindow ? mWindow->WindowID() : 0),
locationCStr.get() ? locationCStr.get() : "NULL");
SprintfLiteral(temp,
"%" PRIu64 " (id=%" PRIu64 " url=%s)",
static_cast<uint64_t>(timestamp),
static_cast<uint64_t>(mWindow ? mWindow->WindowID() : 0),
locationCStr.get() ? locationCStr.get() : "NULL");
#else
PR_snprintf(temp, sizeof(temp), "%llu", (unsigned long long)timestamp);
SprintfLiteral(temp, "%" PRIu64, static_cast<uint64_t>(timestamp));
#endif // MOZILLA_INTERNAL_API
mName = temp;
@ -667,15 +668,15 @@ PeerConnectionImpl::Initialize(PeerConnectionObserver& aObserver,
}
char hex[17];
PR_snprintf(hex,sizeof(hex),"%.2x%.2x%.2x%.2x%.2x%.2x%.2x%.2x",
handle_bin[0],
handle_bin[1],
handle_bin[2],
handle_bin[3],
handle_bin[4],
handle_bin[5],
handle_bin[6],
handle_bin[7]);
SprintfLiteral(hex, "%.2x%.2x%.2x%.2x%.2x%.2x%.2x%.2x",
handle_bin[0],
handle_bin[1],
handle_bin[2],
handle_bin[3],
handle_bin[4],
handle_bin[5],
handle_bin[6],
handle_bin[7]);
mHandle = hex;