summaryrefslogtreecommitdiffstats
path: root/net/disk_cache/mapped_file_unittest.cc
diff options
context:
space:
mode:
authordeanm@chromium.org <deanm@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2009-01-02 12:57:53 +0000
committerdeanm@chromium.org <deanm@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2009-01-02 12:57:53 +0000
commite15c8e011e4a6131e7e2745c5d75d0c3f1a5d685 (patch)
tree4fdc430f814d604202d329bc41fb3cde9deb941c /net/disk_cache/mapped_file_unittest.cc
parentdeab34b9ae3023686b243e6aab9d4f790400bf88 (diff)
downloadchromium_src-e15c8e011e4a6131e7e2745c5d75d0c3f1a5d685.zip
chromium_src-e15c8e011e4a6131e7e2745c5d75d0c3f1a5d685.tar.gz
chromium_src-e15c8e011e4a6131e7e2745c5d75d0c3f1a5d685.tar.bz2
Try to consistently use arraysize() with strlcpy().
For a char*, sizeof() == arraysize(), so there is nothing wrong with the current code. However I think it's important to be clear that the lcpy() functions work in characters and not bytes. The danger would be accidently using sizeof() with wcslcpy, for example copying some code as an example or modifying old code to use a wchar instead of a char. Review URL: http://codereview.chromium.org/17019 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@7536 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'net/disk_cache/mapped_file_unittest.cc')
-rw-r--r--net/disk_cache/mapped_file_unittest.cc5
1 files changed, 3 insertions, 2 deletions
diff --git a/net/disk_cache/mapped_file_unittest.cc b/net/disk_cache/mapped_file_unittest.cc
index 28eeff5..a9b3754 100644
--- a/net/disk_cache/mapped_file_unittest.cc
+++ b/net/disk_cache/mapped_file_unittest.cc
@@ -2,6 +2,7 @@
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
+#include "base/basictypes.h"
#include "base/file_util.h"
#include "base/string_util.h"
#include "net/disk_cache/disk_cache_test_base.h"
@@ -77,7 +78,7 @@ TEST_F(DiskCacheTest, MappedFile_SyncIO) {
char buffer1[20];
char buffer2[20];
CacheTestFillBuffer(buffer1, sizeof(buffer1), false);
- base::strlcpy(buffer1, "the data", sizeof(buffer1));
+ base::strlcpy(buffer1, "the data", arraysize(buffer1));
EXPECT_TRUE(file->Write(buffer1, sizeof(buffer1), 8192));
EXPECT_TRUE(file->Read(buffer2, sizeof(buffer2), 8192));
EXPECT_STREQ(buffer1, buffer2);
@@ -100,7 +101,7 @@ TEST_F(DiskCacheTest, MappedFile_AsyncIO) {
char buffer1[20];
char buffer2[20];
CacheTestFillBuffer(buffer1, sizeof(buffer1), false);
- base::strlcpy(buffer1, "the data", sizeof(buffer1));
+ base::strlcpy(buffer1, "the data", arraysize(buffer1));
bool completed;
EXPECT_TRUE(file->Write(buffer1, sizeof(buffer1), 1024 * 1024, &callback,
&completed));