mirror of
https://github.com/mozilla/gecko-dev.git
synced 2024-11-24 13:21:05 +00:00
Bug 1302163 - Change code to use SprintfLiteral instead of snprintf. r=ehsan
This commit is contained in:
parent
3cc61134b1
commit
774a8bf34d
@ -41,6 +41,7 @@
|
|||||||
# include <binder/ProcessState.h>
|
# include <binder/ProcessState.h>
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
#include "mozilla/Sprintf.h"
|
||||||
#include "mozilla/Telemetry.h"
|
#include "mozilla/Telemetry.h"
|
||||||
#include "mozilla/WindowsDllBlocklist.h"
|
#include "mozilla/WindowsDllBlocklist.h"
|
||||||
|
|
||||||
@ -123,7 +124,7 @@ static int do_main(int argc, char* argv[])
|
|||||||
}
|
}
|
||||||
|
|
||||||
char appEnv[MAXPATHLEN];
|
char appEnv[MAXPATHLEN];
|
||||||
snprintf(appEnv, MAXPATHLEN, "XUL_APP_FILE=%s", argv[2]);
|
SprintfLiteral(appEnv, "XUL_APP_FILE=%s", argv[2]);
|
||||||
if (putenv(strdup(appEnv))) {
|
if (putenv(strdup(appEnv))) {
|
||||||
Output("Couldn't set %s.\n", appEnv);
|
Output("Couldn't set %s.\n", appEnv);
|
||||||
return 255;
|
return 255;
|
||||||
|
@ -39,6 +39,7 @@
|
|||||||
|
|
||||||
#include "nsXPCOMPrivate.h" // for MAXPATHLEN and XPCOM_DLL
|
#include "nsXPCOMPrivate.h" // for MAXPATHLEN and XPCOM_DLL
|
||||||
|
|
||||||
|
#include "mozilla/Sprintf.h"
|
||||||
#include "mozilla/Telemetry.h"
|
#include "mozilla/Telemetry.h"
|
||||||
#include "mozilla/WindowsDllBlocklist.h"
|
#include "mozilla/WindowsDllBlocklist.h"
|
||||||
|
|
||||||
@ -192,7 +193,7 @@ static int do_main(int argc, char* argv[], char* envp[], nsIFile *xreDirectory)
|
|||||||
}
|
}
|
||||||
|
|
||||||
char appEnv[MAXPATHLEN];
|
char appEnv[MAXPATHLEN];
|
||||||
snprintf(appEnv, MAXPATHLEN, "XUL_APP_FILE=%s", argv[2]);
|
SprintfLiteral(appEnv, "XUL_APP_FILE=%s", argv[2]);
|
||||||
if (putenv(strdup(appEnv))) {
|
if (putenv(strdup(appEnv))) {
|
||||||
Output("Couldn't set %s.\n", appEnv);
|
Output("Couldn't set %s.\n", appEnv);
|
||||||
return 255;
|
return 255;
|
||||||
|
@ -32,6 +32,7 @@
|
|||||||
#include "mozilla/plugins/BrowserStreamChild.h"
|
#include "mozilla/plugins/BrowserStreamChild.h"
|
||||||
#include "mozilla/plugins/PluginStreamChild.h"
|
#include "mozilla/plugins/PluginStreamChild.h"
|
||||||
#include "mozilla/dom/CrashReporterChild.h"
|
#include "mozilla/dom/CrashReporterChild.h"
|
||||||
|
#include "mozilla/Sprintf.h"
|
||||||
#include "mozilla/Unused.h"
|
#include "mozilla/Unused.h"
|
||||||
|
|
||||||
#include "nsNPAPIPlugin.h"
|
#include "nsNPAPIPlugin.h"
|
||||||
@ -265,7 +266,7 @@ PluginModuleChild::InitForChrome(const std::string& aPluginFilename,
|
|||||||
#if defined(XP_MACOSX)
|
#if defined(XP_MACOSX)
|
||||||
const char* namePrefix = "Plugin Content";
|
const char* namePrefix = "Plugin Content";
|
||||||
char nameBuffer[80];
|
char nameBuffer[80];
|
||||||
snprintf(nameBuffer, sizeof(nameBuffer), "%s (%s)", namePrefix, info.fName);
|
SprintfLiteral(nameBuffer, "%s (%s)", namePrefix, info.fName);
|
||||||
mozilla::plugins::PluginUtilsOSX::SetProcessName(nameBuffer);
|
mozilla::plugins::PluginUtilsOSX::SetProcessName(nameBuffer);
|
||||||
#endif
|
#endif
|
||||||
pluginFile.FreePluginInfo(info);
|
pluginFile.FreePluginInfo(info);
|
||||||
|
@ -15,6 +15,8 @@
|
|||||||
|
|
||||||
#include "nsDebug.h"
|
#include "nsDebug.h"
|
||||||
|
|
||||||
|
#include "mozilla/Sprintf.h"
|
||||||
|
|
||||||
@interface CALayer (ContentsScale)
|
@interface CALayer (ContentsScale)
|
||||||
- (double)contentsScale;
|
- (double)contentsScale;
|
||||||
- (void)setContentsScale:(double)scale;
|
- (void)setContentsScale:(double)scale;
|
||||||
@ -222,12 +224,11 @@ bool mozilla::plugins::PluginUtilsOSX::SetProcessName(const char* aProcessName)
|
|||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
NSString *currentName = [[[NSBundle mainBundle] localizedInfoDictionary]
|
NSString *currentName = [[[NSBundle mainBundle] localizedInfoDictionary]
|
||||||
objectForKey:(NSString *)kCFBundleNameKey];
|
objectForKey:(NSString *)kCFBundleNameKey];
|
||||||
|
|
||||||
char formattedName[1024];
|
char formattedName[1024];
|
||||||
snprintf(formattedName, sizeof(formattedName),
|
SprintfLiteral(formattedName, "%s %s", [currentName UTF8String], aProcessName);
|
||||||
"%s %s", [currentName UTF8String], aProcessName);
|
|
||||||
|
|
||||||
aProcessName = formattedName;
|
aProcessName = formattedName;
|
||||||
|
|
||||||
|
@ -48,11 +48,10 @@ PaintCounter::~PaintCounter()
|
|||||||
|
|
||||||
void
|
void
|
||||||
PaintCounter::Draw(Compositor* aCompositor, TimeDuration aPaintTime, TimeDuration aCompositeTime) {
|
PaintCounter::Draw(Compositor* aCompositor, TimeDuration aPaintTime, TimeDuration aCompositeTime) {
|
||||||
const int buffer_size = 48;
|
char buffer[48];
|
||||||
char buffer[buffer_size];
|
SprintfLiteral(buffer, "P: %.2f C: %.2f",
|
||||||
snprintf(buffer, buffer_size, "P: %.2f C: %.2f",
|
aPaintTime.ToMilliseconds(),
|
||||||
aPaintTime.ToMilliseconds(),
|
aCompositeTime.ToMilliseconds());
|
||||||
aCompositeTime.ToMilliseconds());
|
|
||||||
|
|
||||||
SkPaint paint;
|
SkPaint paint;
|
||||||
paint.setTextSize(32);
|
paint.setTextSize(32);
|
||||||
|
@ -9,6 +9,8 @@
|
|||||||
#include "nsThreadUtils.h"
|
#include "nsThreadUtils.h"
|
||||||
#include "nsContentUtils.h"
|
#include "nsContentUtils.h"
|
||||||
|
|
||||||
|
#include "mozilla/Sprintf.h"
|
||||||
|
|
||||||
#ifdef XP_WIN
|
#ifdef XP_WIN
|
||||||
#include <windows.h>
|
#include <windows.h>
|
||||||
#endif
|
#endif
|
||||||
@ -20,10 +22,10 @@ static void DebugDump(const char* fmt, ...)
|
|||||||
va_start(ap, fmt);
|
va_start(ap, fmt);
|
||||||
#ifdef XPWIN
|
#ifdef XPWIN
|
||||||
_vsnprintf(buffer, sizeof(buffer), fmt, ap);
|
_vsnprintf(buffer, sizeof(buffer), fmt, ap);
|
||||||
#else
|
|
||||||
vsnprintf(buffer, sizeof(buffer), fmt, ap);
|
|
||||||
#endif
|
|
||||||
buffer[sizeof(buffer)-1] = '\0';
|
buffer[sizeof(buffer)-1] = '\0';
|
||||||
|
#else
|
||||||
|
VsprintfLiteral(buffer, fmt, ap);
|
||||||
|
#endif
|
||||||
va_end(ap);
|
va_end(ap);
|
||||||
#ifdef XP_WIN
|
#ifdef XP_WIN
|
||||||
if (IsDebuggerPresent()) {
|
if (IsDebuggerPresent()) {
|
||||||
|
@ -47,6 +47,7 @@
|
|||||||
#include "mozilla/Atomics.h"
|
#include "mozilla/Atomics.h"
|
||||||
#include "mozilla/Attributes.h"
|
#include "mozilla/Attributes.h"
|
||||||
#include "mozilla/ProcessHangMonitor.h"
|
#include "mozilla/ProcessHangMonitor.h"
|
||||||
|
#include "mozilla/Sprintf.h"
|
||||||
#include "mozilla/UniquePtrExtensions.h"
|
#include "mozilla/UniquePtrExtensions.h"
|
||||||
#include "mozilla/Unused.h"
|
#include "mozilla/Unused.h"
|
||||||
#include "AccessCheck.h"
|
#include "AccessCheck.h"
|
||||||
@ -3528,7 +3529,7 @@ XPCJSContext::DescribeCustomObjects(JSObject* obj, const js::Class* clasp,
|
|||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
snprintf(name, sizeof(name), "JS Object (%s - %s)", clasp->name, si->GetJSClass()->name);
|
SprintfLiteral(name, "JS Object (%s - %s)", clasp->name, si->GetJSClass()->name);
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -9,6 +9,7 @@
|
|||||||
#include "xpcprivate.h"
|
#include "xpcprivate.h"
|
||||||
#include "jsprf.h"
|
#include "jsprf.h"
|
||||||
#include "mozilla/DeferredFinalize.h"
|
#include "mozilla/DeferredFinalize.h"
|
||||||
|
#include "mozilla/Sprintf.h"
|
||||||
#include "mozilla/jsipc/CrossProcessObjectWrappers.h"
|
#include "mozilla/jsipc/CrossProcessObjectWrappers.h"
|
||||||
#include "nsCCUncollectableMarker.h"
|
#include "nsCCUncollectableMarker.h"
|
||||||
#include "nsContentUtils.h"
|
#include "nsContentUtils.h"
|
||||||
@ -103,9 +104,9 @@ NS_CYCLE_COLLECTION_CLASSNAME(nsXPCWrappedJS)::Traverse
|
|||||||
if (cb.WantDebugInfo()) {
|
if (cb.WantDebugInfo()) {
|
||||||
char name[72];
|
char name[72];
|
||||||
if (tmp->GetClass())
|
if (tmp->GetClass())
|
||||||
snprintf(name, sizeof(name), "nsXPCWrappedJS (%s)", tmp->GetClass()->GetInterfaceName());
|
SprintfLiteral(name, "nsXPCWrappedJS (%s)", tmp->GetClass()->GetInterfaceName());
|
||||||
else
|
else
|
||||||
snprintf(name, sizeof(name), "nsXPCWrappedJS");
|
SprintfLiteral(name, "nsXPCWrappedJS");
|
||||||
cb.DescribeRefCountedNode(refcnt, name);
|
cb.DescribeRefCountedNode(refcnt, name);
|
||||||
} else {
|
} else {
|
||||||
NS_IMPL_CYCLE_COLLECTION_DESCRIBE(nsXPCWrappedJS, refcnt)
|
NS_IMPL_CYCLE_COLLECTION_DESCRIBE(nsXPCWrappedJS, refcnt)
|
||||||
|
@ -23,6 +23,7 @@
|
|||||||
#include "mozilla/DeferredFinalize.h"
|
#include "mozilla/DeferredFinalize.h"
|
||||||
#include "mozilla/Likely.h"
|
#include "mozilla/Likely.h"
|
||||||
#include "mozilla/Unused.h"
|
#include "mozilla/Unused.h"
|
||||||
|
#include "mozilla/Sprintf.h"
|
||||||
#include "mozilla/dom/BindingUtils.h"
|
#include "mozilla/dom/BindingUtils.h"
|
||||||
#include <algorithm>
|
#include <algorithm>
|
||||||
|
|
||||||
@ -51,9 +52,9 @@ NS_IMPL_CYCLE_COLLECTION_TRAVERSE_BEGIN_INTERNAL(XPCWrappedNative)
|
|||||||
char name[72];
|
char name[72];
|
||||||
XPCNativeScriptableInfo* si = tmp->GetScriptableInfo();
|
XPCNativeScriptableInfo* si = tmp->GetScriptableInfo();
|
||||||
if (si)
|
if (si)
|
||||||
snprintf(name, sizeof(name), "XPCWrappedNative (%s)", si->GetJSClass()->name);
|
SprintfLiteral(name, "XPCWrappedNative (%s)", si->GetJSClass()->name);
|
||||||
else
|
else
|
||||||
snprintf(name, sizeof(name), "XPCWrappedNative");
|
SprintfLiteral(name, "XPCWrappedNative");
|
||||||
|
|
||||||
cb.DescribeRefCountedNode(tmp->mRefCnt.get(), name);
|
cb.DescribeRefCountedNode(tmp->mRefCnt.get(), name);
|
||||||
} else {
|
} else {
|
||||||
|
@ -16,6 +16,7 @@
|
|||||||
#include "mozilla/Assertions.h"
|
#include "mozilla/Assertions.h"
|
||||||
#include "mozilla/Move.h" // Pinch hitting for <utility> and std::move
|
#include "mozilla/Move.h" // Pinch hitting for <utility> and std::move
|
||||||
#include "mozilla/Mutex.h"
|
#include "mozilla/Mutex.h"
|
||||||
|
#include "mozilla/Sprintf.h"
|
||||||
#include <vector>
|
#include <vector>
|
||||||
|
|
||||||
extern "C" {
|
extern "C" {
|
||||||
@ -33,7 +34,7 @@ static int ringbuffer_vlog(int facility,
|
|||||||
// I could be evil and printf right into a std::string, but unless this
|
// I could be evil and printf right into a std::string, but unless this
|
||||||
// shows up in profiling, it is not worth doing.
|
// shows up in profiling, it is not worth doing.
|
||||||
char temp[4096];
|
char temp[4096];
|
||||||
vsnprintf(temp, sizeof(temp), format, ap);
|
VsprintfLiteral(temp, format, ap);
|
||||||
|
|
||||||
mozilla::RLogRingBuffer::GetInstance()->Log(std::string(temp));
|
mozilla::RLogRingBuffer::GetInstance()->Log(std::string(temp));
|
||||||
return 0;
|
return 0;
|
||||||
|
@ -15,6 +15,7 @@
|
|||||||
#include "nsThreadUtils.h"
|
#include "nsThreadUtils.h"
|
||||||
|
|
||||||
#include "mozilla/Logging.h"
|
#include "mozilla/Logging.h"
|
||||||
|
#include "mozilla/Sprintf.h"
|
||||||
|
|
||||||
static PRLogModuleInfo *gLogModuleInfo = nullptr;
|
static PRLogModuleInfo *gLogModuleInfo = nullptr;
|
||||||
|
|
||||||
@ -83,7 +84,7 @@ void CSFLogV(CSFLogLevel priority, const char* sourceFile, int sourceLine, const
|
|||||||
threadName = "";
|
threadName = "";
|
||||||
}
|
}
|
||||||
|
|
||||||
vsnprintf(message, MAX_MESSAGE_LENGTH, format, args);
|
VsprintfLiteral(message, format, args);
|
||||||
MOZ_LOG(gLogModuleInfo, level, ("[%s|%s] %s:%d: %s",
|
MOZ_LOG(gLogModuleInfo, level, ("[%s|%s] %s:%d: %s",
|
||||||
threadName, tag, sourceFile, sourceLine,
|
threadName, tag, sourceFile, sourceLine,
|
||||||
message));
|
message));
|
||||||
|
@ -36,6 +36,7 @@
|
|||||||
#include "nsIObserverService.h"
|
#include "nsIObserverService.h"
|
||||||
#include "nsIObserver.h"
|
#include "nsIObserver.h"
|
||||||
#include "mozilla/Services.h"
|
#include "mozilla/Services.h"
|
||||||
|
#include "mozilla/Sprintf.h"
|
||||||
#include "nsProxyRelease.h"
|
#include "nsProxyRelease.h"
|
||||||
#include "nsThread.h"
|
#include "nsThread.h"
|
||||||
#include "nsThreadUtils.h"
|
#include "nsThreadUtils.h"
|
||||||
@ -196,7 +197,7 @@ debug_printf(const char *format, ...)
|
|||||||
#ifdef _WIN32
|
#ifdef _WIN32
|
||||||
if (vsnprintf_s(buffer, sizeof(buffer), _TRUNCATE, format, ap) > 0) {
|
if (vsnprintf_s(buffer, sizeof(buffer), _TRUNCATE, format, ap) > 0) {
|
||||||
#else
|
#else
|
||||||
if (vsnprintf(buffer, sizeof(buffer), format, ap) > 0) {
|
if (VsprintfLiteral(buffer, format, ap) > 0) {
|
||||||
#endif
|
#endif
|
||||||
PR_LogPrint("%s", buffer);
|
PR_LogPrint("%s", buffer);
|
||||||
}
|
}
|
||||||
|
@ -20,11 +20,12 @@
|
|||||||
#include "nsString.h"
|
#include "nsString.h"
|
||||||
#include "mozilla/Logging.h"
|
#include "mozilla/Logging.h"
|
||||||
|
|
||||||
#include "mozilla/Services.h"
|
|
||||||
#include "mozilla/Preferences.h"
|
|
||||||
#include "mozilla/FileUtils.h"
|
|
||||||
#include "mozilla/SHA1.h"
|
|
||||||
#include "mozilla/Base64.h"
|
#include "mozilla/Base64.h"
|
||||||
|
#include "mozilla/FileUtils.h"
|
||||||
|
#include "mozilla/Preferences.h"
|
||||||
|
#include "mozilla/Services.h"
|
||||||
|
#include "mozilla/SHA1.h"
|
||||||
|
#include "mozilla/Sprintf.h"
|
||||||
#include "mozilla/Telemetry.h"
|
#include "mozilla/Telemetry.h"
|
||||||
|
|
||||||
#ifdef MOZ_WIDGET_GONK
|
#ifdef MOZ_WIDGET_GONK
|
||||||
@ -139,11 +140,11 @@ void nsNotifyAddrListener::calculateNetworkId(void)
|
|||||||
if (gw) {
|
if (gw) {
|
||||||
/* create a string to search for in the arp table */
|
/* create a string to search for in the arp table */
|
||||||
char searchfor[16];
|
char searchfor[16];
|
||||||
snprintf(searchfor, sizeof(searchfor), "%d.%d.%d.%d",
|
SprintfLiteral(searchfor, "%d.%d.%d.%d",
|
||||||
gw & 0xff,
|
gw & 0xff,
|
||||||
(gw >> 8) & 0xff,
|
(gw >> 8) & 0xff,
|
||||||
(gw >> 16) & 0xff,
|
(gw >> 16) & 0xff,
|
||||||
gw >> 24);
|
gw >> 24);
|
||||||
|
|
||||||
FILE *farp = fopen(kProcArp, "r");
|
FILE *farp = fopen(kProcArp, "r");
|
||||||
if (farp) {
|
if (farp) {
|
||||||
|
@ -17,6 +17,7 @@
|
|||||||
#include <unistd.h>
|
#include <unistd.h>
|
||||||
|
|
||||||
#include "mozilla/Assertions.h"
|
#include "mozilla/Assertions.h"
|
||||||
|
#include "mozilla/Sprintf.h"
|
||||||
#include "mozilla/Unused.h"
|
#include "mozilla/Unused.h"
|
||||||
#include "sandbox/linux/system_headers/linux_syscalls.h"
|
#include "sandbox/linux/system_headers/linux_syscalls.h"
|
||||||
|
|
||||||
@ -83,7 +84,7 @@ UnshareUserNamespace()
|
|||||||
// current thread. However, CLONE_NEWUSER can be unshared only in a
|
// current thread. However, CLONE_NEWUSER can be unshared only in a
|
||||||
// single-threaded process, so those are equivalent if we reach this
|
// single-threaded process, so those are equivalent if we reach this
|
||||||
// point.
|
// point.
|
||||||
len = size_t(snprintf(buf, sizeof(buf), "%u %u 1\n", uid, uid));
|
len = size_t(SprintfLiteral(buf, "%u %u 1\n", uid, uid));
|
||||||
MOZ_ASSERT(len < sizeof(buf));
|
MOZ_ASSERT(len < sizeof(buf));
|
||||||
if (!WriteStringToFile("/proc/self/uid_map", buf, len)) {
|
if (!WriteStringToFile("/proc/self/uid_map", buf, len)) {
|
||||||
MOZ_CRASH("Failed to write /proc/self/uid_map");
|
MOZ_CRASH("Failed to write /proc/self/uid_map");
|
||||||
@ -91,7 +92,7 @@ UnshareUserNamespace()
|
|||||||
|
|
||||||
Unused << WriteStringToFile("/proc/self/setgroups", "deny", 4);
|
Unused << WriteStringToFile("/proc/self/setgroups", "deny", 4);
|
||||||
|
|
||||||
len = size_t(snprintf(buf, sizeof(buf), "%u %u 1\n", gid, gid));
|
len = size_t(SprintfLiteral(buf, "%u %u 1\n", gid, gid));
|
||||||
MOZ_ASSERT(len < sizeof(buf));
|
MOZ_ASSERT(len < sizeof(buf));
|
||||||
if (!WriteStringToFile("/proc/self/gid_map", buf, len)) {
|
if (!WriteStringToFile("/proc/self/gid_map", buf, len)) {
|
||||||
MOZ_CRASH("Failed to write /proc/self/gid_map");
|
MOZ_CRASH("Failed to write /proc/self/gid_map");
|
||||||
|
@ -29,6 +29,7 @@
|
|||||||
#include "mozilla/DebugOnly.h"
|
#include "mozilla/DebugOnly.h"
|
||||||
#include "mozilla/Move.h"
|
#include "mozilla/Move.h"
|
||||||
#include "mozilla/NullPtr.h"
|
#include "mozilla/NullPtr.h"
|
||||||
|
#include "mozilla/Sprintf.h"
|
||||||
#include "mozilla/ipc/FileDescriptor.h"
|
#include "mozilla/ipc/FileDescriptor.h"
|
||||||
|
|
||||||
namespace mozilla {
|
namespace mozilla {
|
||||||
@ -354,7 +355,7 @@ void
|
|||||||
SandboxBroker::ThreadMain(void)
|
SandboxBroker::ThreadMain(void)
|
||||||
{
|
{
|
||||||
char threadName[16];
|
char threadName[16];
|
||||||
snprintf(threadName, sizeof(threadName), "FS Broker %d", mChildPid);
|
SprintfLiteral(threadName, "FS Broker %d", mChildPid);
|
||||||
PlatformThread::SetName(threadName);
|
PlatformThread::SetName(threadName);
|
||||||
|
|
||||||
// Permissive mode can only be enabled through an environment variable,
|
// Permissive mode can only be enabled through an environment variable,
|
||||||
|
@ -7,6 +7,7 @@
|
|||||||
#include <stdio.h>
|
#include <stdio.h>
|
||||||
#include <gtk/gtk.h>
|
#include <gtk/gtk.h>
|
||||||
#include <unistd.h>
|
#include <unistd.h>
|
||||||
|
#include "mozilla/Sprintf.h"
|
||||||
#include "progressui.h"
|
#include "progressui.h"
|
||||||
#include "readstrings.h"
|
#include "readstrings.h"
|
||||||
#include "errors.h"
|
#include "errors.h"
|
||||||
@ -71,7 +72,7 @@ ShowProgressUI()
|
|||||||
return 0;
|
return 0;
|
||||||
|
|
||||||
char ini_path[PATH_MAX];
|
char ini_path[PATH_MAX];
|
||||||
snprintf(ini_path, sizeof(ini_path), "%s.ini", sProgramPath);
|
SprintfLiteral(ini_path, "%s.ini", sProgramPath);
|
||||||
|
|
||||||
StringTable strings;
|
StringTable strings;
|
||||||
if (ReadStrings(ini_path, &strings) != OK)
|
if (ReadStrings(ini_path, &strings) != OK)
|
||||||
@ -83,7 +84,7 @@ ShowProgressUI()
|
|||||||
|
|
||||||
static GdkPixbuf *pixbuf;
|
static GdkPixbuf *pixbuf;
|
||||||
char icon_path[PATH_MAX];
|
char icon_path[PATH_MAX];
|
||||||
snprintf(icon_path, sizeof(icon_path), "%s.png", sProgramPath);
|
SprintfLiteral(icon_path, "%s.png", sProgramPath);
|
||||||
|
|
||||||
g_signal_connect(G_OBJECT(sWin), "delete_event",
|
g_signal_connect(G_OBJECT(sWin), "delete_event",
|
||||||
G_CALLBACK(OnDeleteEvent), nullptr);
|
G_CALLBACK(OnDeleteEvent), nullptr);
|
||||||
|
@ -7,6 +7,7 @@
|
|||||||
#import <Cocoa/Cocoa.h>
|
#import <Cocoa/Cocoa.h>
|
||||||
#include <stdio.h>
|
#include <stdio.h>
|
||||||
#include <unistd.h>
|
#include <unistd.h>
|
||||||
|
#include "mozilla/Sprintf.h"
|
||||||
#include "progressui.h"
|
#include "progressui.h"
|
||||||
#include "readstrings.h"
|
#include "readstrings.h"
|
||||||
#include "errors.h"
|
#include "errors.h"
|
||||||
@ -110,7 +111,7 @@ ShowProgressUI(bool indeterminate)
|
|||||||
return 0;
|
return 0;
|
||||||
|
|
||||||
char path[PATH_MAX];
|
char path[PATH_MAX];
|
||||||
snprintf(path, sizeof(path), "%s/updater.ini", sUpdatePath);
|
SprintfLiteral(path, "%s/updater.ini", sUpdatePath);
|
||||||
if (ReadStrings(path, &sLabels) != OK)
|
if (ReadStrings(path, &sLabels) != OK)
|
||||||
return -1;
|
return -1;
|
||||||
|
|
||||||
|
@ -18,6 +18,7 @@
|
|||||||
#endif
|
#endif
|
||||||
#include "mozilla/ThreadLocal.h"
|
#include "mozilla/ThreadLocal.h"
|
||||||
#include "mozilla/TimeStamp.h"
|
#include "mozilla/TimeStamp.h"
|
||||||
|
#include "mozilla/Sprintf.h"
|
||||||
#include "PseudoStack.h"
|
#include "PseudoStack.h"
|
||||||
#include "GeckoSampler.h"
|
#include "GeckoSampler.h"
|
||||||
#ifndef SPS_STANDALONE
|
#ifndef SPS_STANDALONE
|
||||||
@ -429,7 +430,7 @@ mozilla_sampler_log(const char *fmt, va_list args)
|
|||||||
char buf[2048];
|
char buf[2048];
|
||||||
va_list argsCpy;
|
va_list argsCpy;
|
||||||
VARARGS_ASSIGN(argsCpy, args);
|
VARARGS_ASSIGN(argsCpy, args);
|
||||||
int required = vsnprintf(buf, sizeof(buf), fmt, argsCpy);
|
int required = VsprintfLiteral(buf, fmt, argsCpy);
|
||||||
va_end(argsCpy);
|
va_end(argsCpy);
|
||||||
|
|
||||||
if (required < 0) {
|
if (required < 0) {
|
||||||
|
@ -11,6 +11,7 @@
|
|||||||
#include <fcntl.h>
|
#include <fcntl.h>
|
||||||
|
|
||||||
#include "mozilla/Assertions.h"
|
#include "mozilla/Assertions.h"
|
||||||
|
#include "mozilla/Sprintf.h"
|
||||||
|
|
||||||
#include "PlatformMacros.h"
|
#include "PlatformMacros.h"
|
||||||
#include "AutoObjectMapper.h"
|
#include "AutoObjectMapper.h"
|
||||||
@ -43,8 +44,8 @@ failedToMessage(void(*aLog)(const char*),
|
|||||||
const char* aHowFailed, std::string aFileName)
|
const char* aHowFailed, std::string aFileName)
|
||||||
{
|
{
|
||||||
char buf[300];
|
char buf[300];
|
||||||
snprintf(buf, sizeof(buf), "AutoObjectMapper::Map: Failed to %s \'%s\'",
|
SprintfLiteral(buf, "AutoObjectMapper::Map: Failed to %s \'%s\'",
|
||||||
aHowFailed, aFileName.c_str());
|
aHowFailed, aFileName.c_str());
|
||||||
buf[sizeof(buf)-1] = 0;
|
buf[sizeof(buf)-1] = 0;
|
||||||
aLog(buf);
|
aLog(buf);
|
||||||
}
|
}
|
||||||
|
@ -59,6 +59,7 @@
|
|||||||
#include <vector>
|
#include <vector>
|
||||||
|
|
||||||
#include "mozilla/Assertions.h"
|
#include "mozilla/Assertions.h"
|
||||||
|
#include "mozilla/Sprintf.h"
|
||||||
|
|
||||||
#include "LulPlatformMacros.h"
|
#include "LulPlatformMacros.h"
|
||||||
#include "LulCommonExt.h"
|
#include "LulCommonExt.h"
|
||||||
@ -359,7 +360,7 @@ bool LoadSymbols(const string& obj_file,
|
|||||||
typedef typename ElfClass::Shdr Shdr;
|
typedef typename ElfClass::Shdr Shdr;
|
||||||
|
|
||||||
char buf[500];
|
char buf[500];
|
||||||
snprintf(buf, sizeof(buf), "LoadSymbols: BEGIN %s\n", obj_file.c_str());
|
SprintfLiteral(buf, "LoadSymbols: BEGIN %s\n", obj_file.c_str());
|
||||||
buf[sizeof(buf)-1] = 0;
|
buf[sizeof(buf)-1] = 0;
|
||||||
log(buf);
|
log(buf);
|
||||||
|
|
||||||
@ -369,7 +370,7 @@ bool LoadSymbols(const string& obj_file,
|
|||||||
GetOffset<ElfClass, Phdr>(elf_header, elf_header->e_phoff),
|
GetOffset<ElfClass, Phdr>(elf_header, elf_header->e_phoff),
|
||||||
elf_header->e_phnum);
|
elf_header->e_phnum);
|
||||||
uintptr_t text_bias = ((uintptr_t)rx_avma) - loading_addr;
|
uintptr_t text_bias = ((uintptr_t)rx_avma) - loading_addr;
|
||||||
snprintf(buf, sizeof(buf),
|
SprintfLiteral(buf,
|
||||||
"LoadSymbols: rx_avma=%llx, text_bias=%llx",
|
"LoadSymbols: rx_avma=%llx, text_bias=%llx",
|
||||||
(unsigned long long int)(uintptr_t)rx_avma,
|
(unsigned long long int)(uintptr_t)rx_avma,
|
||||||
(unsigned long long int)text_bias);
|
(unsigned long long int)text_bias);
|
||||||
@ -434,7 +435,7 @@ bool LoadSymbols(const string& obj_file,
|
|||||||
log("LoadSymbols: read CFI from .eh_frame");
|
log("LoadSymbols: read CFI from .eh_frame");
|
||||||
}
|
}
|
||||||
|
|
||||||
snprintf(buf, sizeof(buf), "LoadSymbols: END %s\n", obj_file.c_str());
|
SprintfLiteral(buf, "LoadSymbols: END %s\n", obj_file.c_str());
|
||||||
buf[sizeof(buf)-1] = 0;
|
buf[sizeof(buf)-1] = 0;
|
||||||
log(buf);
|
log(buf);
|
||||||
|
|
||||||
|
@ -10,9 +10,10 @@
|
|||||||
#include <stdlib.h>
|
#include <stdlib.h>
|
||||||
#include <signal.h>
|
#include <signal.h>
|
||||||
#include <stdarg.h>
|
#include <stdarg.h>
|
||||||
#include "mozilla/ThreadLocal.h"
|
|
||||||
#include "mozilla/Assertions.h"
|
#include "mozilla/Assertions.h"
|
||||||
#include "mozilla/GuardObjects.h"
|
#include "mozilla/GuardObjects.h"
|
||||||
|
#include "mozilla/Sprintf.h"
|
||||||
|
#include "mozilla/ThreadLocal.h"
|
||||||
#include "mozilla/UniquePtr.h"
|
#include "mozilla/UniquePtr.h"
|
||||||
#ifndef SPS_STANDALONE
|
#ifndef SPS_STANDALONE
|
||||||
#include "nscore.h"
|
#include "nscore.h"
|
||||||
@ -443,8 +444,8 @@ public:
|
|||||||
|
|
||||||
// We have to use seperate printf's because we're using
|
// We have to use seperate printf's because we're using
|
||||||
// the vargs.
|
// the vargs.
|
||||||
::vsnprintf(buff, SAMPLER_MAX_STRING, aFormat, args);
|
VsprintfLiteral(buff, aFormat, args);
|
||||||
::snprintf(mDest, SAMPLER_MAX_STRING, "%s %s", aInfo, buff);
|
SprintfLiteral(mDest, "%s %s", aInfo, buff);
|
||||||
|
|
||||||
mHandle = mozilla_sampler_call_enter(mDest, aCategory, this, true, line);
|
mHandle = mozilla_sampler_call_enter(mDest, aCategory, this, true, line);
|
||||||
va_end(args);
|
va_end(args);
|
||||||
|
@ -12,6 +12,7 @@
|
|||||||
#include <notify.h>
|
#include <notify.h>
|
||||||
#include "nsCocoaDebugUtils.h"
|
#include "nsCocoaDebugUtils.h"
|
||||||
#include "mozilla/Preferences.h"
|
#include "mozilla/Preferences.h"
|
||||||
|
#include "mozilla/Sprintf.h"
|
||||||
|
|
||||||
int nsSandboxViolationSink::mNotifyToken = 0;
|
int nsSandboxViolationSink::mNotifyToken = 0;
|
||||||
uint64_t nsSandboxViolationSink::mLastMsgReceived = 0;
|
uint64_t nsSandboxViolationSink::mLastMsgReceived = 0;
|
||||||
@ -59,7 +60,7 @@ nsSandboxViolationSink::ViolationHandler()
|
|||||||
|
|
||||||
// Only get reports that were generated very recently.
|
// Only get reports that were generated very recently.
|
||||||
char query_time[30] = {0};
|
char query_time[30] = {0};
|
||||||
snprintf(query_time, sizeof(query_time), "%li", time(NULL) - 2);
|
SprintfLiteral(query_time, "%li", time(NULL) - 2);
|
||||||
asl_set_query(query, ASL_KEY_TIME, query_time,
|
asl_set_query(query, ASL_KEY_TIME, query_time,
|
||||||
ASL_QUERY_OP_NUMERIC | ASL_QUERY_OP_GREATER_EQUAL);
|
ASL_QUERY_OP_NUMERIC | ASL_QUERY_OP_GREATER_EQUAL);
|
||||||
|
|
||||||
@ -74,7 +75,7 @@ nsSandboxViolationSink::ViolationHandler()
|
|||||||
// be better to make the chrome process log all the other processes'
|
// be better to make the chrome process log all the other processes'
|
||||||
// violations.
|
// violations.
|
||||||
char query_pid[20] = {0};
|
char query_pid[20] = {0};
|
||||||
snprintf(query_pid, sizeof(query_pid), "%u", getpid());
|
SprintfLiteral(query_pid, "%u", getpid());
|
||||||
asl_set_query(query, ASL_KEY_REF_PID, query_pid, ASL_QUERY_OP_EQUAL);
|
asl_set_query(query, ASL_KEY_REF_PID, query_pid, ASL_QUERY_OP_EQUAL);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -12,6 +12,7 @@
|
|||||||
#include "prprf.h"
|
#include "prprf.h"
|
||||||
#include "mozilla/SSE.h"
|
#include "mozilla/SSE.h"
|
||||||
#include "mozilla/arm.h"
|
#include "mozilla/arm.h"
|
||||||
|
#include "mozilla/Sprintf.h"
|
||||||
|
|
||||||
#ifdef XP_WIN
|
#ifdef XP_WIN
|
||||||
#include <time.h>
|
#include <time.h>
|
||||||
@ -703,9 +704,8 @@ nsSystemInfo::Init()
|
|||||||
#endif
|
#endif
|
||||||
|
|
||||||
if (gtkver_len <= 0) {
|
if (gtkver_len <= 0) {
|
||||||
gtkver_len = snprintf(gtkver, sizeof(gtkver), "GTK %u.%u.%u",
|
gtkver_len = SprintfLiteral(gtkver, "GTK %u.%u.%u", gtk_major_version,
|
||||||
gtk_major_version, gtk_minor_version,
|
gtk_minor_version, gtk_micro_version);
|
||||||
gtk_micro_version);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
nsAutoCString secondaryLibrary;
|
nsAutoCString secondaryLibrary;
|
||||||
|
@ -11,6 +11,8 @@
|
|||||||
#include "nsXPCOMStrings.h"
|
#include "nsXPCOMStrings.h"
|
||||||
#include "nsDebug.h"
|
#include "nsDebug.h"
|
||||||
|
|
||||||
|
#include "mozilla/Sprintf.h"
|
||||||
|
|
||||||
#include <stdio.h>
|
#include <stdio.h>
|
||||||
|
|
||||||
// nsAString
|
// nsAString
|
||||||
@ -521,9 +523,7 @@ nsAString::AppendInt(int aInt, int32_t aRadix)
|
|||||||
}
|
}
|
||||||
|
|
||||||
char buf[20];
|
char buf[20];
|
||||||
int len = snprintf(buf, sizeof(buf), fmt, aInt);
|
int len = SprintfLiteral(buf, fmt, aInt);
|
||||||
buf[sizeof(buf) - 1] = '\0';
|
|
||||||
|
|
||||||
Append(NS_ConvertASCIItoUTF16(buf, len));
|
Append(NS_ConvertASCIItoUTF16(buf, len));
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -1001,9 +1001,7 @@ nsACString::AppendInt(int aInt, int32_t aRadix)
|
|||||||
}
|
}
|
||||||
|
|
||||||
char buf[20];
|
char buf[20];
|
||||||
int len = snprintf(buf, sizeof(buf), fmt, aInt);
|
int len = SprintfLiteral(buf, fmt, aInt);
|
||||||
buf[sizeof(buf) - 1] = '\0';
|
|
||||||
|
|
||||||
Append(buf, len);
|
Append(buf, len);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -15,6 +15,7 @@
|
|||||||
#include <stdio.h>
|
#include <stdio.h>
|
||||||
|
|
||||||
#include "mozilla/FileUtils.h"
|
#include "mozilla/FileUtils.h"
|
||||||
|
#include "mozilla/Sprintf.h"
|
||||||
|
|
||||||
using namespace mozilla;
|
using namespace mozilla;
|
||||||
|
|
||||||
@ -346,7 +347,7 @@ XPCOMGlueLoadXULFunctions(const nsDynamicFunctionLoad* aSymbols)
|
|||||||
nsresult rv = NS_OK;
|
nsresult rv = NS_OK;
|
||||||
while (aSymbols->functionName) {
|
while (aSymbols->functionName) {
|
||||||
char buffer[512];
|
char buffer[512];
|
||||||
snprintf(buffer, sizeof(buffer), "%s", aSymbols->functionName);
|
SprintfLiteral(buffer, "%s", aSymbols->functionName);
|
||||||
|
|
||||||
*aSymbols->function = (NSFuncPtr)GetSymbol(sTop->libHandle, buffer);
|
*aSymbols->function = (NSFuncPtr)GetSymbol(sTop->libHandle, buffer);
|
||||||
if (!*aSymbols->function) {
|
if (!*aSymbols->function) {
|
||||||
|
@ -10,6 +10,7 @@
|
|||||||
|
|
||||||
#include "mozilla/ArrayUtils.h"
|
#include "mozilla/ArrayUtils.h"
|
||||||
#include "mozilla/Attributes.h"
|
#include "mozilla/Attributes.h"
|
||||||
|
#include "mozilla/Sprintf.h"
|
||||||
|
|
||||||
#include <sys/types.h>
|
#include <sys/types.h>
|
||||||
#include <sys/stat.h>
|
#include <sys/stat.h>
|
||||||
@ -1296,7 +1297,7 @@ GetDeviceName(int aDeviceMajor, int aDeviceMinor, nsACString& aDeviceName)
|
|||||||
char mountinfoLine[kMountInfoLineLength];
|
char mountinfoLine[kMountInfoLineLength];
|
||||||
char deviceNum[kMountInfoLineLength];
|
char deviceNum[kMountInfoLineLength];
|
||||||
|
|
||||||
snprintf(deviceNum, kMountInfoLineLength, "%d:%d", aDeviceMajor, aDeviceMinor);
|
SprintfLiteral(deviceNum, "%d:%d", aDeviceMajor, aDeviceMinor);
|
||||||
|
|
||||||
FILE* f = fopen("/proc/self/mountinfo", "rt");
|
FILE* f = fopen("/proc/self/mountinfo", "rt");
|
||||||
if (!f) {
|
if (!f) {
|
||||||
|
Loading…
Reference in New Issue
Block a user