summaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
authorzhanyong.wan <zhanyong.wan@861a406c-534a-0410-8894-cb66d6ee9925>2009-01-29 06:49:00 (GMT)
committerzhanyong.wan <zhanyong.wan@861a406c-534a-0410-8894-cb66d6ee9925>2009-01-29 06:49:00 (GMT)
commit4b83461e9772cce62e84310060fe84172e9bf4ba (patch)
tree81c398e25c7db78187ecb3c6a756b9996140943b /src
parentc946ae60194727ede9d3ef44754839f48541a981 (diff)
downloadgoogletest-4b83461e9772cce62e84310060fe84172e9bf4ba.zip
googletest-4b83461e9772cce62e84310060fe84172e9bf4ba.tar.gz
googletest-4b83461e9772cce62e84310060fe84172e9bf4ba.tar.bz2
Fixes some warnings when compiled with MSVC at warning level 4.
Diffstat (limited to 'src')
-rw-r--r--src/gtest-internal-inl.h4
-rw-r--r--src/gtest.cc22
2 files changed, 13 insertions, 13 deletions
diff --git a/src/gtest-internal-inl.h b/src/gtest-internal-inl.h
index caa0877..ef3fe98 100644
--- a/src/gtest-internal-inl.h
+++ b/src/gtest-internal-inl.h
@@ -901,6 +901,8 @@ class DefaultGlobalTestPartResultReporter
private:
UnitTestImpl* const unit_test_;
+
+ GTEST_DISALLOW_COPY_AND_ASSIGN_(DefaultGlobalTestPartResultReporter);
};
// This is the default per thread test part result reporter used in
@@ -915,6 +917,8 @@ class DefaultPerThreadTestPartResultReporter
private:
UnitTestImpl* const unit_test_;
+
+ GTEST_DISALLOW_COPY_AND_ASSIGN_(DefaultPerThreadTestPartResultReporter);
};
// The private implementation of the UnitTest class. We don't protect
diff --git a/src/gtest.cc b/src/gtest.cc
index 903dcd9..2607767 100644
--- a/src/gtest.cc
+++ b/src/gtest.cc
@@ -374,7 +374,7 @@ bool UnitTestOptions::PatternMatchesString(const char *pattern,
bool UnitTestOptions::MatchesFilter(const String& name, const char* filter) {
const char *cur_pattern = filter;
- while (true) {
+ for (;;) {
if (PatternMatchesString(cur_pattern, name.c_str())) {
return true;
}
@@ -1458,23 +1458,19 @@ char* CodePointToUtf8(UInt32 code_point, char* str) {
// and thus should be combined into a single Unicode code point
// using CreateCodePointFromUtf16SurrogatePair.
inline bool IsUtf16SurrogatePair(wchar_t first, wchar_t second) {
- if (sizeof(wchar_t) == 2)
- return (first & 0xFC00) == 0xD800 && (second & 0xFC00) == 0xDC00;
- else
- return false;
+ return sizeof(wchar_t) == 2 &&
+ (first & 0xFC00) == 0xD800 && (second & 0xFC00) == 0xDC00;
}
// Creates a Unicode code point from UTF16 surrogate pair.
inline UInt32 CreateCodePointFromUtf16SurrogatePair(wchar_t first,
wchar_t second) {
- if (sizeof(wchar_t) == 2) {
- const UInt32 mask = (1 << 10) - 1;
- return (((first & mask) << 10) | (second & mask)) + 0x10000;
- } else {
- // This should not be called, but we provide a sensible default
- // in case it is.
- return static_cast<UInt32>(first);
- }
+ const UInt32 mask = (1 << 10) - 1;
+ return (sizeof(wchar_t) == 2) ?
+ (((first & mask) << 10) | (second & mask)) + 0x10000 :
+ // This function should not be called when the condition is
+ // false, but we provide a sensible default in case it is.
+ static_cast<UInt32>(first);
}
// Converts a wide string to a narrow string in UTF-8 encoding.