Move the file reader into the anonymous namespace in test_helpers which is the only user. Bug: 668 Change-Id: Idd650d14fb7f9e0b7b15a7fd08e21f9a7081cc14 Reviewed-on: https://boringssl-review.googlesource.com/c/boringssl/+/64168 Reviewed-by: Adam Langley <agl@google.com> Commit-Queue: Bob Beck <bbe@google.com> Auto-Submit: Bob Beck <bbe@google.com>chromium-stable
parent
410247096a
commit
d11c31c7df
7 changed files with 24 additions and 64 deletions
@ -1,35 +0,0 @@ |
||||
// Copyright 2023 The Chromium Authors
|
||||
// Use of this source code is governed by a BSD-style license that can be
|
||||
// found in the LICENSE file.
|
||||
|
||||
#include "file_util.h" |
||||
|
||||
#include <fstream> |
||||
#include <iostream> |
||||
#include <streambuf> |
||||
#include <string> |
||||
|
||||
namespace bssl { |
||||
|
||||
namespace fillins { |
||||
|
||||
bool ReadFileToString(const FilePath &path, std::string *out) { |
||||
std::ifstream file(path.value(), std::ios::binary); |
||||
file.unsetf(std::ios::skipws); |
||||
|
||||
file.seekg(0, std::ios::end); |
||||
if (file.tellg() <= 0) { |
||||
return false; |
||||
} |
||||
out->reserve(file.tellg()); |
||||
file.seekg(0, std::ios::beg); |
||||
|
||||
out->assign(std::istreambuf_iterator<char>(file), |
||||
std::istreambuf_iterator<char>()); |
||||
|
||||
return true; |
||||
} |
||||
|
||||
} // namespace fillins
|
||||
|
||||
} // namespace bssl
|
@ -1,24 +0,0 @@ |
||||
// Copyright 2023 The Chromium Authors
|
||||
// Use of this source code is governed by a BSD-style license that can be
|
||||
// found in the LICENSE file.
|
||||
|
||||
#ifndef BSSL_FILLINS_FILE_UTIL_H |
||||
#define BSSL_FILLINS_FILE_UTIL_H |
||||
|
||||
#include <openssl/base.h> |
||||
|
||||
#include "path_service.h" |
||||
|
||||
#include <string> |
||||
|
||||
namespace bssl { |
||||
|
||||
namespace fillins { |
||||
|
||||
bool ReadFileToString(const FilePath &path, std::string *out); |
||||
|
||||
} // namespace fillins
|
||||
|
||||
} // namespace bssl
|
||||
|
||||
#endif // BSSL_FILLINS_FILE_UTIL_H
|
Loading…
Reference in new issue