summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
author <shinichiro.hamaji@gmail.com>2012-01-12 07:46:39 +0000
committer <shinichiro.hamaji@gmail.com>2012-01-12 07:46:39 +0000
commitfe0967b999242a9b8053bb7acdb74608dffa37fe (patch)
treebc18cbfc15e762957537ce5200d3c53595606302 /src
parent11e78e4c66a1db78e611fac91fd3429059976f38 (diff)
downloadglog-fe0967b999242a9b8053bb7acdb74608dffa37fe.tar.gz
glog-fe0967b999242a9b8053bb7acdb74608dffa37fe.tar.bz2
glog-fe0967b999242a9b8053bb7acdb74608dffa37fe.zip
Fix the wrong use of sizeof
git-svn-id: https://google-glog.googlecode.com/svn/trunk@104 eb4d4688-79bd-11dd-afb4-1d65580434c0
Diffstat (limited to 'src')
-rw-r--r--src/logging_unittest.cc6
1 files changed, 3 insertions, 3 deletions
diff --git a/src/logging_unittest.cc b/src/logging_unittest.cc
index bb79b9a..cf41583 100644
--- a/src/logging_unittest.cc
+++ b/src/logging_unittest.cc
@@ -785,9 +785,9 @@ static void TestOneTruncate(const char *path, int64 limit, int64 keep,
CHECK_ERR(lseek(fd, 0, SEEK_SET));
// File should contain the suffix of the original file
- int buf_size = statbuf.st_size + 1;
+ const size_t buf_size = statbuf.st_size + 1;
char* buf = new char[buf_size];
- memset(buf, 0, sizeof(buf));
+ memset(buf, 0, buf_size);
CHECK_ERR(read(fd, buf, buf_size));
const char *p = buf;
@@ -1036,7 +1036,7 @@ static void TestLogSinkWaitTillSent() {
TEST(Strerror, logging) {
int errcode = EINTR;
char *msg = strdup(strerror(errcode));
- int buf_size = strlen(msg) + 1;
+ const size_t buf_size = strlen(msg) + 1;
char *buf = new char[buf_size];
CHECK_EQ(posix_strerror_r(errcode, NULL, 0), -1);
buf[0] = 'A';