Bug 1334283 - use MOZ_FORMAT_PRINTF in toolkit/mozapps/update; r?rstrong
Use MOZ_FORMAT_PRINTF in toolkit/mozapps/update, and fix the one
erroneous printf that this detected.
MozReview-Commit-ID: 5dzyMOZwNDG
--- a/toolkit/mozapps/update/common/updatecommon.h
+++ b/toolkit/mozapps/update/common/updatecommon.h
@@ -2,31 +2,32 @@
* License, v. 2.0. If a copy of the MPL was not distributed with this
* file, You can obtain one at http://mozilla.org/MPL/2.0/. */
#ifndef UPDATECOMMON_H
#define UPDATECOMMON_H
#include "updatedefines.h"
#include <stdio.h>
+#include "mozilla/Attributes.h"
class UpdateLog
{
public:
static UpdateLog & GetPrimaryLog()
{
static UpdateLog primaryLog;
return primaryLog;
}
void Init(NS_tchar* sourcePath, const NS_tchar* fileName);
void Finish();
void Flush();
- void Printf(const char *fmt, ... );
- void WarnPrintf(const char *fmt, ... );
+ void Printf(const char *fmt, ... ) MOZ_FORMAT_PRINTF(2, 3);
+ void WarnPrintf(const char *fmt, ... ) MOZ_FORMAT_PRINTF(2, 3);
~UpdateLog()
{
Finish();
}
protected:
UpdateLog();
--- a/toolkit/mozapps/update/updater/updater.cpp
+++ b/toolkit/mozapps/update/updater/updater.cpp
@@ -435,17 +435,17 @@ get_relative_path(const NS_tchar *fullpa
* Whether the path is a directory path. Defaults to false.
* @return valid filesystem path or nullptr if the path checks fail.
*/
static NS_tchar*
get_valid_path(NS_tchar **line, bool isdir = false)
{
NS_tchar *path = mstrtok(kQuote, line);
if (!path) {
- LOG(("get_valid_path: unable to determine path: " LOG_S, line));
+ LOG(("get_valid_path: unable to determine path: " LOG_S, *line));
return nullptr;
}
// All paths must be relative from the current working directory
if (path[0] == NS_T('/')) {
LOG(("get_valid_path: path must be relative: " LOG_S, path));
return nullptr;
}