From 56b37345d99f2cd85720f6b1aa1934fa3bfe29a6 Mon Sep 17 00:00:00 2001 From: Colin Cross Date: Thu, 30 Apr 2015 15:12:21 -0700 Subject: Fix comparison between signed and unsigned error on darwin mode_t is a uint16_t on darwin, which causes sb.st_mode & ~S_IFMT to produce an int when the uint16_t is promoted for the operator. Cast to unsigned int before comparing against 0660U. Change-Id: Ib1439c08d9e2b297eeeba701891508d269c19a3d --- base/file_test.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'base') diff --git a/base/file_test.cpp b/base/file_test.cpp index cbb275130..b138094e3 100644 --- a/base/file_test.cpp +++ b/base/file_test.cpp @@ -66,7 +66,7 @@ TEST(file, WriteStringToFile2) { << strerror(errno); struct stat sb; ASSERT_EQ(0, stat(tf.filename, &sb)); - ASSERT_EQ(0660U, (sb.st_mode & ~S_IFMT)); + ASSERT_EQ(0660U, static_cast(sb.st_mode & ~S_IFMT)); ASSERT_EQ(getuid(), sb.st_uid); ASSERT_EQ(getgid(), sb.st_gid); std::string s; -- cgit v1.2.3