Bug 1060419 - make ipc/chromium use Printf.h, r?froydnj
MozReview-Commit-ID: 10spM5oOe5c
--- a/ipc/chromium/src/base/logging.cc
+++ b/ipc/chromium/src/base/logging.cc
@@ -1,19 +1,19 @@
/* -*- Mode: C++; tab-width: 8; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
/* vim: set ts=8 sts=2 et sw=2 tw=80: */
// Copyright (c) 2006-2009 The Chromium Authors. All rights reserved.
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
#include "base/logging.h"
#include "prmem.h"
-#include "prprf.h"
#include "base/string_util.h"
#include "nsXPCOM.h"
+#include "mozilla/Printf.h"
namespace mozilla {
Logger::~Logger()
{
LogLevel prlevel = LogLevel::Debug;
int xpcomlevel = -1;
@@ -43,25 +43,25 @@ Logger::~Logger()
xpcomlevel = NS_DEBUG_ABORT;
break;
}
MOZ_LOG(gChromiumPRLog, prlevel, ("%s:%i: %s", mFile, mLine, mMsg ? mMsg : "<no message>"));
if (xpcomlevel != -1)
NS_DebugBreak(xpcomlevel, mMsg, NULL, mFile, mLine);
- PR_Free(mMsg);
+ mozilla::SmprintfFree(mMsg);
}
void
Logger::printf(const char* fmt, ...)
{
va_list args;
va_start(args, fmt);
- mMsg = PR_vsprintf_append(mMsg, fmt, args);
+ mMsg = mozilla::VsmprintfAppend(mMsg, fmt, args);
va_end(args);
}
LazyLogModule Logger::gChromiumPRLog("chromium");
mozilla::Logger&
operator<<(mozilla::Logger& log, const char* s)
{
--- a/ipc/chromium/src/base/logging.h
+++ b/ipc/chromium/src/base/logging.h
@@ -6,16 +6,17 @@
#ifndef BASE_LOGGING_H_
#define BASE_LOGGING_H_
#include <string>
#include <cstring>
#include "base/basictypes.h"
+#include "mozilla/Attributes.h"
#include "mozilla/Logging.h"
#ifdef NO_CHROMIUM_LOGGING
#include <sstream>
#endif
// Replace the Chromium logging code with NSPR-based logging code and
// some C++ wrappers to emulate std::ostream
@@ -39,17 +40,17 @@ public:
, mFile(file)
, mLine(line)
, mMsg(NULL)
{ }
~Logger();
// not private so that the operator<< overloads can get to it
- void printf(const char* fmt, ...);
+ void printf(const char* fmt, ...) MOZ_FORMAT_PRINTF(2, 3);
private:
static mozilla::LazyLogModule gChromiumPRLog;
// static PRLogModuleInfo* GetLog();
LogSeverity mSeverity;
const char* mFile;
int mLine;