[go: nahoru, domu]

base: Stop overloading ReadFileToString()

With the existing code, base::Bind(&base::ReadFileToString) doesn't compile because
the compiler cannot infer the argument's type (2-argument version or
3-argument version).
base::Bind<bool(*)(const base::FilePath&,
std::string*)>(&base::ReadFileToString) compiles but it doesn't look
desirable.

As our style guide discourages function overloading(*), rename the 3-argument version (added in http://crrev.com/157593005) to stop overloading.

*https://google.github.io/styleguide/cppguide.html#Function_Overloading

BUG=None
TBR=sgurun@chromium.org for android_webview, derat@chromium.org for chromeos/accelerometer, bartfab@chromium.org for components/policy, dsinclair@chromium.org for components/tracing, estade@chromium.org for content/browser/webui, sergeyu@chromium.org for remoting

Review URL: https://codereview.chromium.org/1719983005

Cr-Commit-Position: refs/heads/master@{#377209}
diff --git a/base/files/file_util.cc b/base/files/file_util.cc
index 9e35b67..3169370 100644
--- a/base/files/file_util.cc
+++ b/base/files/file_util.cc
@@ -124,9 +124,9 @@
 }
 #endif  // !defined(OS_NACL_NONSFI)
 
-bool ReadFileToString(const FilePath& path,
-                      std::string* contents,
-                      size_t max_size) {
+bool ReadFileToStringWithMaxSize(const FilePath& path,
+                                 std::string* contents,
+                                 size_t max_size) {
   if (contents)
     contents->clear();
   if (path.ReferencesParent())
@@ -162,7 +162,8 @@
 }
 
 bool ReadFileToString(const FilePath& path, std::string* contents) {
-  return ReadFileToString(path, contents, std::numeric_limits<size_t>::max());
+  return ReadFileToStringWithMaxSize(path, contents,
+                                     std::numeric_limits<size_t>::max());
 }
 
 #if !defined(OS_NACL_NONSFI)