Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(209)

Unified Diff: base/strings/stringprintf_unittest.cc

Issue 632103004: Cleanup: Better constify some strings in base. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: fix bad refactoring Created 6 years, 2 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « base/strings/string_util_unittest.cc ('k') | base/sys_info_chromeos.cc » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: base/strings/stringprintf_unittest.cc
diff --git a/base/strings/stringprintf_unittest.cc b/base/strings/stringprintf_unittest.cc
index a1bf2da42696504c7c780fea7eb6079f2c1ae512..4935b553b0e41c88b1ddf4ca82df18b9ee7309d0 100644
--- a/base/strings/stringprintf_unittest.cc
+++ b/base/strings/stringprintf_unittest.cc
@@ -106,7 +106,7 @@ TEST(StringPrintfTest, Grow) {
src[i] = 'A';
src[1025] = 0;
- const char* fmt = "%sB%sB%sB%sB%sB%sB%s";
+ const char fmt[] = "%sB%sB%sB%sB%sB%sB%s";
std::string out;
SStringPrintf(&out, fmt, src, src, src, src, src, src, src);
@@ -132,14 +132,15 @@ TEST(StringPrintfTest, StringAppendV) {
// Test the boundary condition for the size of the string_util's
// internal buffer.
TEST(StringPrintfTest, GrowBoundary) {
- const int string_util_buf_len = 1024;
+ const int kStringUtilBufLen = 1024;
// Our buffer should be one larger than the size of StringAppendVT's stack
// buffer.
- const int buf_len = string_util_buf_len + 1;
- char src[buf_len + 1]; // Need extra one for NULL-terminator.
- for (int i = 0; i < buf_len; ++i)
+ // And need extra one for NULL-terminator.
+ const int kBufLen = kStringUtilBufLen + 1 + 1;
+ char src[kBufLen];
+ for (int i = 0; i < kBufLen - 1; ++i)
src[i] = 'a';
- src[buf_len] = 0;
+ src[kBufLen - 1] = 0;
std::string out;
SStringPrintf(&out, "%s", src);
« no previous file with comments | « base/strings/string_util_unittest.cc ('k') | base/sys_info_chromeos.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698