diff options
author | maf@google.com <maf@google.com@0039d316-1c4b-4281-b951-d872f2087c98> | 2009-08-06 04:09:16 +0000 |
---|---|---|
committer | maf@google.com <maf@google.com@0039d316-1c4b-4281-b951-d872f2087c98> | 2009-08-06 04:09:16 +0000 |
commit | 09175df729ebf3ee0cf79bb01577744674dd24c2 (patch) | |
tree | aea23c43be67ba51a67918d3f4c4762402831adc /o3d | |
parent | 6e713f08e972d4b7cf730c83a53345a4b53e1262 (diff) | |
download | chromium_src-09175df729ebf3ee0cf79bb01577744674dd24c2.zip chromium_src-09175df729ebf3ee0cf79bb01577744674dd24c2.tar.gz chromium_src-09175df729ebf3ee0cf79bb01577744674dd24c2.tar.bz2 |
Lots of changes required to build on GCC in full paranoia mode with no warnings generated.
Review URL: http://codereview.chromium.org/165013
git-svn-id: svn://svn.chromium.org/chrome/trunk/src@22581 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'o3d')
47 files changed, 338 insertions, 321 deletions
diff --git a/o3d/core/cross/bitmap.cc b/o3d/core/cross/bitmap.cc index 3c5f610..35dc34211 100644 --- a/o3d/core/cross/bitmap.cc +++ b/o3d/core/cross/bitmap.cc @@ -832,7 +832,6 @@ bool Bitmap::ScaleUpToPOT(unsigned int width, uint8 *dst, int dst_pitch) { DCHECK(CheckImageDimensions(width, height)); - unsigned int components = 0; switch (format) { case Texture::XRGB8: case Texture::ARGB8: diff --git a/o3d/core/cross/bitmap_test.cc b/o3d/core/cross/bitmap_test.cc index 3fe8be0..36f474c 100644 --- a/o3d/core/cross/bitmap_test.cc +++ b/o3d/core/cross/bitmap_test.cc @@ -363,9 +363,9 @@ TEST_F(BitmapTest, LoadTGAFile24bit) { EXPECT_TRUE(bitmap->image_data() != NULL); EXPECT_FALSE(bitmap->is_cubemap()); EXPECT_EQ(Texture::XRGB8, bitmap->format()); - EXPECT_EQ(256, bitmap->width()); - EXPECT_EQ(256, bitmap->height()); - EXPECT_EQ(1, bitmap->num_mipmaps()); + EXPECT_EQ(256U, bitmap->width()); + EXPECT_EQ(256U, bitmap->height()); + EXPECT_EQ(1U, bitmap->num_mipmaps()); EXPECT_TRUE(TestBitmapData(*bitmap, ktga256x256_24bit_BGRX)); } @@ -378,9 +378,9 @@ TEST_F(BitmapTest, LoadTGAFile32bit) { EXPECT_TRUE(bitmap->image_data() != NULL); EXPECT_FALSE(bitmap->is_cubemap()); EXPECT_EQ(Texture::ARGB8, bitmap->format()); - EXPECT_EQ(256, bitmap->width()); - EXPECT_EQ(256, bitmap->height()); - EXPECT_EQ(1, bitmap->num_mipmaps()); + EXPECT_EQ(256U, bitmap->width()); + EXPECT_EQ(256U, bitmap->height()); + EXPECT_EQ(1U, bitmap->num_mipmaps()); EXPECT_TRUE(TestBitmapData(*bitmap, ktga256x256_32bit_BGRA)); } @@ -405,9 +405,9 @@ TEST_F(BitmapTest, LoadJPEGFile) { EXPECT_TRUE(bitmap->image_data() != NULL); EXPECT_FALSE(bitmap->is_cubemap()); EXPECT_EQ(Texture::XRGB8, bitmap->format()); - EXPECT_EQ(256, bitmap->width()); - EXPECT_EQ(256, bitmap->height()); - EXPECT_EQ(1, bitmap->num_mipmaps()); + EXPECT_EQ(256U, bitmap->width()); + EXPECT_EQ(256U, bitmap->height()); + EXPECT_EQ(1U, bitmap->num_mipmaps()); EXPECT_TRUE(TestBitmapData(*bitmap, kjpg256x256_BGRX)); } @@ -429,9 +429,9 @@ TEST_F(BitmapTest, LoadPNGFile24bit) { EXPECT_TRUE(bitmap->image_data() != NULL); EXPECT_FALSE(bitmap->is_cubemap()); EXPECT_EQ(Texture::XRGB8, bitmap->format()); - EXPECT_EQ(256, bitmap->width()); - EXPECT_EQ(256, bitmap->height()); - EXPECT_EQ(1, bitmap->num_mipmaps()); + EXPECT_EQ(256U, bitmap->width()); + EXPECT_EQ(256U, bitmap->height()); + EXPECT_EQ(1U, bitmap->num_mipmaps()); EXPECT_TRUE(TestBitmapData(*bitmap, kpng256x256_24bit_BGRX)); } @@ -445,9 +445,9 @@ TEST_F(BitmapTest, LoadPNGFile24bitInterlaced) { EXPECT_TRUE(bitmap->image_data() != NULL); EXPECT_FALSE(bitmap->is_cubemap()); EXPECT_EQ(Texture::XRGB8, bitmap->format()); - EXPECT_EQ(256, bitmap->width()); - EXPECT_EQ(256, bitmap->height()); - EXPECT_EQ(1, bitmap->num_mipmaps()); + EXPECT_EQ(256U, bitmap->width()); + EXPECT_EQ(256U, bitmap->height()); + EXPECT_EQ(1U, bitmap->num_mipmaps()); EXPECT_TRUE(TestBitmapData(*bitmap, kpng256x256_24bit_interlaced_BGRX)); } @@ -459,9 +459,9 @@ TEST_F(BitmapTest, LoadPNGFile32bit) { EXPECT_TRUE(bitmap->image_data() != NULL); EXPECT_FALSE(bitmap->is_cubemap()); EXPECT_EQ(Texture::ARGB8, bitmap->format()); - EXPECT_EQ(256, bitmap->width()); - EXPECT_EQ(256, bitmap->height()); - EXPECT_EQ(1, bitmap->num_mipmaps()); + EXPECT_EQ(256U, bitmap->width()); + EXPECT_EQ(256U, bitmap->height()); + EXPECT_EQ(1U, bitmap->num_mipmaps()); EXPECT_TRUE(TestBitmapData(*bitmap, kpng256x256_32bit_BGRA)); } @@ -475,9 +475,9 @@ TEST_F(BitmapTest, LoadPNGFile8bitPalette) { EXPECT_TRUE(bitmap->image_data() != NULL); EXPECT_FALSE(bitmap->is_cubemap()); EXPECT_EQ(Texture::XRGB8, bitmap->format()); - EXPECT_EQ(256, bitmap->width()); - EXPECT_EQ(256, bitmap->height()); - EXPECT_EQ(1, bitmap->num_mipmaps()); + EXPECT_EQ(256U, bitmap->width()); + EXPECT_EQ(256U, bitmap->height()); + EXPECT_EQ(1U, bitmap->num_mipmaps()); EXPECT_TRUE(TestBitmapData(*bitmap, kpng256x256_8bit_palette_BGRX)); } @@ -491,9 +491,9 @@ TEST_F(BitmapTest, LoadPNGFile4bitPalette) { EXPECT_TRUE(bitmap->image_data() != NULL); EXPECT_FALSE(bitmap->is_cubemap()); EXPECT_EQ(Texture::XRGB8, bitmap->format()); - EXPECT_EQ(20, bitmap->width()); - EXPECT_EQ(14, bitmap->height()); - EXPECT_EQ(1, bitmap->num_mipmaps()); + EXPECT_EQ(20U, bitmap->width()); + EXPECT_EQ(14U, bitmap->height()); + EXPECT_EQ(1U, bitmap->num_mipmaps()); EXPECT_TRUE(TestBitmapData(*bitmap, kpng20x14_4bit_palette_BGRX)); } @@ -519,9 +519,9 @@ TEST_F(BitmapTest, LoadPNGFile8bitPaletteAlpha) { EXPECT_TRUE(bitmap->image_data() != NULL); EXPECT_FALSE(bitmap->is_cubemap()); EXPECT_EQ(Texture::ARGB8, bitmap->format()); - EXPECT_EQ(256, bitmap->width()); - EXPECT_EQ(256, bitmap->height()); - EXPECT_EQ(1, bitmap->num_mipmaps()); + EXPECT_EQ(256U, bitmap->width()); + EXPECT_EQ(256U, bitmap->height()); + EXPECT_EQ(1U, bitmap->num_mipmaps()); } */ @@ -534,9 +534,9 @@ TEST_F(BitmapTest, LoadDDSFileDXT1) { EXPECT_TRUE(bitmap->image_data() != NULL); EXPECT_FALSE(bitmap->is_cubemap()); EXPECT_EQ(Texture::DXT1, bitmap->format()); - EXPECT_EQ(256, bitmap->width()); - EXPECT_EQ(256, bitmap->height()); - EXPECT_EQ(1, bitmap->num_mipmaps()); + EXPECT_EQ(256U, bitmap->width()); + EXPECT_EQ(256U, bitmap->height()); + EXPECT_EQ(1U, bitmap->num_mipmaps()); EXPECT_TRUE(TestBitmapData(*bitmap, kdxt1_256x256)); } @@ -550,9 +550,9 @@ TEST_F(BitmapTest, LoadDDSFileDXT1Alpha) { EXPECT_TRUE(bitmap->image_data() != NULL); EXPECT_FALSE(bitmap->is_cubemap()); EXPECT_EQ(Texture::DXT1, bitmap->format()); - EXPECT_EQ(256, bitmap->width()); - EXPECT_EQ(256, bitmap->height()); - EXPECT_EQ(1, bitmap->num_mipmaps()); + EXPECT_EQ(256U, bitmap->width()); + EXPECT_EQ(256U, bitmap->height()); + EXPECT_EQ(1U, bitmap->num_mipmaps()); EXPECT_TRUE(TestBitmapData(*bitmap, kdxt1_256x256_alpha)); } @@ -566,9 +566,9 @@ TEST_F(BitmapTest, LoadDDSFileDXT1Mipmap) { EXPECT_TRUE(bitmap->image_data() != NULL); EXPECT_FALSE(bitmap->is_cubemap()); EXPECT_EQ(Texture::DXT1, bitmap->format()); - EXPECT_EQ(256, bitmap->width()); - EXPECT_EQ(256, bitmap->height()); - EXPECT_EQ(9, bitmap->num_mipmaps()); + EXPECT_EQ(256U, bitmap->width()); + EXPECT_EQ(256U, bitmap->height()); + EXPECT_EQ(9U, bitmap->num_mipmaps()); for (unsigned int i = 0; i < bitmap->num_mipmaps(); ++i) { EXPECT_TRUE(bitmap->GetMipData(i) != NULL); } @@ -585,9 +585,9 @@ TEST_F(BitmapTest, LoadDDSFileDXT3) { EXPECT_TRUE(bitmap->image_data() != NULL); EXPECT_FALSE(bitmap->is_cubemap()); EXPECT_EQ(Texture::DXT3, bitmap->format()); - EXPECT_EQ(256, bitmap->width()); - EXPECT_EQ(256, bitmap->height()); - EXPECT_EQ(1, bitmap->num_mipmaps()); + EXPECT_EQ(256U, bitmap->width()); + EXPECT_EQ(256U, bitmap->height()); + EXPECT_EQ(1U, bitmap->num_mipmaps()); EXPECT_TRUE(TestBitmapData(*bitmap, kdxt3_256x256_alpha)); } @@ -601,9 +601,9 @@ TEST_F(BitmapTest, LoadDDSFileDXT3Mipmap) { EXPECT_TRUE(bitmap->image_data() != NULL); EXPECT_FALSE(bitmap->is_cubemap()); EXPECT_EQ(Texture::DXT3, bitmap->format()); - EXPECT_EQ(256, bitmap->width()); - EXPECT_EQ(256, bitmap->height()); - EXPECT_EQ(9, bitmap->num_mipmaps()); + EXPECT_EQ(256U, bitmap->width()); + EXPECT_EQ(256U, bitmap->height()); + EXPECT_EQ(9U, bitmap->num_mipmaps()); for (unsigned int i = 0; i < bitmap->num_mipmaps(); ++i) { EXPECT_TRUE(bitmap->GetMipData(i) != NULL); } @@ -620,9 +620,9 @@ TEST_F(BitmapTest, LoadDDSFileDXT5) { EXPECT_TRUE(bitmap->image_data() != NULL); EXPECT_FALSE(bitmap->is_cubemap()); EXPECT_EQ(Texture::DXT5, bitmap->format()); - EXPECT_EQ(256, bitmap->width()); - EXPECT_EQ(256, bitmap->height()); - EXPECT_EQ(1, bitmap->num_mipmaps()); + EXPECT_EQ(256U, bitmap->width()); + EXPECT_EQ(256U, bitmap->height()); + EXPECT_EQ(1U, bitmap->num_mipmaps()); EXPECT_TRUE(TestBitmapData(*bitmap, kdxt5_256x256_alpha)); } @@ -636,9 +636,9 @@ TEST_F(BitmapTest, LoadDDSFileDXT5Mipmap) { EXPECT_TRUE(bitmap->image_data() != NULL); EXPECT_FALSE(bitmap->is_cubemap()); EXPECT_EQ(Texture::DXT5, bitmap->format()); - EXPECT_EQ(256, bitmap->width()); - EXPECT_EQ(256, bitmap->height()); - EXPECT_EQ(9, bitmap->num_mipmaps()); + EXPECT_EQ(256U, bitmap->width()); + EXPECT_EQ(256U, bitmap->height()); + EXPECT_EQ(9U, bitmap->num_mipmaps()); for (unsigned int i = 0; i < bitmap->num_mipmaps(); ++i) { EXPECT_TRUE(bitmap->GetMipData(i) != NULL); } @@ -688,10 +688,9 @@ static const unsigned char kMipmapDataPOT[] = { TEST_F(BitmapTest, GenerateMipmapsPOT) { const unsigned int kWidth = 4; const unsigned int kHeight = 4; - const unsigned int kComponents = 4; const Texture::Format format = Texture::ARGB8; unsigned int mipmaps = Bitmap::GetMipMapCount(kWidth, kHeight); - EXPECT_EQ(3, mipmaps); + EXPECT_EQ(3U, mipmaps); unsigned int size = Bitmap::GetMipChainSize(kWidth, kHeight, format, mipmaps); ASSERT_EQ(sizeof(kMipmapDataPOT), size); scoped_array<unsigned char> data(new unsigned char[size]); @@ -746,10 +745,9 @@ static const unsigned char kMipmapDataNPOT[] = { TEST_F(BitmapTest, GenerateMipmapsNPOT) { const unsigned int kWidth = 7; const unsigned int kHeight = 7; - const unsigned int kComponents = 4; const Texture::Format format = Texture::ARGB8; unsigned int mipmaps = Bitmap::GetMipMapCount(kWidth, kHeight); - EXPECT_EQ(3, mipmaps); + EXPECT_EQ(3U, mipmaps); unsigned int size = Bitmap::GetMipChainSize(kWidth, kHeight, format, mipmaps); ASSERT_EQ(sizeof(kMipmapDataNPOT), size); scoped_array<unsigned char> data(new unsigned char[size]); @@ -831,11 +829,10 @@ static const unsigned char kScaleUPDataPOT[] = { TEST_F(BitmapTest, ScaleUpToPOT) { const unsigned int kWidth = 3; const unsigned int kHeight = 3; - const unsigned int kComponents = 4; const unsigned int kPOTWidth = Bitmap::GetPOTSize(kWidth); - ASSERT_EQ(kPOTWidth, 4); + ASSERT_EQ(kPOTWidth, 4U); const unsigned int kPOTHeight = Bitmap::GetPOTSize(kHeight); - ASSERT_EQ(kPOTHeight, 4); + ASSERT_EQ(kPOTHeight, 4U); const Texture::Format format = Texture::ARGB8; unsigned int src_size = Bitmap::GetBufferSize(kWidth, kHeight, format); ASSERT_EQ(sizeof(kScaleUPDataNPOT), src_size); diff --git a/o3d/core/cross/buffer_test.cc b/o3d/core/cross/buffer_test.cc index 7e4561e..469df99 100644 --- a/o3d/core/cross/buffer_test.cc +++ b/o3d/core/cross/buffer_test.cc @@ -112,10 +112,10 @@ TEST_F(BufferTest, TestBasic) { const FieldRefArray& fields = buffer->fields(); // Verify initial state. ASSERT_TRUE(buffer->IsA(Buffer::GetApparentClass())); - EXPECT_EQ(buffer->num_elements(), 0); - EXPECT_EQ(fields.size(), 0); - EXPECT_EQ(buffer->stride(), 0); - EXPECT_EQ(buffer->GetSizeInBytes(), 0); + EXPECT_EQ(buffer->num_elements(), 0U); + EXPECT_EQ(fields.size(), 0U); + EXPECT_EQ(buffer->stride(), 0U); + EXPECT_EQ(buffer->GetSizeInBytes(), 0U); } // Test create fields and putting something in @@ -140,12 +140,12 @@ TEST_F(BufferTest, CreateFields) { Field::Ref field_1 = Field::Ref(buffer->CreateField( FloatField::GetApparentClass(), kNumComponents1)); - EXPECT_EQ(fields.size(), 1); + EXPECT_EQ(fields.size(), 1U); EXPECT_EQ(field_1, fields[0].Get()); - EXPECT_EQ(field_1->offset(), 0); + EXPECT_EQ(field_1->offset(), 0U); EXPECT_EQ(buffer->stride(), kSize1); EXPECT_EQ(buffer->total_components(), kNumComponents1); - EXPECT_EQ(buffer->GetSizeInBytes(), 0); + EXPECT_EQ(buffer->GetSizeInBytes(), 0U); EXPECT_TRUE(ChangeCountChanged(&change_count, buffer)); // Allocate some elements. @@ -258,10 +258,10 @@ TEST_F(BufferTest, ReshuffleFields) { Field::Ref field_2 = Field::Ref(buffer->CreateField( FloatField::GetApparentClass(), kNumComponents2)); - EXPECT_EQ(fields.size(), 2); + EXPECT_EQ(fields.size(), 2U); EXPECT_EQ(field_1, fields[0].Get()); EXPECT_EQ(field_2, fields[1].Get()); - EXPECT_EQ(field_1->offset(), 0); + EXPECT_EQ(field_1->offset(), 0U); EXPECT_EQ(field_2->offset(), kSize1); EXPECT_EQ(buffer->stride(), kSize1 + kSize2); EXPECT_EQ(buffer->total_components(), kNumComponents1 + kNumComponents2); @@ -290,9 +290,9 @@ TEST_F(BufferTest, ReshuffleFields) { // Check deleting a field buffer->RemoveField(field_1); EXPECT_TRUE(field_1->buffer() == NULL); - EXPECT_EQ(fields.size(), 1); + EXPECT_EQ(fields.size(), 1U); EXPECT_EQ(field_2, fields[0].Get()); - EXPECT_EQ(field_2->offset(), 0); + EXPECT_EQ(field_2->offset(), 0U); EXPECT_EQ(buffer->stride(), kSize2); EXPECT_EQ(buffer->total_components(), kNumComponents2); EXPECT_EQ(buffer->GetSizeInBytes(), kSize2 * kNumElements); @@ -477,7 +477,7 @@ TEST_F(BufferTest, TestVertexBufferFromRawData) { stream.WriteLittleEndianInt32(kNumElements); // Make note of stream position at end of header - size_t data_start_position = stream.GetStreamPosition(); + stream.GetStreamPosition(); // Write out the data for each field @@ -541,7 +541,7 @@ TEST_F(BufferTest, TestVertexBufferFromRawData) { // Check that the field that was originally created to verify that setting // the buffer from raw data would remove any existing fields was in fact // removed. - EXPECT_EQ(3, buffer->fields().size()); + EXPECT_EQ(3U, buffer->fields().size()); float buffer_float_data[kNumElements * 3]; uint32 buffer_int_data[kNumElements * 2]; diff --git a/o3d/core/cross/client_test.cc b/o3d/core/cross/client_test.cc index b572c57..ac6e853 100644 --- a/o3d/core/cross/client_test.cc +++ b/o3d/core/cross/client_test.cc @@ -140,7 +140,7 @@ TEST_F(ClientBasic, GetBuffers) { b3->set_name("buffer3"); std::vector<Buffer*> buffers = object_manager_->Get<Buffer>("buffer1"); - EXPECT_EQ(2, buffers.size()); + EXPECT_EQ(2U, buffers.size()); std::vector<Buffer*>::const_iterator pos; EXPECT_TRUE((pos = find(buffers.begin(), buffers.end(), b1)) != buffers.end()); @@ -182,7 +182,7 @@ TEST_F(ClientBasic, GetEffects) { e3->set_name("effect3"); EffectArray effects = object_manager_->Get<Effect>("effect1"); - EXPECT_EQ(2, effects.size()); + EXPECT_EQ(2U, effects.size()); EffectArray::const_iterator pos; EXPECT_TRUE((pos = find(effects.begin(), effects.end(), e1)) != effects.end()); @@ -295,17 +295,17 @@ TEST_F(ClientTree, GetById) { // Tests GetByName TEST_F(ClientTree, GetByName) { TransformArray transforms = object_manager_->Get<Transform>("t3"); - EXPECT_EQ(1, transforms.size()); + EXPECT_EQ(1U, transforms.size()); EXPECT_TRUE(transforms[0] == t3_); transforms = object_manager_->Get<Transform>("t5"); - EXPECT_EQ(0, transforms.size()); + EXPECT_EQ(0U, transforms.size()); // Add one more transform with the name "t3" Transform* t3_new = pack()->Create<Transform>(); t3_new->set_name("t3"); transforms = object_manager_->Get<Transform>("t3"); - EXPECT_EQ(2, transforms.size()); + EXPECT_EQ(2U, transforms.size()); TransformArray::const_iterator pos; EXPECT_TRUE((pos = find(transforms.begin(), transforms.end(), diff --git a/o3d/core/cross/counter_test.cc b/o3d/core/cross/counter_test.cc index 188cfb1..814328a 100644 --- a/o3d/core/cross/counter_test.cc +++ b/o3d/core/cross/counter_test.cc @@ -252,7 +252,7 @@ TEST_F(CounterTest, AddRemoveGetCallback) { counter->AddCallback(2.0f, test2); counter->AddCallback(1.0f, test1); // Check that both got added. - ASSERT_EQ(counters.size(), 2); + ASSERT_EQ(counters.size(), 2U); iter = counters.begin(); EXPECT_EQ(iter->count(), 1.0f); ++iter; @@ -261,7 +261,7 @@ TEST_F(CounterTest, AddRemoveGetCallback) { // Check that adding one at the same time removes the other counter->AddCallback(2.0f, test1); EXPECT_TRUE(test2_deleted); - ASSERT_EQ(counters.size(), 2); + ASSERT_EQ(counters.size(), 2U); // Check that removing a non-existant callback fails. EXPECT_FALSE(counter->RemoveCallback(3.0f)); @@ -269,12 +269,12 @@ TEST_F(CounterTest, AddRemoveGetCallback) { // Check that removing one of the duplicated callbacks does not remove the // other. EXPECT_TRUE(counter->RemoveCallback(1.0f)); - ASSERT_EQ(counters.size(), 1); + ASSERT_EQ(counters.size(), 1U); EXPECT_FALSE(test1_deleted); // Check that removing final callback deletes the callback. EXPECT_TRUE(counter->RemoveCallback(2.0f)); - ASSERT_EQ(counters.size(), 0); + ASSERT_EQ(counters.size(), 0U); EXPECT_TRUE(test1_deleted); EXPECT_FALSE(counter->RemoveCallback(2.0f)); @@ -611,7 +611,7 @@ TEST_F(CounterTest, AddRemoveGetCallback) { // Check RemoveAllCallbacks. counter->RemoveAllCallbacks(); - EXPECT_EQ(counters.size(), 0); + EXPECT_EQ(counters.size(), 0U); EXPECT_TRUE(test1_deleted); EXPECT_TRUE(test2_deleted); EXPECT_TRUE(test3_deleted); diff --git a/o3d/core/cross/curve_test.cc b/o3d/core/cross/curve_test.cc index e1e25d6..d1de1f2 100644 --- a/o3d/core/cross/curve_test.cc +++ b/o3d/core/cross/curve_test.cc @@ -145,24 +145,24 @@ TEST_F(CurveTest, CreateKeyRemoveKey) { ASSERT_TRUE(bezier_key != NULL); const CurveKeyRefArray& keys = curve->keys(); - EXPECT_EQ(keys.size(), 3); + EXPECT_EQ(keys.size(), 3U); EXPECT_TRUE(KeyInKeys(step_key, keys)); EXPECT_TRUE(KeyInKeys(linear_key, keys)); EXPECT_TRUE(KeyInKeys(bezier_key, keys)); step_key->Destroy(); - EXPECT_EQ(keys.size(), 2); + EXPECT_EQ(keys.size(), 2U); EXPECT_FALSE(KeyInKeys(step_key, keys)); EXPECT_TRUE(KeyInKeys(linear_key, keys)); EXPECT_TRUE(KeyInKeys(bezier_key, keys)); bezier_key->Destroy(); - EXPECT_EQ(keys.size(), 1); + EXPECT_EQ(keys.size(), 1U); EXPECT_TRUE(KeyInKeys(linear_key, keys)); EXPECT_FALSE(KeyInKeys(bezier_key, keys)); linear_key->Destroy(); - EXPECT_EQ(keys.size(), 0); + EXPECT_EQ(keys.size(), 0U); } // Tests ResortKeys and IsDiscontinuous @@ -185,7 +185,7 @@ TEST_F(CurveTest, ResortKeysDiscontinuous) { ASSERT_TRUE(key4 != NULL); const CurveKeyRefArray& keys = curve->keys(); - EXPECT_EQ(keys.size(), 4); + EXPECT_EQ(keys.size(), 4U); key1->SetInput(1.0f); key2->SetInput(2.0f); @@ -193,7 +193,7 @@ TEST_F(CurveTest, ResortKeysDiscontinuous) { key4->SetInput(4.0f); EXPECT_FALSE(curve->IsDiscontinuous()); // causes keys to be re-sorted. - EXPECT_EQ(keys.size(), 4); + EXPECT_EQ(keys.size(), 4U); EXPECT_EQ(keys[0], key1); EXPECT_EQ(keys[1], key2); EXPECT_EQ(keys[2], key3); @@ -202,7 +202,7 @@ TEST_F(CurveTest, ResortKeysDiscontinuous) { key4->SetInput(0.0f); EXPECT_FALSE(curve->IsDiscontinuous()); // causes keys to be re-sorted. - EXPECT_EQ(keys.size(), 4); + EXPECT_EQ(keys.size(), 4U); EXPECT_EQ(keys[0], key4); EXPECT_EQ(keys[1], key1); EXPECT_EQ(keys[2], key2); @@ -211,7 +211,7 @@ TEST_F(CurveTest, ResortKeysDiscontinuous) { key4->SetInput(2.5f); EXPECT_FALSE(curve->IsDiscontinuous()); // causes keys to be re-sorted. - EXPECT_EQ(keys.size(), 4); + EXPECT_EQ(keys.size(), 4U); EXPECT_EQ(keys[0], key1); EXPECT_EQ(keys[1], key2); EXPECT_EQ(keys[2], key4); @@ -222,7 +222,7 @@ TEST_F(CurveTest, ResortKeysDiscontinuous) { key4->SetInput(2.0f); EXPECT_TRUE(curve->IsDiscontinuous()); // causes keys to be re-sorted. - EXPECT_EQ(keys.size(), 4); + EXPECT_EQ(keys.size(), 4U); EXPECT_EQ(keys[0], key1); EXPECT_EQ(keys[1], key2); EXPECT_EQ(keys[2], key4); @@ -230,7 +230,7 @@ TEST_F(CurveTest, ResortKeysDiscontinuous) { key4->SetInput(1.5f); // should move it before key2 EXPECT_FALSE(curve->IsDiscontinuous()); // causes keys to be re-sorted. - EXPECT_EQ(keys.size(), 4); + EXPECT_EQ(keys.size(), 4U); EXPECT_EQ(keys[0], key1); EXPECT_EQ(keys[1], key4); EXPECT_EQ(keys[2], key2); @@ -238,7 +238,7 @@ TEST_F(CurveTest, ResortKeysDiscontinuous) { key4->SetInput(2.0f); // should still be before key2. EXPECT_TRUE(curve->IsDiscontinuous()); // causes keys to be re-sorted. - EXPECT_EQ(keys.size(), 4); + EXPECT_EQ(keys.size(), 4U); EXPECT_EQ(keys[0], key1); EXPECT_EQ(keys[1], key4); EXPECT_EQ(keys[2], key2); @@ -247,7 +247,7 @@ TEST_F(CurveTest, ResortKeysDiscontinuous) { CurveKey* key5 = curve->Create<LinearCurveKey>(); CurveKey* key6 = curve->Create<LinearCurveKey>(); EXPECT_TRUE(curve->IsDiscontinuous()); // causes keys to be re-sorted. - EXPECT_EQ(keys.size(), 6); + EXPECT_EQ(keys.size(), 6U); EXPECT_EQ(keys[0], key5); EXPECT_EQ(keys[1], key6); EXPECT_EQ(keys[2], key1); @@ -260,7 +260,7 @@ TEST_F(CurveTest, ResortKeysDiscontinuous) { key5->SetInput(5.0f); key6->SetInput(5.0f); EXPECT_TRUE(curve->IsDiscontinuous()); // causes keys to be re-sorted. - EXPECT_EQ(keys.size(), 6); + EXPECT_EQ(keys.size(), 6U); EXPECT_EQ(keys[0], key1); EXPECT_EQ(keys[1], key4); EXPECT_EQ(keys[2], key2); @@ -274,11 +274,11 @@ TEST_F(CurveTest, ResortKeysDiscontinuous) { key3->SetInput(3.0f); key4->SetInput(4.0f); EXPECT_FALSE(curve->IsDiscontinuous()); // causes keys to be re-sorted. - CurveKey* stepkey1 = curve->Create<StepCurveKey>(); + curve->Create<StepCurveKey>(); EXPECT_TRUE(curve->IsDiscontinuous()); // causes keys to be re-sorted. // Try all step keys. - CurveKey* stepkey2 = curve->Create<StepCurveKey>(); + curve->Create<StepCurveKey>(); key1->Destroy(); key2->Destroy(); key3->Destroy(); diff --git a/o3d/core/cross/effect_test.cc b/o3d/core/cross/effect_test.cc index b3a245c..b1361fb 100644 --- a/o3d/core/cross/effect_test.cc +++ b/o3d/core/cross/effect_test.cc @@ -252,7 +252,6 @@ TEST_F(EffectTest, CreateAndDestroyEffect) { ASSERT_TRUE(color != NULL); ASSERT_TRUE(index != NULL); - void* vbuffer = NULL; Field* vertex_field = verts->CreateField(FloatField::GetApparentClass(), arraysize(kVertexBlock[0])); ASSERT_TRUE(vertex_field != NULL); diff --git a/o3d/core/cross/element_test.cc b/o3d/core/cross/element_test.cc index ed546503f..954dd8b 100644 --- a/o3d/core/cross/element_test.cc +++ b/o3d/core/cross/element_test.cc @@ -141,12 +141,12 @@ TEST_F(ElementTest, DrawElement) { ASSERT_TRUE(draw_element2 != NULL); // Check there are no draw elements. - EXPECT_EQ(element->GetDrawElementRefs().size(), 0); + EXPECT_EQ(element->GetDrawElementRefs().size(), 0U); element->AddDrawElement(draw_element1); // Check it's been added. - EXPECT_EQ(element->GetDrawElementRefs().size(), 1); + EXPECT_EQ(element->GetDrawElementRefs().size(), 1U); EXPECT_EQ(element->GetDrawElements()[0], draw_element1); // Check removing something else fails @@ -156,7 +156,7 @@ TEST_F(ElementTest, DrawElement) { EXPECT_TRUE(element->RemoveDrawElement(draw_element1)); // Check it's been removed. - EXPECT_EQ(element->GetDrawElementRefs().size(), 0); + EXPECT_EQ(element->GetDrawElementRefs().size(), 0U); // Check removing it twice fails. EXPECT_FALSE(element->RemoveDrawElement(draw_element1)); @@ -225,8 +225,8 @@ static void CreateCube(Pack* pack, Primitive** primitive_pointer) { primitive->set_number_vertices(8); EXPECT_EQ(primitive->primitive_type(), o3d::Primitive::TRIANGLELIST); - EXPECT_EQ(primitive->number_primitives(), 12); - EXPECT_EQ(primitive->number_vertices(), 8); + EXPECT_EQ(primitive->number_primitives(), 12U); + EXPECT_EQ(primitive->number_vertices(), 8U); *primitive_pointer = primitive; } diff --git a/o3d/core/cross/field_test.cc b/o3d/core/cross/field_test.cc index 6340f30..0f8afce 100644 --- a/o3d/core/cross/field_test.cc +++ b/o3d/core/cross/field_test.cc @@ -174,7 +174,7 @@ TEST_F(FieldTest, TestBasic) { // Check things are as expected. EXPECT_EQ(field_1->num_components(), kNumComponents); - EXPECT_EQ(field_1->offset(), 0); + EXPECT_EQ(field_1->offset(), 0U); EXPECT_EQ(field_1->size(), field_1->num_components() * field_1->GetFieldComponentSize()); EXPECT_EQ(field_1->buffer(), buffer()); @@ -194,7 +194,7 @@ TEST_F(FieldTest, TestBasic) { buffer()->CreateField(FloatField::GetApparentClass(), kNumComponents)); ASSERT_FALSE(field_2_ref.IsNull()); Field* field_2 = field_2_ref.Get(); - EXPECT_EQ(field_1->offset(), 0); + EXPECT_EQ(field_1->offset(), 0U); EXPECT_EQ(field_2->offset(), field_1->size()); EXPECT_EQ(field_2->buffer(), buffer()); EXPECT_EQ(buffer()->num_elements(), kNumElements); @@ -202,7 +202,7 @@ TEST_F(FieldTest, TestBasic) { // Check if we remove the first field the second field gets updated correctly. buffer()->RemoveField(field_1); EXPECT_TRUE(field_1->buffer() == NULL); - EXPECT_EQ(field_2->offset(), 0); + EXPECT_EQ(field_2->offset(), 0U); // Check we can't create a field of 0 components. EXPECT_TRUE(buffer()->CreateField(FloatField::GetApparentClass(), 0) == diff --git a/o3d/core/cross/gl/texture_gl.cc b/o3d/core/cross/gl/texture_gl.cc index 3972a50..05acd38 100644 --- a/o3d/core/cross/gl/texture_gl.cc +++ b/o3d/core/cross/gl/texture_gl.cc @@ -435,7 +435,8 @@ void Texture2DGL::SetRect(int level, GLenum gl_format = GLFormatFromO3DFormat(format(), &gl_internal_format, &gl_data_type); if (gl_format) { - if (src_pitch == Bitmap::GetMipChainSize(src_width, 1, format(), 1)) { + if ((unsigned)src_pitch == Bitmap::GetMipChainSize(src_width, 1, + format(), 1)) { glTexSubImage2D(GL_TEXTURE_2D, level, dst_left, dst_top, src_width, src_height, @@ -443,7 +444,8 @@ void Texture2DGL::SetRect(int level, gl_data_type, src_data); } else { - for (int yy = 0; yy < src_height; ++yy) { + int limit = src_height; + for (int yy = 0; yy < limit; ++yy) { glTexSubImage2D(GL_TEXTURE_2D, level, dst_left, dst_top + yy, src_width, 1, @@ -488,7 +490,7 @@ bool Texture2DGL::Lock(int level, void** data, int* pitch) { } *data = backing_bitmap_->GetMipData(level); unsigned int mip_width = Bitmap::GetMipDimension(level, width()); - unsigned int mip_height = Bitmap::GetMipDimension(level, height()); + if (!IsCompressed()) { *pitch = Bitmap::GetMipChainSize(mip_width, 1,format(), 1); } else { @@ -815,7 +817,8 @@ void TextureCUBEGL::SetRect(TextureCUBE::CubeFace face, &gl_data_type); int gl_face = kCubemapFaceList[face]; if (gl_format) { - if (src_pitch == Bitmap::GetMipChainSize(src_width, 1, format(), 1)) { + if (static_cast<unsigned>(src_pitch) == + Bitmap::GetMipChainSize(src_width, 1, format(), 1)) { glTexSubImage2D(gl_face, level, dst_left, dst_top, src_width, src_height, @@ -823,7 +826,8 @@ void TextureCUBEGL::SetRect(TextureCUBE::CubeFace face, gl_data_type, src_data); } else { - for (int yy = 0; yy < src_height; ++yy) { + int limit = src_height; + for (int yy = 0; yy < limit; ++yy) { glTexSubImage2D(gl_face, level, dst_left, dst_top + yy, src_width, 1, diff --git a/o3d/core/cross/message_queue.cc b/o3d/core/cross/message_queue.cc index a7ff10f..f77d019 100644 --- a/o3d/core/cross/message_queue.cc +++ b/o3d/core/cross/message_queue.cc @@ -595,8 +595,9 @@ bool MessageQueue::ProcessUpdateTexture2D(ConnectedClient* client, unsigned int mip_height = Bitmap::GetMipDimension(level, texture_object->height()); - if (number_of_bytes != Bitmap::GetMipChainSize(mip_width, mip_height, - texture_object->format(), 1)) { + if (static_cast<unsigned>(number_of_bytes) != + Bitmap::GetMipChainSize(mip_width, mip_height, + texture_object->format(), 1)) { O3D_ERROR(service_locator_) << "texture_size does not match size of texture level (" << offset << " + " << number_of_bytes << " > " << info->size_; @@ -718,7 +719,7 @@ bool MessageQueue::ProcessUnregisterSharedMemory(ConnectedClient* client, bool res = client->UnregisterSharedMemory(buffer_id); SendBooleanResponse(client->client_handle(), res); - return true; + return res; } diff --git a/o3d/core/cross/message_queue_test.cc b/o3d/core/cross/message_queue_test.cc index 7fa43e6..3cefff0 100644 --- a/o3d/core/cross/message_queue_test.cc +++ b/o3d/core/cross/message_queue_test.cc @@ -227,8 +227,8 @@ class MessageQueueTest : public testing::Test { private: ServiceDependency<ObjectManager> object_manager_; Pack *pack_; - int num_socket_handles_; nacl::Handle* socket_handles_; + int num_socket_handles_; // This can't be part of SetUp since it needs to be called from each // individual test. @@ -381,7 +381,7 @@ bool TextureUpdateHelper::ReceiveBooleanResponse() { int result = nacl::ReceiveDatagram(o3d_handle_, &header, 0); - EXPECT_EQ(sizeof(response), result); + EXPECT_EQ(sizeof(response), static_cast<unsigned>(result)); if (result != sizeof(response)) { return false; } @@ -479,8 +479,8 @@ bool TextureUpdateHelper::RequestSharedMemory(size_t requested_size, // Send message. int result = nacl::SendDatagram(o3d_handle_, &header, 0); - EXPECT_EQ(vec.length, result); - if (result != vec.length) { + EXPECT_EQ(vec.length, static_cast<unsigned>(result)); + if (static_cast<unsigned>(result) != vec.length) { return false; } @@ -499,8 +499,8 @@ bool TextureUpdateHelper::RequestSharedMemory(size_t requested_size, EXPECT_LT(0, result); EXPECT_EQ(0, header.flags & nacl::kMessageTruncated); - EXPECT_EQ(1, header.handle_count); - EXPECT_EQ(1, header.iov_length); + EXPECT_EQ(1U, header.handle_count); + EXPECT_EQ(1U, header.iov_length); if (result < 0 || header.flags & nacl::kMessageTruncated || @@ -573,9 +573,9 @@ bool TextureUpdateHelper::RequestTextureUpdate(unsigned int texture_id, // Send message. int result = nacl::SendDatagram(o3d_handle_, &header, 0); - EXPECT_EQ(vec.length, result); + EXPECT_EQ(vec.length, static_cast<unsigned>(result)); - if (result != vec.length) { + if (static_cast<unsigned>(result) != vec.length) { return false; } @@ -621,8 +621,8 @@ int TextureUpdateHelper::RegisterSharedMemory(nacl::Handle shared_memory, // Send message. int result = nacl::SendDatagram(o3d_handle_, &header, 0); - EXPECT_EQ(vec.length, result); - if (result != vec.length) { + EXPECT_EQ(vec.length, static_cast<unsigned>(result)); + if (static_cast<unsigned>(result) != vec.length) { return -1; } @@ -639,10 +639,10 @@ int TextureUpdateHelper::RegisterSharedMemory(nacl::Handle shared_memory, reply_header.handle_count = 0; result = nacl::ReceiveDatagram(o3d_handle_, &reply_header, 0); - EXPECT_EQ(shared_memory_vec.length, result); + EXPECT_EQ(shared_memory_vec.length, static_cast<unsigned>(result)); EXPECT_EQ(0, reply_header.flags & nacl::kMessageTruncated); - EXPECT_EQ(0, reply_header.handle_count); - EXPECT_EQ(1, reply_header.iov_length); + EXPECT_EQ(0U, reply_header.handle_count); + EXPECT_EQ(1U, reply_header.iov_length); return shared_memory_id; } @@ -691,7 +691,7 @@ TEST_F(MessageQueueTest, Initialize) { String socket_addr = message_queue->GetSocketAddress(); // Make sure the name starts with the expected value - EXPECT_EQ(0, socket_addr.find("o3d")); + EXPECT_EQ(0U, socket_addr.find("o3d")); delete message_queue; } diff --git a/o3d/core/cross/object_base_test.cc b/o3d/core/cross/object_base_test.cc index eb4cc59..00edb75 100644 --- a/o3d/core/cross/object_base_test.cc +++ b/o3d/core/cross/object_base_test.cc @@ -64,7 +64,7 @@ void ObjectBaseTest::TearDown() { } TEST_F(ObjectBaseTest, ObjectIdOfNullIsZero) { - ASSERT_EQ(0, GetObjectId(NULL)); + ASSERT_EQ(0U, GetObjectId(NULL)); } TEST_F(ObjectBaseTest, ObjectIdOfObjectIsReturned) { diff --git a/o3d/core/cross/param_array_test.cc b/o3d/core/cross/param_array_test.cc index d91e4e5..8be5801 100644 --- a/o3d/core/cross/param_array_test.cc +++ b/o3d/core/cross/param_array_test.cc @@ -81,7 +81,7 @@ TEST_F(ParamArrayTest, Basic) { EXPECT_TRUE(param_array->IsA(NamedObject::GetApparentClass())); // Check that it's size is zero. - EXPECT_EQ(param_array->size(), 0); + EXPECT_EQ(param_array->size(), 0U); } // Test ParamArray::CreateParam @@ -95,14 +95,14 @@ TEST_F(ParamArrayTest, CreateParam) { ASSERT_TRUE(param_0 != NULL); // Check the length. - EXPECT_EQ(param_array->size(), 1); + EXPECT_EQ(param_array->size(), 1U); // Add some more. ParamFloat* param_5 = param_array->CreateParam<ParamFloat>(5); ASSERT_TRUE(param_5 != NULL); // Check that the params in between got created. - EXPECT_EQ(param_array->size(), 6); + EXPECT_EQ(param_array->size(), 6U); EXPECT_EQ(param_array->GetParam<ParamFloat>(0), param_0); EXPECT_TRUE(param_array->GetParam<ParamFloat>(1) != NULL); EXPECT_TRUE(param_array->GetParam<ParamFloat>(2) != NULL); @@ -117,7 +117,7 @@ TEST_F(ParamArrayTest, CreateParam) { ParamFloat* new_param_5 = param_array->CreateParam<ParamFloat>(5); ASSERT_TRUE(new_param_5 != NULL); - EXPECT_EQ(param_array->size(), 6); + EXPECT_EQ(param_array->size(), 6U); EXPECT_EQ(param_array->GetParam<ParamFloat>(0), param_0); EXPECT_TRUE(param_array->GetParam<ParamFloat>(1) != NULL); EXPECT_TRUE(param_array->GetParam<ParamFloat>(2) != NULL); @@ -141,7 +141,7 @@ TEST_F(ParamArrayTest, RemoveParam) { ASSERT_TRUE(param_0 != NULL); // Check the length. - EXPECT_EQ(param_array->size(), 7); + EXPECT_EQ(param_array->size(), 7U); // Get the last param so we can see that it moves. ParamFloat* param; @@ -151,27 +151,27 @@ TEST_F(ParamArrayTest, RemoveParam) { // Remove a single param. param_array->RemoveParams(1, 1); - EXPECT_EQ(param_array->size(), 6); + EXPECT_EQ(param_array->size(), 6U); EXPECT_EQ(param_array->GetParam<ParamFloat>(5), param); // Remove a range param_array->RemoveParams(1, 3); - EXPECT_EQ(param_array->size(), 3); + EXPECT_EQ(param_array->size(), 3U); EXPECT_EQ(param_array->GetParam<ParamFloat>(2), param); // Remove the first param. param_array->RemoveParams(0, 1); - EXPECT_EQ(param_array->size(), 2); + EXPECT_EQ(param_array->size(), 2U); EXPECT_EQ(param_array->GetParam<ParamFloat>(1), param); // Remove the end param param_array->RemoveParams(1, 1); - EXPECT_EQ(param_array->size(), 1); + EXPECT_EQ(param_array->size(), 1U); EXPECT_NE(param_array->GetParam<ParamFloat>(0), param); // Remove the remaining param. param_array->RemoveParams(0, 1); - EXPECT_EQ(param_array->size(), 0); + EXPECT_EQ(param_array->size(), 0U); EXPECT_TRUE(param_array->GetParam<ParamFloat>(0) == NULL); } diff --git a/o3d/core/cross/param_object_test.cc b/o3d/core/cross/param_object_test.cc index 0fa912f..8eb03c0 100644 --- a/o3d/core/cross/param_object_test.cc +++ b/o3d/core/cross/param_object_test.cc @@ -305,13 +305,13 @@ TEST_F(ParamObjectTest, GetInputsForParamGetOutputsForParam) { // Verify that FakeDivModParamOperationWorks. operation->set_input1(19); operation->set_input2(5); - EXPECT_EQ(operation->NumberOfCallsToUpdateOutputs(), 0); + EXPECT_EQ(operation->NumberOfCallsToUpdateOutputs(), 0U); EXPECT_EQ(operation->output1(), 3); - EXPECT_EQ(operation->NumberOfCallsToUpdateOutputs(), 1); + EXPECT_EQ(operation->NumberOfCallsToUpdateOutputs(), 1U); EXPECT_EQ(operation->output2(), 4); // This should be 1 because calling operation->output1() should // have updated output2(). - EXPECT_EQ(operation->NumberOfCallsToUpdateOutputs(), 1); + EXPECT_EQ(operation->NumberOfCallsToUpdateOutputs(), 1U); // Now check GetInputs Param* input1 = operation->GetUntypedParam( @@ -330,36 +330,36 @@ TEST_F(ParamObjectTest, GetInputsForParamGetOutputsForParam) { ParamVector params; // There should be no params on the params operation->GetInputsForParam(input1, ¶ms); - EXPECT_EQ(params.size(), 0); + EXPECT_EQ(params.size(), 0U); operation->GetInputsForParam(input2, ¶ms); - EXPECT_EQ(params.size(), 0); + EXPECT_EQ(params.size(), 0U); // There should be two params for each output. operation->GetInputsForParam(output1, ¶ms); - EXPECT_EQ(params.size(), 2); + EXPECT_EQ(params.size(), 2U); EXPECT_TRUE(ParamInParams(input1, params)); EXPECT_TRUE(ParamInParams(input2, params)); params.clear(); // make sure we are not just getting the same result. operation->GetInputsForParam(output2, ¶ms); - EXPECT_EQ(params.size(), 2); + EXPECT_EQ(params.size(), 2U); EXPECT_TRUE(ParamInParams(input1, params)); EXPECT_TRUE(ParamInParams(input2, params)); // Make sure we don't just add more params. operation->GetInputsForParam(output2, ¶ms); - EXPECT_EQ(params.size(), 2); + EXPECT_EQ(params.size(), 2U); // Check GetOutputs operation->GetOutputsForParam(input1, ¶ms); - EXPECT_EQ(params.size(), 2); + EXPECT_EQ(params.size(), 2U); EXPECT_TRUE(ParamInParams(output1, params)); EXPECT_TRUE(ParamInParams(output2, params)); operation->GetOutputsForParam(input2, ¶ms); - EXPECT_EQ(params.size(), 2); + EXPECT_EQ(params.size(), 2U); EXPECT_TRUE(ParamInParams(output1, params)); EXPECT_TRUE(ParamInParams(output2, params)); operation->GetOutputsForParam(output1, ¶ms); - EXPECT_EQ(params.size(), 0); + EXPECT_EQ(params.size(), 0U); operation->GetOutputsForParam(output2, ¶ms); - EXPECT_EQ(params.size(), 0); + EXPECT_EQ(params.size(), 0U); // If we bind the output we should not get it as an input or an output. Param* other = operation->CreateParam<ParamInteger>("other"); @@ -369,17 +369,17 @@ TEST_F(ParamObjectTest, GetInputsForParamGetOutputsForParam) { // There should be two inputs for output1 but none for output2 since it is // bound. operation->GetInputsForParam(output1, ¶ms); - EXPECT_EQ(params.size(), 2); + EXPECT_EQ(params.size(), 2U); operation->GetInputsForParam(output2, ¶ms); - EXPECT_EQ(params.size(), 0); + EXPECT_EQ(params.size(), 0U); // There should only be 1 output for each of the inputs since output2 is // no longer effected by the inputs. operation->GetOutputsForParam(input1, ¶ms); - EXPECT_EQ(params.size(), 1); + EXPECT_EQ(params.size(), 1U); EXPECT_TRUE(ParamInParams(output1, params)); operation->GetOutputsForParam(input2, ¶ms); - EXPECT_EQ(params.size(), 1); + EXPECT_EQ(params.size(), 1U); EXPECT_TRUE(ParamInParams(output1, params)); } @@ -433,7 +433,7 @@ TEST_F(ParamObjectTest, ImplicitCycles) { // +-------------+ input_a_1->GetOutputs(¶ms); - EXPECT_EQ(params.size(), 6); + EXPECT_EQ(params.size(), 6U); EXPECT_TRUE(ParamInParams(output_a_1, params)); EXPECT_TRUE(ParamInParams(output_a_2, params)); EXPECT_TRUE(ParamInParams(output_b_1, params)); @@ -452,7 +452,7 @@ TEST_F(ParamObjectTest, ImplicitCycles) { // IA2 OA2 IB2 OB2 output_b_1->GetInputs(¶ms); - EXPECT_EQ(params.size(), 5); + EXPECT_EQ(params.size(), 5U); EXPECT_TRUE(ParamInParams(input_a_1, params)); EXPECT_TRUE(ParamInParams(input_a_2, params)); EXPECT_TRUE(ParamInParams(input_b_1, params)); diff --git a/o3d/core/cross/param_test.cc b/o3d/core/cross/param_test.cc index 5ae481f..3044acd 100644 --- a/o3d/core/cross/param_test.cc +++ b/o3d/core/cross/param_test.cc @@ -293,7 +293,7 @@ TEST_F(ParamBasic, OutputConnections) { EXPECT_TRUE(param4->Bind(param1)); ParamVector out_connections = param1->output_connections(); - EXPECT_EQ(3, out_connections.size()); + EXPECT_EQ(3U, out_connections.size()); EXPECT_EQ(param2->input_connection(), param1); EXPECT_EQ(param3->input_connection(), param1); @@ -311,7 +311,7 @@ TEST_F(ParamBasic, OutputConnections) { // Remove one and check again EXPECT_TRUE(param1->UnbindOutput(param3)); out_connections = param1->output_connections(); - EXPECT_EQ(2, out_connections.size()); + EXPECT_EQ(2U, out_connections.size()); EXPECT_TRUE(find(out_connections.begin(), out_connections.end(), param2) != out_connections.end()); EXPECT_FALSE(find(out_connections.begin(), out_connections.end(), param3) != @@ -328,7 +328,7 @@ TEST_F(ParamBasic, OutputConnections) { // and that output connections are updated out_connections = param1->output_connections(); - EXPECT_EQ(1, out_connections.size()); + EXPECT_EQ(1U, out_connections.size()); EXPECT_TRUE(find(out_connections.begin(), out_connections.end(), param2) != out_connections.end()); EXPECT_FALSE(find(out_connections.begin(), out_connections.end(), param3) != @@ -346,7 +346,7 @@ TEST_F(ParamBasic, UnbindInput) { Param *source = param2->input_connection(); - EXPECT_TRUE(param2->input_connection() != NULL); + EXPECT_TRUE(source != NULL); param2->UnbindInput(); @@ -622,26 +622,26 @@ TEST_F(ParamBindTest, GetInputsGetOuputs) { ParamVector params; float_param_1_->GetInputs(¶ms); - EXPECT_EQ(params.size(), 2); + EXPECT_EQ(params.size(), 2U); EXPECT_TRUE(ParamInParams(float_param_2_, params)); EXPECT_TRUE(ParamInParams(float_param_3_, params)); float_param_1_->GetOutputs(¶ms); - EXPECT_EQ(params.size(), 0); + EXPECT_EQ(params.size(), 0U); float_param_2_->GetInputs(¶ms); - EXPECT_EQ(params.size(), 1); + EXPECT_EQ(params.size(), 1U); EXPECT_TRUE(ParamInParams(float_param_3_, params)); float_param_2_->GetOutputs(¶ms); - EXPECT_EQ(params.size(), 1); + EXPECT_EQ(params.size(), 1U); EXPECT_TRUE(ParamInParams(float_param_1_, params)); float_param_3_->GetInputs(¶ms); - EXPECT_EQ(params.size(), 0); + EXPECT_EQ(params.size(), 0U); float_param_3_->GetOutputs(¶ms); - EXPECT_EQ(params.size(), 2); + EXPECT_EQ(params.size(), 2U); EXPECT_TRUE(ParamInParams(float_param_1_, params)); EXPECT_TRUE(ParamInParams(float_param_2_, params)); @@ -651,32 +651,32 @@ TEST_F(ParamBindTest, GetInputsGetOuputs) { // 3->2->1->3 float_param_1_->GetInputs(¶ms); - EXPECT_EQ(params.size(), 2); + EXPECT_EQ(params.size(), 2U); EXPECT_TRUE(ParamInParams(float_param_2_, params)); EXPECT_TRUE(ParamInParams(float_param_3_, params)); float_param_1_->GetOutputs(¶ms); - EXPECT_EQ(params.size(), 2); + EXPECT_EQ(params.size(), 2U); EXPECT_TRUE(ParamInParams(float_param_2_, params)); EXPECT_TRUE(ParamInParams(float_param_3_, params)); float_param_2_->GetInputs(¶ms); - EXPECT_EQ(params.size(), 2); + EXPECT_EQ(params.size(), 2U); EXPECT_TRUE(ParamInParams(float_param_1_, params)); EXPECT_TRUE(ParamInParams(float_param_3_, params)); float_param_2_->GetOutputs(¶ms); - EXPECT_EQ(params.size(), 2); + EXPECT_EQ(params.size(), 2U); EXPECT_TRUE(ParamInParams(float_param_1_, params)); EXPECT_TRUE(ParamInParams(float_param_3_, params)); float_param_3_->GetInputs(¶ms); - EXPECT_EQ(params.size(), 2); + EXPECT_EQ(params.size(), 2U); EXPECT_TRUE(ParamInParams(float_param_1_, params)); EXPECT_TRUE(ParamInParams(float_param_2_, params)); float_param_3_->GetOutputs(¶ms); - EXPECT_EQ(params.size(), 2); + EXPECT_EQ(params.size(), 2U); EXPECT_TRUE(ParamInParams(float_param_1_, params)); EXPECT_TRUE(ParamInParams(float_param_2_, params)); @@ -689,12 +689,12 @@ TEST_F(ParamBindTest, GetInputsGetOuputs) { // +->3 float_param_3_->GetOutputs(¶ms); - EXPECT_EQ(params.size(), 2); + EXPECT_EQ(params.size(), 2U); EXPECT_TRUE(ParamInParams(float_param_1_, params)); EXPECT_TRUE(ParamInParams(float_param_2_, params)); float_param_1_->GetInputs(¶ms); - EXPECT_EQ(params.size(), 2); + EXPECT_EQ(params.size(), 2U); EXPECT_TRUE(ParamInParams(float_param_2_, params)); EXPECT_TRUE(ParamInParams(float_param_3_, params)); } diff --git a/o3d/core/cross/primitive_test.cc b/o3d/core/cross/primitive_test.cc index 757dcf0..661e0ab 100644 --- a/o3d/core/cross/primitive_test.cc +++ b/o3d/core/cross/primitive_test.cc @@ -100,8 +100,8 @@ TEST_F(PrimitiveTest, Basic) { primitive->set_number_vertices(8); EXPECT_EQ(primitive->primitive_type(), o3d::Primitive::TRIANGLELIST); - EXPECT_EQ(primitive->number_primitives(), 12); - EXPECT_EQ(primitive->number_vertices(), 8); + EXPECT_EQ(primitive->number_primitives(), 12U); + EXPECT_EQ(primitive->number_vertices(), 8U); // Check getting the index buffer. EXPECT_EQ(primitive->index_buffer(), index_buffer); diff --git a/o3d/core/cross/render_node_test.cc b/o3d/core/cross/render_node_test.cc index b572acc..256e3a2 100644 --- a/o3d/core/cross/render_node_test.cc +++ b/o3d/core/cross/render_node_test.cc @@ -95,12 +95,12 @@ TEST_F(RenderNodeBasicTest, SetParent) { // Check that the node was added as a child to the parent transform const RenderNodeArray children = parent->GetChildren(); - EXPECT_EQ(1, children.size()); + EXPECT_EQ(1U, children.size()); EXPECT_EQ(render_node, children[0]); // Check that SetParent(NULL) works properly too render_node->SetParent(NULL); - EXPECT_EQ(0, parent->GetChildren().size()); + EXPECT_EQ(0U, parent->GetChildren().size()); } TEST_F(RenderNodeBasicTest, SetParentCyclic) { diff --git a/o3d/core/cross/shape_test.cc b/o3d/core/cross/shape_test.cc index bc75244..08d14c3 100644 --- a/o3d/core/cross/shape_test.cc +++ b/o3d/core/cross/shape_test.cc @@ -71,7 +71,7 @@ TEST_F(ShapeTest, ElementsAccessorShouldReturnAllElements) { shape->AddElement(element); ElementArray elements = shape->GetElements(); - EXPECT_EQ(1, elements.size()); + EXPECT_EQ(1U, elements.size()); EXPECT_EQ(element, elements[0]); } @@ -87,7 +87,7 @@ TEST_F(ShapeTest, ElementsAccessorShouldReplaceAllElements) { shape->SetElements(elements); elements = shape->GetElements(); - EXPECT_EQ(1, elements.size()); + EXPECT_EQ(1U, elements.size()); EXPECT_EQ(element2, elements[0]); } } // namespace o3d diff --git a/o3d/core/cross/skin_test.cc b/o3d/core/cross/skin_test.cc index 5b1de83..ef4cd57 100644 --- a/o3d/core/cross/skin_test.cc +++ b/o3d/core/cross/skin_test.cc @@ -171,9 +171,9 @@ TEST_F(SkinTest, GetSetVertexInfluence) { // Check Highests are 0 const Skin::InfluencesArray& influences = skin->influences(); - ASSERT_EQ(influences.size(), 0); - EXPECT_EQ(skin->GetHighestMatrixIndex(), 0); - EXPECT_EQ(skin->GetHighestInfluences(), 0); + ASSERT_EQ(influences.size(), 0U); + EXPECT_EQ(skin->GetHighestMatrixIndex(), 0U); + EXPECT_EQ(skin->GetHighestInfluences(), 0U); // Add some influences. Skin::Influences no_influences; @@ -188,7 +188,7 @@ TEST_F(SkinTest, GetSetVertexInfluence) { skin->SetVertexInfluences(4, influences_4); // Check they got set. - ASSERT_EQ(influences.size(), 5); + ASSERT_EQ(influences.size(), 5U); EXPECT_TRUE(CompareInfluences(influences[0], influences_0)); EXPECT_TRUE(CompareInfluences(influences[1], no_influences)); EXPECT_TRUE(CompareInfluences(influences[2], no_influences)); @@ -196,8 +196,8 @@ TEST_F(SkinTest, GetSetVertexInfluence) { EXPECT_TRUE(CompareInfluences(influences[4], influences_4)); // Check the limits - EXPECT_EQ(skin->GetHighestMatrixIndex(), 4); - EXPECT_EQ(skin->GetHighestInfluences(), 2); + EXPECT_EQ(skin->GetHighestMatrixIndex(), 4U); + EXPECT_EQ(skin->GetHighestInfluences(), 2U); // Add a new influence. Skin::Influences influences_2; @@ -207,7 +207,7 @@ TEST_F(SkinTest, GetSetVertexInfluence) { // Check they got set. skin->SetVertexInfluences(2, influences_2); - ASSERT_EQ(influences.size(), 5); + ASSERT_EQ(influences.size(), 5U); EXPECT_TRUE(CompareInfluences(influences[0], influences_0)); EXPECT_TRUE(CompareInfluences(influences[1], no_influences)); EXPECT_TRUE(CompareInfluences(influences[2], influences_2)); @@ -215,12 +215,12 @@ TEST_F(SkinTest, GetSetVertexInfluence) { EXPECT_TRUE(CompareInfluences(influences[4], influences_4)); // Check the limits - EXPECT_EQ(skin->GetHighestMatrixIndex(), 9); - EXPECT_EQ(skin->GetHighestInfluences(), 3); + EXPECT_EQ(skin->GetHighestMatrixIndex(), 9U); + EXPECT_EQ(skin->GetHighestInfluences(), 3U); // Add one past the end. skin->SetVertexInfluences(6, influences_4); - ASSERT_EQ(influences.size(), 7); + ASSERT_EQ(influences.size(), 7U); EXPECT_TRUE(CompareInfluences(influences[0], influences_0)); EXPECT_TRUE(CompareInfluences(influences[1], no_influences)); EXPECT_TRUE(CompareInfluences(influences[2], influences_2)); @@ -230,8 +230,8 @@ TEST_F(SkinTest, GetSetVertexInfluence) { EXPECT_TRUE(CompareInfluences(influences[6], influences_4)); // Check the limits - EXPECT_EQ(skin->GetHighestMatrixIndex(), 9); - EXPECT_EQ(skin->GetHighestInfluences(), 3); + EXPECT_EQ(skin->GetHighestMatrixIndex(), 9U); + EXPECT_EQ(skin->GetHighestInfluences(), 3U); } TEST_F(SkinTest, GetSetInverseBindPoseMatrices) { @@ -240,7 +240,7 @@ TEST_F(SkinTest, GetSetInverseBindPoseMatrices) { ASSERT_TRUE(skin != NULL); const Skin::MatrixArray& matrices = skin->inverse_bind_pose_matrices(); - EXPECT_EQ(matrices.size(), 0); + EXPECT_EQ(matrices.size(), 0U); Matrix4 matrix_2(Vector4(1.0f, 2.0f, 3.0f, 4.0f), Vector4(2.0f, 3.0f, 4.0f, 6.0f), @@ -252,13 +252,13 @@ TEST_F(SkinTest, GetSetInverseBindPoseMatrices) { Vector4(4.0f, 5.0f, 6.0f, 8.0f)); skin->SetInverseBindPoseMatrix(2, matrix_2); - EXPECT_EQ(matrices.size(), 3); + EXPECT_EQ(matrices.size(), 3U); EXPECT_TRUE(CompareMatrix4s(matrices[0], Matrix4::identity())); EXPECT_TRUE(CompareMatrix4s(matrices[1], Matrix4::identity())); EXPECT_TRUE(CompareMatrix4s(matrices[2], matrix_2)); skin->SetInverseBindPoseMatrix(4, matrix_4); - EXPECT_EQ(matrices.size(), 5); + EXPECT_EQ(matrices.size(), 5U); EXPECT_TRUE(CompareMatrix4s(matrices[0], Matrix4::identity())); EXPECT_TRUE(CompareMatrix4s(matrices[1], Matrix4::identity())); EXPECT_TRUE(CompareMatrix4s(matrices[2], matrix_2)); @@ -407,7 +407,6 @@ TEST_F(SkinEvalTest, BindStreams) { 0.5f + 4.0f, 3.0f + 5.0f, 1.5f + 6.0f, 1.0f, }; - const unsigned kStride = 10 * sizeof(vertices[0]); const unsigned kNumElements = 3; // Create the buffers. @@ -668,7 +667,7 @@ TEST_F(SkinTest, SkinRawDataValid) { // Write out some influence data - const size_t kNumInfluences = 32; + const int kNumInfluences = 32; write_stream.WriteLittleEndianInt32(kNumInfluences); for (int i = 0; i < kNumInfluences; ++i) { @@ -688,10 +687,11 @@ TEST_F(SkinTest, SkinRawDataValid) { // Validate the influences const Skin::InfluencesArray& influences_array = skin->influences(); - EXPECT_EQ(1, influences_array.size()); + EXPECT_EQ(1U, influences_array.size()); const Skin::Influences& influences = influences_array[0]; - EXPECT_EQ(kNumInfluences, influences.size()); + unsigned expected_count = kNumInfluences; + EXPECT_EQ(expected_count, influences.size()); for (Skin::Influences::size_type i = 0; i < influences.size(); ++i) { const Skin::Influence &influence = influences[i]; diff --git a/o3d/core/cross/smart_ptr_test.cc b/o3d/core/cross/smart_ptr_test.cc index e6d293a..feb45f7 100644 --- a/o3d/core/cross/smart_ptr_test.cc +++ b/o3d/core/cross/smart_ptr_test.cc @@ -108,7 +108,9 @@ TEST_F(SmartPtrTest, AssignmentRelease) { SmartPointer<InstanceCount> smart_ptr1(new InstanceCount()); SmartPointer<InstanceCount> smart_ptr2(new InstanceCount()); InstanceCount *raw_ptr1 = smart_ptr1.Get(); + EXPECT_TRUE(raw_ptr1 != NULL); InstanceCount *raw_ptr2 = smart_ptr2.Get(); + EXPECT_TRUE(raw_ptr2 != NULL); // Validate that assignment destroys the previous instance. smart_ptr2 = smart_ptr1; diff --git a/o3d/core/cross/stream_bank_test.cc b/o3d/core/cross/stream_bank_test.cc index a154df3..daee4ca 100644 --- a/o3d/core/cross/stream_bank_test.cc +++ b/o3d/core/cross/stream_bank_test.cc @@ -255,7 +255,7 @@ TEST_F(StreamBankTest, BindStream) { 3.0f)); // Check that UpdateOutputs only got called once. - EXPECT_EQ(source->update_outputs_call_count(), 1); + EXPECT_EQ(source->update_outputs_call_count(), 1U); } } // namespace o3d diff --git a/o3d/core/cross/stream_test.cc b/o3d/core/cross/stream_test.cc index cfbacff..7f1a7de 100644 --- a/o3d/core/cross/stream_test.cc +++ b/o3d/core/cross/stream_test.cc @@ -91,7 +91,7 @@ TEST_F(StreamBasic, Constructor) { FieldTest::Ref field(new FieldTest()); unsigned start_index = 1; - unsigned semantic_index = 2; + int semantic_index = 2; Stream::Semantic semantic = Stream::BINORMAL; Stream stream(g_service_locator, diff --git a/o3d/core/cross/transform_test.cc b/o3d/core/cross/transform_test.cc index c7d9869..7ee4f23 100644 --- a/o3d/core/cross/transform_test.cc +++ b/o3d/core/cross/transform_test.cc @@ -286,13 +286,13 @@ TEST_F(TransformBasic, GetChildren) { Transform* t2 = pack()->Create<Transform>(); Transform* t3 = pack()->Create<Transform>(); - EXPECT_EQ(0, transform_->GetChildren().size()); + EXPECT_EQ(0U, transform_->GetChildren().size()); t2->SetParent(transform_); - EXPECT_EQ(1, transform_->GetChildren().size()); + EXPECT_EQ(1U, transform_->GetChildren().size()); t3->SetParent(transform_); - EXPECT_EQ(2, transform_->GetChildren().size()); + EXPECT_EQ(2U, transform_->GetChildren().size()); TransformArray children = transform_->GetChildren(); TransformArrayConstIterator pos = find(children.begin(), children.end(), t2); @@ -334,7 +334,7 @@ TEST_F(TransformBasic, GetTransformsInTree) { TransformArray transforms_in_tree(transform2_->GetTransformsInTree()); // Check that all of them are in the tree. - EXPECT_EQ(transforms_in_tree.size(), 4); + EXPECT_EQ(transforms_in_tree.size(), 4U); EXPECT_TRUE(std::find(transforms_in_tree.begin(), transforms_in_tree.end(), transform_) != transforms_in_tree.end()); @@ -352,7 +352,7 @@ TEST_F(TransformBasic, GetTransformsInTree) { t3->SetParent(NULL); transforms_in_tree = transform2_->GetTransformsInTree(); - EXPECT_EQ(transforms_in_tree.size(), 2); + EXPECT_EQ(transforms_in_tree.size(), 2U); EXPECT_TRUE(std::find(transforms_in_tree.begin(), transforms_in_tree.end(), transform_) != transforms_in_tree.end()); @@ -373,9 +373,9 @@ TEST_F(TransformBasic, GetTransformsByNameInTree) { SetupSimpleTree(); // Check that a transform is in there. - EXPECT_EQ(transform2_->GetTransformsByNameInTree("t2").size(), 1); + EXPECT_EQ(transform2_->GetTransformsByNameInTree("t2").size(), 1U); // Check that another transform is not in there. - EXPECT_EQ(transform2_->GetTransformsByNameInTree("t3").size(), 0); + EXPECT_EQ(transform2_->GetTransformsByNameInTree("t3").size(), 0U); } // Tests AddShape, RemoveShape, GetShapes. @@ -391,7 +391,7 @@ TEST_F(TransformBasic, AddShapeRemoveShapeGetShapes) { // Check that they actually got added. { const ShapeRefArray& shapes = transform_->GetShapeRefs(); - EXPECT_EQ(shapes.size(), 2); + EXPECT_EQ(shapes.size(), 2U); EXPECT_TRUE(std::find(shapes.begin(), shapes.end(), Shape::Ref(shape1)) != shapes.end()); @@ -406,7 +406,7 @@ TEST_F(TransformBasic, AddShapeRemoveShapeGetShapes) { { // check it got added. ShapeArray shapes = transform_->GetShapes(); - EXPECT_EQ(shapes.size(), 3); + EXPECT_EQ(shapes.size(), 3U); EXPECT_TRUE(std::find(shapes.begin(), shapes.end(), Shape::Ref(shape1)) != shapes.end()); @@ -435,7 +435,7 @@ TEST_F(TransformBasic, transform_->SetShapes(shape_array); shape_array = transform_->GetShapes(); - EXPECT_EQ(1, shape_array.size()); + EXPECT_EQ(1U, shape_array.size()); EXPECT_EQ(shape2, shape_array[0]); } @@ -463,8 +463,8 @@ TEST_F(TransformBasic, CreateGroupDrawElements) { transform2_->CreateDrawElements(pack(), material); // Check that they got created correctly. - EXPECT_EQ(primitive1->GetDrawElementRefs().size(), 2); - EXPECT_EQ(primitive2->GetDrawElementRefs().size(), 2); + EXPECT_EQ(primitive1->GetDrawElementRefs().size(), 2U); + EXPECT_EQ(primitive2->GetDrawElementRefs().size(), 2U); } TEST_F(TransformBasic, GetConcreteInputsForParamGetConcreteOutputsForParam) { @@ -500,7 +500,7 @@ TEST_F(TransformBasic, GetConcreteInputsForParamGetConcreteOutputsForParam) { // Tests GetConcreteInputsForParam (because GetInputsForParam calles // GetConcreteInputsForParam) t1_world_matrix->GetInputs(¶ms); - EXPECT_EQ(params.size(), 7); + EXPECT_EQ(params.size(), 7U); EXPECT_TRUE(ParamInParams(t1_local_matrix, params)); EXPECT_TRUE(ParamInParams(t2_world_matrix, params)); EXPECT_TRUE(ParamInParams(t2_local_matrix, params)); @@ -510,19 +510,19 @@ TEST_F(TransformBasic, GetConcreteInputsForParamGetConcreteOutputsForParam) { EXPECT_TRUE(ParamInParams(t4_local_matrix, params)); t1_local_matrix->GetInputs(¶ms); - EXPECT_EQ(params.size(), 0); + EXPECT_EQ(params.size(), 0U); // Tests GetConcreteOutputsForParam (because GetOutputsForParam calles // GetConcreteOutputsForParam) t4_local_matrix->GetOutputs(¶ms); - EXPECT_EQ(params.size(), 4); + EXPECT_EQ(params.size(), 4U); EXPECT_TRUE(ParamInParams(t1_world_matrix, params)); EXPECT_TRUE(ParamInParams(t2_world_matrix, params)); EXPECT_TRUE(ParamInParams(t3_world_matrix, params)); EXPECT_TRUE(ParamInParams(t4_world_matrix, params)); t4_world_matrix->GetOutputs(¶ms); - EXPECT_EQ(params.size(), 3); + EXPECT_EQ(params.size(), 3U); EXPECT_TRUE(ParamInParams(t1_world_matrix, params)); EXPECT_TRUE(ParamInParams(t2_world_matrix, params)); EXPECT_TRUE(ParamInParams(t3_world_matrix, params)); @@ -545,12 +545,15 @@ TEST_F(TransformBasic, ImplicitInputs) { Param* t1_local_matrix = transform_->GetUntypedParam( Transform::kLocalMatrixParamName); + EXPECT_TRUE(t1_local_matrix != NULL); Param* t2_local_matrix = transform2_->GetUntypedParam( Transform::kLocalMatrixParamName); + EXPECT_TRUE(t2_local_matrix != NULL); Param* t3_local_matrix = t3->GetUntypedParam( Transform::kLocalMatrixParamName); Param* t4_local_matrix = t4->GetUntypedParam( Transform::kLocalMatrixParamName); + EXPECT_TRUE(t4_local_matrix != NULL); ParamMatrix4* t1_world_matrix = transform_->GetParam<ParamMatrix4>( Transform::kWorldMatrixParamName); Param* t2_world_matrix = transform2_->GetUntypedParam( diff --git a/o3d/core/cross/vector_map_test.cc b/o3d/core/cross/vector_map_test.cc index ffad0fe..7316a9c 100644 --- a/o3d/core/cross/vector_map_test.cc +++ b/o3d/core/cross/vector_map_test.cc @@ -47,12 +47,12 @@ TEST(VectorMapTest, General) { the_map[0] = 5; EXPECT_FALSE(the_map.empty()); - EXPECT_EQ(the_map.size(), 1); + EXPECT_EQ(the_map.size(), 1U); the_map[9] = 2; EXPECT_FALSE(the_map.empty()); - EXPECT_EQ(the_map.size(), 2); + EXPECT_EQ(the_map.size(), 2U); EXPECT_EQ(the_map[9], 2); EXPECT_EQ(the_map[0], 5); @@ -77,7 +77,7 @@ TEST(VectorMapTest, General) { EXPECT_EQ(the_map[1234], 90); EXPECT_EQ(the_map[ 8], 23); EXPECT_EQ(the_map[ -5], 6); - EXPECT_EQ(the_map.size(), 5); + EXPECT_EQ(the_map.size(), 5U); EXPECT_FALSE(the_map.empty()); iter = the_map.begin(); @@ -120,7 +120,7 @@ TEST(VectorMapTest, Insert) { EXPECT_EQ(it->first, j); EXPECT_EQ(it->second, j * 100); } - EXPECT_EQ(the_map.size(), i); + EXPECT_EQ(static_cast<int>(the_map.size()), i); EXPECT_FALSE(the_map.empty()); } } @@ -171,7 +171,7 @@ TEST(VectorMapTest, InsertIfNotPresent) { EXPECT_EQ(it->first, j); EXPECT_EQ(it->second, j * 100); } - EXPECT_EQ(the_map.size(), i); + EXPECT_EQ(static_cast<int>(the_map.size()), i); EXPECT_FALSE(the_map.empty()); } } @@ -188,7 +188,7 @@ TEST(VectorMapTest, Erase) { EXPECT_EQ(the_map["monday" ], 1); EXPECT_EQ(the_map["tuesday" ], 2); EXPECT_EQ(the_map["wednesday"], 3); - EXPECT_EQ(the_map.count("tuesday"), 1); + EXPECT_EQ(the_map.count("tuesday"), 1U); iter = the_map.begin(); ASSERT_TRUE(iter != the_map.end()); @@ -212,12 +212,12 @@ TEST(VectorMapTest, Erase) { EXPECT_TRUE(iter1 == iter2); EXPECT_TRUE(iter == the_map.end()); - EXPECT_EQ(the_map.erase("tuesday"), 1); + EXPECT_EQ(the_map.erase("tuesday"), 1U); EXPECT_EQ(the_map["monday" ], 1); EXPECT_EQ(the_map["wednesday"], 3); - EXPECT_EQ(the_map.count("tuesday"), 0); - EXPECT_EQ(the_map.erase("tuesday"), 0); + EXPECT_EQ(the_map.count("tuesday"), 0U); + EXPECT_EQ(the_map.erase("tuesday"), 0U); iter = the_map.begin(); ASSERT_TRUE(iter != the_map.end()); @@ -234,24 +234,24 @@ TEST(VectorMapTest, Erase) { the_map["thursday"] = 4; the_map["friday"] = 5; - EXPECT_EQ(the_map.size(), 4); + EXPECT_EQ(the_map.size(), 4U); EXPECT_FALSE(the_map.empty()); the_map["saturday"] = 6; - EXPECT_EQ(the_map.count("friday"), 1); - EXPECT_EQ(the_map.erase("friday"), 1); - EXPECT_EQ(the_map.count("friday"), 0); - EXPECT_EQ(the_map.erase("friday"), 0); + EXPECT_EQ(the_map.count("friday"), 1U); + EXPECT_EQ(the_map.erase("friday"), 1U); + EXPECT_EQ(the_map.count("friday"), 0U); + EXPECT_EQ(the_map.erase("friday"), 0U); - EXPECT_EQ(the_map.size(), 4); + EXPECT_EQ(the_map.size(), 4U); EXPECT_FALSE(the_map.empty()); - EXPECT_EQ(the_map.erase("monday"), 1); - EXPECT_EQ(the_map.size(), 3); + EXPECT_EQ(the_map.erase("monday"), 1U); + EXPECT_EQ(the_map.size(), 3U); EXPECT_FALSE(the_map.empty()); the_map.clear(); - EXPECT_EQ(the_map.size(), 0); + EXPECT_EQ(the_map.size(), 0U); EXPECT_TRUE(the_map.empty()); } diff --git a/o3d/core/cross/vertex_source_test.cc b/o3d/core/cross/vertex_source_test.cc index cea3e2d..d190aa0 100644 --- a/o3d/core/cross/vertex_source_test.cc +++ b/o3d/core/cross/vertex_source_test.cc @@ -224,8 +224,8 @@ TEST_F(VertexSourceTest, BindStream) { 3.0f)); // Check that UpdateOutputs only got called once. - EXPECT_EQ(destination->update_outputs_call_count(), 1); - EXPECT_EQ(source->update_outputs_call_count(), 1); + EXPECT_EQ(destination->update_outputs_call_count(), 1U); + EXPECT_EQ(source->update_outputs_call_count(), 1U); // Test that if we chain another VertexSource UpdateOutputs only gets called // once. @@ -271,15 +271,15 @@ TEST_F(VertexSourceTest, BindStream) { 3.0f)); // Check that UpdateOutputs only got called once. - EXPECT_EQ(destination->update_outputs_call_count(), 2); - EXPECT_EQ(source->update_outputs_call_count(), 2); - EXPECT_EQ(source_b->update_outputs_call_count(), 1); + EXPECT_EQ(destination->update_outputs_call_count(), 2U); + EXPECT_EQ(source->update_outputs_call_count(), 2U); + EXPECT_EQ(source_b->update_outputs_call_count(), 1U); // Test that if we ask again UpdateOutputs does not get called. destination->UpdateStreams(); - EXPECT_EQ(destination->update_outputs_call_count(), 2); - EXPECT_EQ(source->update_outputs_call_count(), 2); - EXPECT_EQ(source_b->update_outputs_call_count(), 1); + EXPECT_EQ(destination->update_outputs_call_count(), 2U); + EXPECT_EQ(source->update_outputs_call_count(), 2U); + EXPECT_EQ(source_b->update_outputs_call_count(), 1U); // Test that we can unbind. EXPECT_TRUE(source->UnbindStream(Stream::POSITION, 0)); diff --git a/o3d/import/cross/gz_compressor_test.cc b/o3d/import/cross/gz_compressor_test.cc index 4cebb004..cd39499 100644 --- a/o3d/import/cross/gz_compressor_test.cc +++ b/o3d/import/cross/gz_compressor_test.cc @@ -80,7 +80,7 @@ class DecompressorClient : public o3d::StreamProcessor { void VerifyDecompressedOutput(uint8 *original_data) { // Make sure we filled up the output buffer - EXPECT_EQ(0, write_stream_.GetRemainingByteCount()); + EXPECT_EQ(0U, write_stream_.GetRemainingByteCount()); // Verify decompressed data with the original data we fed into the // compressor diff --git a/o3d/import/cross/gz_decompressor_test.cc b/o3d/import/cross/gz_decompressor_test.cc index 4bb71d6..ec79ad9 100644 --- a/o3d/import/cross/gz_decompressor_test.cc +++ b/o3d/import/cross/gz_decompressor_test.cc @@ -124,11 +124,11 @@ TEST_F(GzDecompressorTest, LoadGzFile) { const int kChunkSize = 512; MemoryReadStream compressed_stream(compressed_data, compressed_size); - size_t bytes_to_process = compressed_size; + int bytes_to_process = compressed_size; StreamProcessor::Status status = StreamProcessor::SUCCESS; while (bytes_to_process > 0) { - size_t bytes_this_time = + int bytes_this_time = bytes_to_process < kChunkSize ? bytes_to_process : kChunkSize; status = decompressor.ProcessBytes(&compressed_stream, bytes_this_time); diff --git a/o3d/import/cross/memory_buffer_test.cc b/o3d/import/cross/memory_buffer_test.cc index 59cb721..47797bb 100644 --- a/o3d/import/cross/memory_buffer_test.cc +++ b/o3d/import/cross/memory_buffer_test.cc @@ -48,12 +48,12 @@ TEST_F(MemoryBufferTest, Basic) { int i; MemoryBuffer<int> buffer; // Check that initially the buffer is not allocated - ASSERT_EQ(0, buffer.GetLength()); + ASSERT_EQ(0U, buffer.GetLength()); // Allocate and check the length is good const int kBufferLength = 1024; buffer.Allocate(kBufferLength); - ASSERT_EQ(kBufferLength, buffer.GetLength()); + ASSERT_EQ(kBufferLength, static_cast<int>(buffer.GetLength())); // Once allocated, the initial contents should be zero // Check that the buffer contents are zeroed out @@ -92,7 +92,7 @@ TEST_F(MemoryBufferTest, Basic) { // Deallocate the buffer and verify its length buffer.Deallocate(); - ASSERT_EQ(0, buffer.GetLength()); + ASSERT_EQ(0U, buffer.GetLength()); } } // namespace o3d diff --git a/o3d/import/cross/memory_stream_test.cc b/o3d/import/cross/memory_stream_test.cc index 77ae95c..f72d7f0 100644 --- a/o3d/import/cross/memory_stream_test.cc +++ b/o3d/import/cross/memory_stream_test.cc @@ -46,8 +46,9 @@ namespace o3d { -static char *kTestString = - "Tests functionality of the MemoryReadStream and MemoryWriteStream classes"; +static char *kTestString = const_cast<char*> + ("Tests functionality of the MemoryReadStream and MemoryWriteStream classes"); + // Test fixture for MemoryReadStream and MemoryWriteStream. class MemoryStreamTest : public testing::Test { @@ -70,7 +71,8 @@ TEST_F(MemoryStreamTest, Read) { MemoryReadStream read_stream(buffer, buffer.GetLength()); EXPECT_EQ(buffer.GetLength(), read_stream.GetTotalStreamLength()); - EXPECT_EQ(kStringLength, read_stream.GetTotalStreamLength()); + EXPECT_EQ(kStringLength, + static_cast<int>(read_stream.GetTotalStreamLength())); // Read one byte at a time and verify uint8 c; @@ -96,8 +98,9 @@ TEST_F(MemoryStreamTest, Read) { // Verify bytes read, stream position and remaining byte count EXPECT_EQ(5, bytes_read); - EXPECT_EQ(5, read_stream2.GetStreamPosition()); - EXPECT_EQ(kStringLength - 5, read_stream2.GetRemainingByteCount()); + EXPECT_EQ(5U, read_stream2.GetStreamPosition()); + EXPECT_EQ(kStringLength - 5, + static_cast<int>(read_stream2.GetRemainingByteCount())); // Next read the remaining bytes bytes_read = read_stream2.Read(read_buffer + 5, kStringLength - 5); @@ -131,7 +134,7 @@ TEST_F(MemoryStreamTest, Write) { MemoryWriteStream empty_stream; // Verfify length is zero - EXPECT_EQ(0, empty_stream.GetTotalStreamLength()); + EXPECT_EQ(0U, empty_stream.GetTotalStreamLength()); // Now, assign it to the string (OK, we can't really write to // this memory, but we're just checking the API here @@ -139,27 +142,30 @@ TEST_F(MemoryStreamTest, Write) { empty_stream.Assign(reinterpret_cast<uint8*>(kTestString), kStringLength); // Sanity check on length, position, remaining - EXPECT_EQ(kStringLength, empty_stream.GetTotalStreamLength()); - EXPECT_EQ(0, empty_stream.GetStreamPosition()); - EXPECT_EQ(kStringLength, empty_stream.GetRemainingByteCount()); + EXPECT_EQ(kStringLength, + static_cast<int>(empty_stream.GetTotalStreamLength())); + EXPECT_EQ(0U, empty_stream.GetStreamPosition()); + EXPECT_EQ(kStringLength, + static_cast<int>(empty_stream.GetRemainingByteCount())); // Create a write stream on a buffer we can write to MemoryBuffer<uint8> buffer(kStringLength); MemoryWriteStream write_stream(buffer, buffer.GetLength()); - EXPECT_EQ(buffer.GetLength(), kStringLength); + EXPECT_EQ(static_cast<int>(buffer.GetLength()), kStringLength); // Write 5 bytes uint8 *p = reinterpret_cast<uint8*>(kTestString); int bytes_written = write_stream.Write(p, 5); EXPECT_EQ(5, bytes_written); - EXPECT_EQ(5, write_stream.GetStreamPosition()); - EXPECT_EQ(kStringLength - 5, write_stream.GetRemainingByteCount()); + EXPECT_EQ(5U, write_stream.GetStreamPosition()); + EXPECT_EQ(kStringLength - 5, + static_cast<int>(write_stream.GetRemainingByteCount())); // Write the remaining bytes in the string bytes_written = write_stream.Write(p + 5, kStringLength - 5); EXPECT_EQ(kStringLength - 5, bytes_written); - EXPECT_EQ(kStringLength, write_stream.GetStreamPosition()); - EXPECT_EQ(0, write_stream.GetRemainingByteCount()); + EXPECT_EQ(kStringLength, static_cast<int>(write_stream.GetStreamPosition())); + EXPECT_EQ(0U, write_stream.GetRemainingByteCount()); // Verify we wrote the correct data EXPECT_EQ(0, memcmp(buffer, kTestString, kStringLength)); diff --git a/o3d/import/cross/raw_data_test.cc b/o3d/import/cross/raw_data_test.cc index 4ab0955..4399cd9 100644 --- a/o3d/import/cross/raw_data_test.cc +++ b/o3d/import/cross/raw_data_test.cc @@ -118,7 +118,7 @@ TEST_F(RawDataTest, CreateFromFile) { size_t file_length = static_cast<size_t>(file_size64); ASSERT_TRUE(file_length > 0); scoped_array<uint8> data(new uint8[file_length]); - ASSERT_EQ(fread(data.get(), file_length, 1, file), 1); + ASSERT_EQ(fread(data.get(), file_length, 1, file), 1U); CloseFile(file); ASSERT_EQ(file_length, ref->GetLength()); diff --git a/o3d/import/cross/tar_generator.cc b/o3d/import/cross/tar_generator.cc index cbfab24..6c21ac0 100644 --- a/o3d/import/cross/tar_generator.cc +++ b/o3d/import/cross/tar_generator.cc @@ -158,7 +158,7 @@ bool TarGenerator::AddEntry(const String &file_name, bool is_directory) { // If filename is longer 99 chars, use the GNU format to write out a longer // filename. - if (file_name.size() >= kMaxFilenameSizeOldFormat) { + if (file_name.size() >= static_cast<unsigned>(kMaxFilenameSizeOldFormat)) { WriteHeader(kLongLink, file_name.size(), 'L', diff --git a/o3d/import/cross/tar_generator_test.cc b/o3d/import/cross/tar_generator_test.cc index 0e6dccb..5fdec8a 100644 --- a/o3d/import/cross/tar_generator_test.cc +++ b/o3d/import/cross/tar_generator_test.cc @@ -335,7 +335,7 @@ void CallbackClient::ValidateHeader(uint8 *header, // Validate length int length_in_header; sscanf((const char*)header + kFileSizeOffset, "%o", &length_in_header); - EXPECT_EQ(file_length, length_in_header); + EXPECT_EQ(file_length, static_cast<unsigned>(length_in_header)); EXPECT_EQ(0, header[kMaxFilenameSize - 1]); @@ -425,7 +425,7 @@ TEST_F(TarGeneratorTest, CreateSimpleArchive) { // Verify that the tar byte stream produced is exactly divisible by // the block size size_t bytes_received = client.GetTotalBytesReceived(); - EXPECT_EQ(0, bytes_received % kBlockSize); + EXPECT_EQ(0U, bytes_received % kBlockSize); // Make sure the state machine is in the expected state EXPECT_EQ(CallbackClient::FINISHED, client.GetState()); diff --git a/o3d/import/cross/tar_processor_test.cc b/o3d/import/cross/tar_processor_test.cc index 77a2522..2e1f0bd 100644 --- a/o3d/import/cross/tar_processor_test.cc +++ b/o3d/import/cross/tar_processor_test.cc @@ -155,10 +155,10 @@ TEST_F(TarProcessorTest, LoadTarFile) { const int kChunkSize = 32; MemoryReadStream tar_stream(tar_data, file_size); - size_t bytes_to_process = file_size; + int bytes_to_process = file_size; while (bytes_to_process > 0) { - size_t bytes_this_time = + int bytes_this_time = bytes_to_process < kChunkSize ? bytes_to_process : kChunkSize; StreamProcessor::Status status = tar_processor.ProcessBytes( diff --git a/o3d/import/cross/targz_generator_test.cc b/o3d/import/cross/targz_generator_test.cc index 2e1cf7b..7911387 100644 --- a/o3d/import/cross/targz_generator_test.cc +++ b/o3d/import/cross/targz_generator_test.cc @@ -145,7 +145,7 @@ TEST_F(TarGzGeneratorTest, GenerateTarGz) { ASSERT_TRUE(audio_data != NULL); ASSERT_TRUE(shader_data != NULL); - ASSERT_NE(0, targz_reference_size); + ASSERT_NE(0U, targz_reference_size); TarGzTestClient test_client(targz_reference_size); TarGzGenerator targz_generator(&test_client); diff --git a/o3d/import/cross/threaded_stream_processor_test.cc b/o3d/import/cross/threaded_stream_processor_test.cc index 44698ad3..0a4530f 100644 --- a/o3d/import/cross/threaded_stream_processor_test.cc +++ b/o3d/import/cross/threaded_stream_processor_test.cc @@ -89,7 +89,7 @@ TEST_F(ThreadedStreamProcessorTest, CanForwardZeroBuffers) { processor.Close(true); processor.StopThread(); - EXPECT_EQ(0, receiver.GetResultLength()); + EXPECT_EQ(0U, receiver.GetResultLength()); EXPECT_TRUE(receiver.closed()); EXPECT_TRUE(receiver.success()); } @@ -104,7 +104,7 @@ TEST_F(ThreadedStreamProcessorTest, CanForwardOneBufferOfZeroBytes) { processor.Close(true); processor.StopThread(); - EXPECT_EQ(0, receiver.GetResultLength()); + EXPECT_EQ(0U, receiver.GetResultLength()); EXPECT_TRUE(receiver.closed()); EXPECT_TRUE(receiver.success()); } diff --git a/o3d/plugin/mac/plugin_logging-mac.mm b/o3d/plugin/mac/plugin_logging-mac.mm index 8466260..ab3ad5c 100644 --- a/o3d/plugin/mac/plugin_logging-mac.mm +++ b/o3d/plugin/mac/plugin_logging-mac.mm @@ -63,7 +63,9 @@ PluginLogging::PluginLogging() : timer_(new HighresTimer()), bool PluginLogging::UpdateLogging() { // Check that sufficient time has passed since last aggregation // Otherwise we can just return - if (timer_->GetElapsedMs() < kStatsAggregationIntervalMSec) return false; + if (timer_->GetElapsedMs() < + static_cast<unsigned>(kStatsAggregationIntervalMSec)) + return false; // Sufficient time has passed, let's process // Reset timer diff --git a/o3d/plugin/win/plugin_logging-win32.cc b/o3d/plugin/win/plugin_logging-win32.cc index c1f389f..64cf314 100644 --- a/o3d/plugin/win/plugin_logging-win32.cc +++ b/o3d/plugin/win/plugin_logging-win32.cc @@ -67,7 +67,9 @@ PluginLogging::PluginLogging() : timer_(new HighresTimer()), bool PluginLogging::UpdateLogging() { // If sufficient time has not passed since last aggregation, we can just // return until next time. - if (timer_->GetElapsedMs() < kStatsAggregationIntervalMSec) return false; + if (timer_->GetElapsedMs() < + static_cast<unsigned>(kStatsAggregationIntervalMSec)) + return false; // Reset timer. timer_->Start(); diff --git a/o3d/serializer/cross/serializer_test.cc b/o3d/serializer/cross/serializer_test.cc index aa19465..3bd6893 100644 --- a/o3d/serializer/cross/serializer_test.cc +++ b/o3d/serializer/cross/serializer_test.cc @@ -332,7 +332,7 @@ TEST_F(SerializerTest, ShouldSerializeCurveKeysToSingleBinaryFile) { linear_key->SetOutput(4); serializer_.SerializePack(pack_); - EXPECT_EQ(1, archive_generator_.add_file_records_.size()); + EXPECT_EQ(1U, archive_generator_.add_file_records_.size()); const AddFileRecord& record = archive_generator_.add_file_records_[0]; EXPECT_EQ("curve-keys.bin", record.file_name_); @@ -422,7 +422,7 @@ TEST_F(SerializerTest, SerializesAllIndexBufferBinaryToSingleFileInArchive) { } serializer_.SerializePack(pack_); - EXPECT_EQ(1, archive_generator_.add_file_records_.size()); + EXPECT_EQ(1U, archive_generator_.add_file_records_.size()); const AddFileRecord& record = archive_generator_.add_file_records_[0]; EXPECT_EQ("index-buffers.bin", record.file_name_); @@ -753,7 +753,7 @@ TEST_F(SerializerTest, ShouldSerializeSkinToSingleBinaryFile) { skin2->SetInverseBindPoseMatrix(0, Matrix4::identity()); serializer_.SerializePack(pack_); - EXPECT_EQ(1, archive_generator_.add_file_records_.size()); + EXPECT_EQ(1U, archive_generator_.add_file_records_.size()); const AddFileRecord& record = archive_generator_.add_file_records_[0]; EXPECT_EQ("skins.bin", record.file_name_); @@ -842,6 +842,7 @@ TEST_F(SerializerTest, ShouldSerializeBoundSkinEval) { skin_eval1->BindStream(skin_eval2, Stream::POSITION, 0); ParamVertexBufferStream* param = skin_eval2->GetVertexStreamParam( Stream::POSITION, 0); + EXPECT_TRUE(param != NULL); serializer_.SerializeSection(skin_eval1, Serializer::CUSTOM_SECTION); StringWriter expected(StringWriter::CR_LF); @@ -868,6 +869,8 @@ TEST_F(SerializerTest, ShouldSerializeStreamBank) { Field* field_1 = vertex_buffer_1->CreateField(FloatField::GetApparentClass(), 3); VertexBuffer* vertex_buffer_2 = pack_->Create<VertexBuffer>(); + EXPECT_TRUE(vertex_buffer_2 != NULL); + Field* field_2 = vertex_buffer_1->CreateField(FloatField::GetApparentClass(), 3); stream_bank->SetVertexStream(Stream::POSITION, @@ -1055,7 +1058,7 @@ TEST_F(SerializerTest, SerializesAllVertexBufferBinaryToSingleFileInArchive) { } serializer_.SerializePack(pack_); - EXPECT_EQ(1, archive_generator_.add_file_records_.size()); + EXPECT_EQ(1U, archive_generator_.add_file_records_.size()); const AddFileRecord& record = archive_generator_.add_file_records_[0]; EXPECT_EQ("vertex-buffers.bin", record.file_name_); diff --git a/o3d/statsreport/aggregator-mac.mm b/o3d/statsreport/aggregator-mac.mm index 69699ab..8f212b6 100644 --- a/o3d/statsreport/aggregator-mac.mm +++ b/o3d/statsreport/aggregator-mac.mm @@ -43,8 +43,8 @@ namespace stats_report { MetricsAggregatorMac::MetricsAggregatorMac(const MetricCollection &coll) : MetricsAggregator(coll), - dict_(nil), - pool_(nil){ + pool_(nil), + dict_(nil) { storePath_ = O3DStatsPath(); } diff --git a/o3d/statsreport/common/highres_timer_unittest.cc b/o3d/statsreport/common/highres_timer_unittest.cc index 7f40f10..8a62a91 100644 --- a/o3d/statsreport/common/highres_timer_unittest.cc +++ b/o3d/statsreport/common/highres_timer_unittest.cc @@ -47,14 +47,14 @@ TEST(HighresTimer, DISABLED_MillisecondClock) { // note: this could fail if we context switch between initializing the timer // and here. Very unlikely however. - EXPECT_EQ(0, timer.GetElapsedMs()); + EXPECT_EQ(0U, timer.GetElapsedMs()); timer.Start(); uint64 half_ms = HighresTimer::GetTimerFrequency() / 2000; // busy wait for half a millisecond while (timer.start_ticks() + half_ms > HighresTimer::GetCurrentTicks()) { // Nothing } - EXPECT_EQ(1, timer.GetElapsedMs()); + EXPECT_EQ(1U, timer.GetElapsedMs()); } #ifndef BUILD_SERVER_BUILD @@ -64,21 +64,21 @@ TEST(HighresTimer, DISABLED_SecondClock) { #endif HighresTimer timer; - EXPECT_EQ(0, timer.GetElapsedSec()); + EXPECT_EQ(0U, timer.GetElapsedSec()); #ifdef OS_WIN ::Sleep(250); #else struct timespec ts1 = {0, 250000000}; nanosleep(&ts1, 0); #endif - EXPECT_EQ(0, timer.GetElapsedSec()); - EXPECT_LE(230, timer.GetElapsedMs()); - EXPECT_GE(270, timer.GetElapsedMs()); + EXPECT_EQ(0U, timer.GetElapsedSec()); + EXPECT_LE(230U, timer.GetElapsedMs()); + EXPECT_GE(270U, timer.GetElapsedMs()); #ifdef OS_WIN ::Sleep(251); #else struct timespec ts2 = {0, 251000000}; nanosleep(&ts2, 0); #endif - EXPECT_EQ(1, timer.GetElapsedSec()); + EXPECT_EQ(1U, timer.GetElapsedSec()); } diff --git a/o3d/statsreport/metrics.cc b/o3d/statsreport/metrics.cc index 17dc3a1..b49202d 100644 --- a/o3d/statsreport/metrics.cc +++ b/o3d/statsreport/metrics.cc @@ -46,10 +46,14 @@ MetricCollectionBase g_global_metric_storage = { 0, 0 }; MetricCollection &g_global_metrics = *static_cast<MetricCollection*>(&g_global_metric_storage); +#ifdef OS_WIN #pragma warning(push) +#endif // C4640: construction of local static object is not thread-safe. // C4073: initializers put in library initialization area. +#ifdef OS_WIN #pragma warning(disable : 4640 4073) +#endif // Serialize all metric manipulation and access under this lock. #ifdef OS_WIN @@ -197,7 +201,7 @@ uint64 TimingMetric::average() const { uint64 ret = 0; if (0 == data_.count) { - DCHECK_EQ(0, data_.sum); + DCHECK_EQ(0U, data_.sum); } else { ret = data_.sum / data_.count; } diff --git a/o3d/statsreport/uploader_aggregation-mac.mm b/o3d/statsreport/uploader_aggregation-mac.mm index 5037f32..3db4800 100644 --- a/o3d/statsreport/uploader_aggregation-mac.mm +++ b/o3d/statsreport/uploader_aggregation-mac.mm @@ -116,11 +116,6 @@ static bool ReportMetrics(const char* extra_url_data, } void ResetPersistentMetrics() { - NSError *error = nil; - /* - [[NSFileManager defaultManager] removeItemAtPath:O3DStatsPath() - error:&error]; - */ [[NSFileManager defaultManager] removeFileAtPath:O3DStatsPath() handler:nil]; } diff --git a/o3d/tests/common/cross/test_utils.cc b/o3d/tests/common/cross/test_utils.cc index d34b28f..2a2a6af 100644 --- a/o3d/tests/common/cross/test_utils.cc +++ b/o3d/tests/common/cross/test_utils.cc @@ -58,7 +58,7 @@ uint8 *ReadFile(o3d::String file, size_t *data_size) { int bytes_read = fread(data, 1, file_size, fp); fclose(fp); - DCHECK_EQ(bytes_read, file_size); + DCHECK_EQ(static_cast<unsigned>(bytes_read), file_size); // Return file size and data if (data_size) *data_size = file_size; diff --git a/o3d/utils/cross/file_path_utils_test.cc b/o3d/utils/cross/file_path_utils_test.cc index ce96165..ac4d777 100644 --- a/o3d/utils/cross/file_path_utils_test.cc +++ b/o3d/utils/cross/file_path_utils_test.cc @@ -96,7 +96,7 @@ TEST_F(FilePathUtilsTest, AbsolutePathBasic) { FilePath test_path(FILE_PATH_LITERAL("this/is/a/path")); #endif FilePath abs_path = test_path; - bool result = AbsolutePath(&abs_path); + AbsolutePath(&abs_path); FilePath expected_result = cwd; expected_result = expected_result.Append(test_path); EXPECT_STREQ(expected_result.value().c_str(), abs_path.value().c_str()); @@ -109,7 +109,7 @@ TEST_F(FilePathUtilsTest, AbsolutePathAlreadyAbsolute) { FilePath test_path(FILE_PATH_LITERAL("/this/is/a/path")); #endif FilePath abs_path = test_path; - bool result = AbsolutePath(&abs_path); + AbsolutePath(&abs_path); EXPECT_STREQ(test_path.value().c_str(), abs_path.value().c_str()); } diff --git a/o3d/utils/cross/file_text_reader_test.cc b/o3d/utils/cross/file_text_reader_test.cc index 3bf1415..9b98c63 100644 --- a/o3d/utils/cross/file_text_reader_test.cc +++ b/o3d/utils/cross/file_text_reader_test.cc @@ -46,15 +46,15 @@ struct FileInfo { }; static const FileInfo kFileInfo[] = { - "/test_file_string_one", "testing 1..2..3", - "/test_file_string_two", "4..5..6", - "/test_file_string_lf", "testing 1..2..3\n4..5..6\n", - "/test_file_string_cr", "testing 1..2..3\r4..5..6\r", - "/test_file_string_crlf", "testing 1..2..3\r\n4..5..6\r\n", - "/test_file_string_lfcr", "testing 1..2..3\n\r4..5..6\n\r", - "/test_file_string_lflf", "testing 1..2..3\n\n4..5..6\n\n", - "/test_file_string_short", "T", - "/test_file_string_empty", "", + { "/test_file_string_one", "testing 1..2..3" }, + { "/test_file_string_two", "4..5..6" }, + { "/test_file_string_lf", "testing 1..2..3\n4..5..6\n" }, + { "/test_file_string_cr", "testing 1..2..3\r4..5..6\r" }, + { "/test_file_string_crlf", "testing 1..2..3\r\n4..5..6\r\n" }, + { "/test_file_string_lfcr", "testing 1..2..3\n\r4..5..6\n\r" }, + { "/test_file_string_lflf", "testing 1..2..3\n\n4..5..6\n\n" }, + { "/test_file_string_short", "T" }, + { "/test_file_string_empty", "" } }; static const int kNumFiles = arraysize(kFileInfo); @@ -119,7 +119,7 @@ class FileTextReaderTest : public testing::Test { TEST_F(FileTextReaderTest, StartAtBeginning) { FileTextReader reader(file_pointers_[0]); - EXPECT_EQ(0, reader.position()); + EXPECT_EQ(0U, reader.position()); EXPECT_EQ(file_pointers_[0], reader.input()); EXPECT_EQ(false, reader.IsAtEnd()); } @@ -127,42 +127,42 @@ TEST_F(FileTextReaderTest, StartAtBeginning) { TEST_F(FileTextReaderTest, TestPeekString) { FileTextReader reader(file_pointers_[0]); EXPECT_EQ(test_string_one_.substr(0, 6), reader.PeekString(6)); - EXPECT_EQ(0, reader.position()); + EXPECT_EQ(0U, reader.position()); EXPECT_EQ(false, reader.IsAtEnd()); } TEST_F(FileTextReaderTest, ReadsSingleCharacter) { FileTextReader reader(file_pointers_[0]); EXPECT_EQ(test_string_one_.substr(0, 1)[0], reader.ReadChar()); - EXPECT_EQ(1, reader.position()); + EXPECT_EQ(1U, reader.position()); EXPECT_EQ(false, reader.IsAtEnd()); EXPECT_EQ(test_string_one_.substr(1, 2), reader.PeekString(2)); - EXPECT_EQ(1, reader.position()); + EXPECT_EQ(1U, reader.position()); } TEST_F(FileTextReaderTest, ReadsMultipleCharacters) { FileTextReader reader(file_pointers_[0]); EXPECT_EQ(test_string_one_.substr(0, 1)[0], reader.ReadChar()); EXPECT_EQ(test_string_one_.substr(1, 1)[0], reader.ReadChar()); - EXPECT_EQ(2, reader.position()); + EXPECT_EQ(2U, reader.position()); EXPECT_EQ(false, reader.IsAtEnd()); EXPECT_EQ(test_string_one_.substr(2, 2), reader.PeekString(2)); - EXPECT_EQ(2, reader.position()); + EXPECT_EQ(2U, reader.position()); } TEST_F(FileTextReaderTest, ReadsFile) { FileTextReader reader(file_pointers_[0]); EXPECT_EQ(test_string_one_.substr(0, 7), reader.ReadString(7)); - EXPECT_EQ(7, reader.position()); + EXPECT_EQ(7U, reader.position()); EXPECT_EQ(false, reader.IsAtEnd()); EXPECT_EQ(test_string_one_.substr(7, 2), reader.PeekString(2)); - EXPECT_EQ(7, reader.position()); + EXPECT_EQ(7U, reader.position()); } TEST_F(FileTextReaderTest, EmptyFile) { FileTextReader reader(file_pointers_[8]); EXPECT_EQ("", reader.PeekString(1)); - EXPECT_EQ(0, reader.position()); + EXPECT_EQ(0U, reader.position()); EXPECT_EQ(true, reader.IsAtEnd()); EXPECT_EQ(0, reader.ReadChar()); EXPECT_EQ(true, reader.IsAtEnd()); @@ -171,7 +171,7 @@ TEST_F(FileTextReaderTest, EmptyFile) { TEST_F(FileTextReaderTest, TinyFile) { FileTextReader reader(file_pointers_[7]); EXPECT_EQ(test_string_short_.substr(0, 1), reader.PeekString(1)); - EXPECT_EQ(0, reader.position()); + EXPECT_EQ(0U, reader.position()); EXPECT_EQ(false, reader.IsAtEnd()); EXPECT_EQ(test_string_short_[0], reader.ReadChar()); EXPECT_EQ(true, reader.IsAtEnd()); diff --git a/o3d/utils/cross/string_reader_test.cc b/o3d/utils/cross/string_reader_test.cc index f2755be..742dc56 100644 --- a/o3d/utils/cross/string_reader_test.cc +++ b/o3d/utils/cross/string_reader_test.cc @@ -73,43 +73,43 @@ class StringReaderTest : public testing::Test { TEST_F(StringReaderTest, StartAtBeginning) { StringReader reader(test_string_one_); - EXPECT_EQ(0, reader.position()); + EXPECT_EQ(0U, reader.position()); EXPECT_EQ(test_string_one_, reader.input()); } TEST_F(StringReaderTest, TestPeekString) { StringReader reader(test_string_one_); EXPECT_EQ(test_string_one_.substr(0, 6), reader.PeekString(6)); - EXPECT_EQ(0, reader.position()); + EXPECT_EQ(0U, reader.position()); EXPECT_EQ(test_string_one_, reader.input()); } TEST_F(StringReaderTest, ReadsSingleCharacter) { StringReader reader(test_string_one_); EXPECT_EQ(test_string_one_.substr(0, 1)[0], reader.ReadChar()); - EXPECT_EQ(1, reader.position()); + EXPECT_EQ(1U, reader.position()); EXPECT_EQ(false, reader.IsAtEnd()); EXPECT_EQ(test_string_one_.substr(1, 2), reader.PeekString(2)); - EXPECT_EQ(1, reader.position()); + EXPECT_EQ(1U, reader.position()); } TEST_F(StringReaderTest, ReadsMultipleCharacters) { StringReader reader(test_string_one_); EXPECT_EQ(test_string_one_.substr(0, 1)[0], reader.ReadChar()); EXPECT_EQ(test_string_one_.substr(1, 1)[0], reader.ReadChar()); - EXPECT_EQ(2, reader.position()); + EXPECT_EQ(2U, reader.position()); EXPECT_EQ(false, reader.IsAtEnd()); EXPECT_EQ(test_string_one_.substr(2, 2), reader.PeekString(2)); - EXPECT_EQ(2, reader.position()); + EXPECT_EQ(2U, reader.position()); } TEST_F(StringReaderTest, ReadsString) { StringReader reader(test_string_one_); EXPECT_EQ(test_string_one_.substr(0, 7), reader.ReadString(7)); - EXPECT_EQ(7, reader.position()); + EXPECT_EQ(7U, reader.position()); EXPECT_EQ(false, reader.IsAtEnd()); EXPECT_EQ(test_string_one_.substr(7, 2), reader.PeekString(2)); - EXPECT_EQ(7, reader.position()); + EXPECT_EQ(7U, reader.position()); } TEST_F(StringReaderTest, ReadsToEnd) { |