Fix variable shadowing warning in logging on VS2015
d:\src\cr3\src\base\logging.cc(167): error C2220: warning treated as error - no 'object' file generated
d:\src\cr3\src\base\logging.cc(167): warning C4459: declaration of 'log_file' hides global declaration
d:\src\cr3\src\base\logging.cc(103): note: see declaration of 'logging::`anonymous-namespace'::log_file'
There was 3 different things called log_file in this file: a global FileHandle,
a local PathString, and a PathChar* member variable in LoggingSettings. :/
(Should probably rename all the globals to g_ prefixed in a followup.)
[email protected]
BUG=440500
Review URL: https://codereview.chromium.org/883853003
Cr-Commit-Position: refs/heads/master@{#313364}
diff --git a/base/logging.cc b/base/logging.cc
index 5d65fa5a..c7a88814 100644
--- a/base/logging.cc
+++ b/base/logging.cc
@@ -164,13 +164,12 @@
wchar_t module_name[MAX_PATH];
GetModuleFileName(NULL, module_name, MAX_PATH);
- PathString log_file = module_name;
- PathString::size_type last_backslash =
- log_file.rfind('\\', log_file.size());
+ PathString log_name = module_name;
+ PathString::size_type last_backslash = log_name.rfind('\\', log_name.size());
if (last_backslash != PathString::npos)
- log_file.erase(last_backslash + 1);
- log_file += L"debug.log";
- return log_file;
+ log_name.erase(last_backslash + 1);
+ log_name += L"debug.log";
+ return log_name;
#elif defined(OS_POSIX)
// On other platforms we just use the current directory.
return PathString("debug.log");