diff options
author | Elliott Hughes <enh@google.com> | 2023-08-11 00:52:33 +0000 |
---|---|---|
committer | Automerger Merge Worker <android-build-automerger-merge-worker@system.gserviceaccount.com> | 2023-08-11 00:52:33 +0000 |
commit | c9c160dbfd52b61faae9473c1b18c1a0f7869908 (patch) | |
tree | f98d11d6a158167e19fc9141c79d877280a616a6 /src/client/mac/crash_generation/ConfigFile.mm | |
parent | 8d0176459cfc11e28e9427a7eadcf7a42f654f62 (diff) | |
parent | 4e7c6460d73c00031288165da053692764abbeb1 (diff) | |
download | google-breakpad-c9c160dbfd52b61faae9473c1b18c1a0f7869908.tar.gz |
Upgrade google-breakpad to v2023.01.27 am: 332a4371ed am: c3c25b3748 am: 4e7c6460d7
Original change: https://android-review.googlesource.com/c/platform/external/google-breakpad/+/2704174
Change-Id: I2d2b4a054618219b535cae768882f677ca986b75
Signed-off-by: Automerger Merge Worker <android-build-automerger-merge-worker@system.gserviceaccount.com>
Diffstat (limited to 'src/client/mac/crash_generation/ConfigFile.mm')
-rw-r--r-- | src/client/mac/crash_generation/ConfigFile.mm | 40 |
1 files changed, 20 insertions, 20 deletions
diff --git a/src/client/mac/crash_generation/ConfigFile.mm b/src/client/mac/crash_generation/ConfigFile.mm index acab7de8..fe89e858 100644 --- a/src/client/mac/crash_generation/ConfigFile.mm +++ b/src/client/mac/crash_generation/ConfigFile.mm @@ -1,5 +1,4 @@ -// Copyright (c) 2011, Google Inc. -// All rights reserved. +// Copyright 2011 Google LLC // // Redistribution and use in source and binary forms, with or without // modification, are permitted provided that the following conditions are @@ -11,7 +10,7 @@ // copyright notice, this list of conditions and the following disclaimer // in the documentation and/or other materials provided with the // distribution. -// * Neither the name of Google Inc. nor the names of its +// * Neither the name of Google LLC nor the names of its // contributors may be used to endorse or promote products derived from // this software without specific prior written permission. // @@ -42,10 +41,10 @@ namespace google_breakpad { //============================================================================= -BOOL EnsureDirectoryPathExists(NSString *dirPath) { - NSFileManager *mgr = [NSFileManager defaultManager]; +BOOL EnsureDirectoryPathExists(NSString* dirPath) { + NSFileManager* mgr = [NSFileManager defaultManager]; - NSDictionary *attrs = + NSDictionary* attrs = [NSDictionary dictionaryWithObject:[NSNumber numberWithUnsignedLong:0750] forKey:NSFilePosixPermissions]; @@ -56,15 +55,15 @@ BOOL EnsureDirectoryPathExists(NSString *dirPath) { } //============================================================================= -BOOL ConfigFile::WriteData(const void *data, size_t length) { +BOOL ConfigFile::WriteData(const void* data, size_t length) { size_t result = write(config_file_, data, length); return result == length; } //============================================================================= -BOOL ConfigFile::AppendConfigData(const char *key, - const void *data, size_t length) { +BOOL ConfigFile::AppendConfigData(const char* key, + const void* data, size_t length) { assert(config_file_ != -1); if (!key) { @@ -88,13 +87,13 @@ BOOL ConfigFile::AppendConfigData(const char *key, } //============================================================================= -BOOL ConfigFile::AppendConfigString(const char *key, - const char *value) { +BOOL ConfigFile::AppendConfigString(const char* key, + const char* value) { return AppendConfigData(key, value, strlen(value)); } //============================================================================= -BOOL ConfigFile::AppendCrashTimeParameters(const char *processStartTimeString) { +BOOL ConfigFile::AppendCrashTimeParameters(const char* processStartTimeString) { // Set process uptime parameter struct timeval tv; gettimeofday(&tv, NULL); @@ -105,22 +104,23 @@ BOOL ConfigFile::AppendCrashTimeParameters(const char *processStartTimeString) { time_t processStartTime = strtol(processStartTimeString, NULL, 10); time_t processUptime = tv.tv_sec - processStartTime; // Store the uptime in milliseconds. - sprintf(processUptimeString, "%llu", - static_cast<unsigned long long int>(processUptime) * 1000); + snprintf(processUptimeString, sizeof(processUptimeString), "%llu", + static_cast<unsigned long long int>(processUptime) * 1000); if (!AppendConfigString(BREAKPAD_PROCESS_UP_TIME, processUptimeString)) return false; } - sprintf(processCrashtimeString, "%zd", tv.tv_sec); + snprintf(processCrashtimeString, sizeof(processCrashtimeString), "%llu", + static_cast<unsigned long long int>(tv.tv_sec)); return AppendConfigString(BREAKPAD_PROCESS_CRASH_TIME, processCrashtimeString); } //============================================================================= void ConfigFile::WriteFile(const char* directory, - const SimpleStringDictionary *configurationParameters, - const char *dump_dir, - const char *minidump_id) { + const SimpleStringDictionary* configurationParameters, + const char* dump_dir, + const char* minidump_id) { assert(config_file_ == -1); @@ -146,9 +146,9 @@ void ConfigFile::WriteFile(const char* directory, // Write out the configuration parameters BOOL result = YES; - const SimpleStringDictionary &dictionary = *configurationParameters; + const SimpleStringDictionary& dictionary = *configurationParameters; - const SimpleStringDictionary::Entry *entry = NULL; + const SimpleStringDictionary::Entry* entry = NULL; SimpleStringDictionary::Iterator iter(dictionary); while ((entry = iter.Next())) { |