forked from OSchip/llvm-project
[lldb] Avoid snprintf in PlatformRemoteDarwinDevice
This quashes a -Wformat-truncation warning.
This commit is contained in:
parent
2bd252ea89
commit
5871cba861
|
@ -449,12 +449,10 @@ Status PlatformRemoteDarwinDevice::GetSymbolFile(const FileSpec &platform_file,
|
|||
Status error;
|
||||
char platform_file_path[PATH_MAX];
|
||||
if (platform_file.GetPath(platform_file_path, sizeof(platform_file_path))) {
|
||||
char resolved_path[PATH_MAX];
|
||||
|
||||
const char *os_version_dir = GetDeviceSupportDirectoryForOSVersion();
|
||||
if (os_version_dir) {
|
||||
::snprintf(resolved_path, sizeof(resolved_path), "%s/%s", os_version_dir,
|
||||
platform_file_path);
|
||||
std::string resolved_path =
|
||||
(llvm::Twine(os_version_dir) + "/" + platform_file_path).str();
|
||||
|
||||
local_file.SetFile(resolved_path, FileSpec::Style::native);
|
||||
FileSystem::Instance().Resolve(local_file);
|
||||
|
@ -466,31 +464,28 @@ Status PlatformRemoteDarwinDevice::GetSymbolFile(const FileSpec &platform_file,
|
|||
return error;
|
||||
}
|
||||
|
||||
::snprintf(resolved_path, sizeof(resolved_path), "%s/Symbols.Internal/%s",
|
||||
os_version_dir, platform_file_path);
|
||||
resolved_path = (llvm::Twine(os_version_dir) + "/Symbols.Internal/" +
|
||||
platform_file_path)
|
||||
.str();
|
||||
|
||||
local_file.SetFile(resolved_path, FileSpec::Style::native);
|
||||
FileSystem::Instance().Resolve(local_file);
|
||||
if (FileSystem::Instance().Exists(local_file)) {
|
||||
if (log) {
|
||||
LLDB_LOGF(
|
||||
log,
|
||||
"Found a copy of %s in the DeviceSupport dir %s/Symbols.Internal",
|
||||
platform_file_path, os_version_dir);
|
||||
}
|
||||
LLDB_LOGF(
|
||||
log,
|
||||
"Found a copy of %s in the DeviceSupport dir %s/Symbols.Internal",
|
||||
platform_file_path, os_version_dir);
|
||||
return error;
|
||||
}
|
||||
::snprintf(resolved_path, sizeof(resolved_path), "%s/Symbols/%s",
|
||||
os_version_dir, platform_file_path);
|
||||
resolved_path =
|
||||
(llvm::Twine(os_version_dir) + "/Symbols/" + platform_file_path)
|
||||
.str();
|
||||
|
||||
local_file.SetFile(resolved_path, FileSpec::Style::native);
|
||||
FileSystem::Instance().Resolve(local_file);
|
||||
if (FileSystem::Instance().Exists(local_file)) {
|
||||
if (log) {
|
||||
LLDB_LOGF(log,
|
||||
"Found a copy of %s in the DeviceSupport dir %s/Symbols",
|
||||
platform_file_path, os_version_dir);
|
||||
}
|
||||
LLDB_LOGF(log, "Found a copy of %s in the DeviceSupport dir %s/Symbols",
|
||||
platform_file_path, os_version_dir);
|
||||
return error;
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue