diff options
author | deanm@chromium.org <deanm@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2009-01-02 12:57:53 +0000 |
---|---|---|
committer | deanm@chromium.org <deanm@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2009-01-02 12:57:53 +0000 |
commit | e15c8e011e4a6131e7e2745c5d75d0c3f1a5d685 (patch) | |
tree | 4fdc430f814d604202d329bc41fb3cde9deb941c /base | |
parent | deab34b9ae3023686b243e6aab9d4f790400bf88 (diff) | |
download | chromium_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 'base')
-rw-r--r-- | base/file_util_posix.cc | 2 |
1 files changed, 1 insertions, 1 deletions
diff --git a/base/file_util_posix.cc b/base/file_util_posix.cc index a05b053..3bab4d1 100644 --- a/base/file_util_posix.cc +++ b/base/file_util_posix.cc @@ -460,7 +460,7 @@ FilePath FileEnumerator::Next() { // Start a new find operation. int ftsflags = FTS_LOGICAL; char top_dir[PATH_MAX]; - base::strlcpy(top_dir, root_path_.value().c_str(), sizeof(top_dir)); + base::strlcpy(top_dir, root_path_.value().c_str(), arraysize(top_dir)); char* dir_list[2] = { top_dir, NULL }; fts_ = fts_open(dir_list, ftsflags, NULL); if (!fts_) |