comparison UnitTestsSources/PngTests.cpp @ 1492:9f66a12eb8fc

fix warnings for gcc 5
author jodogne
date Tue, 04 Aug 2015 14:47:35 +0200
parents 6e7e5ed91c2d
children
comparison
equal deleted inserted replaced
1491:e460341872dc 1492:9f66a12eb8fc
120 } 120 }
121 121
122 TEST(PngWriter, EndToEnd) 122 TEST(PngWriter, EndToEnd)
123 { 123 {
124 Orthanc::PngWriter w; 124 Orthanc::PngWriter w;
125 int width = 256; 125 unsigned int width = 256;
126 int height = 256; 126 unsigned int height = 256;
127 int pitch = width * 2 + 16; 127 unsigned int pitch = width * 2 + 16;
128 128
129 std::vector<uint8_t> image(height * pitch); 129 std::vector<uint8_t> image(height * pitch);
130 130
131 int v = 0; 131 int v = 0;
132 for (int y = 0; y < height; y++) 132 for (unsigned int y = 0; y < height; y++)
133 { 133 {
134 uint16_t *p = reinterpret_cast<uint16_t*>(&image[0] + y * pitch); 134 uint16_t *p = reinterpret_cast<uint16_t*>(&image[0] + y * pitch);
135 for (int x = 0; x < width; x++, p++, v++) 135 for (unsigned int x = 0; x < width; x++, p++, v++)
136 { 136 {
137 *p = v; 137 *p = v;
138 } 138 }
139 } 139 }
140 140
148 ASSERT_EQ(r.GetFormat(), Orthanc::PixelFormat_Grayscale16); 148 ASSERT_EQ(r.GetFormat(), Orthanc::PixelFormat_Grayscale16);
149 ASSERT_EQ(r.GetWidth(), width); 149 ASSERT_EQ(r.GetWidth(), width);
150 ASSERT_EQ(r.GetHeight(), height); 150 ASSERT_EQ(r.GetHeight(), height);
151 151
152 v = 0; 152 v = 0;
153 for (int y = 0; y < height; y++) 153 for (unsigned int y = 0; y < height; y++)
154 { 154 {
155 const uint16_t *p = reinterpret_cast<const uint16_t*>((const uint8_t*) r.GetConstBuffer() + y * r.GetPitch()); 155 const uint16_t *p = reinterpret_cast<const uint16_t*>((const uint8_t*) r.GetConstBuffer() + y * r.GetPitch());
156 ASSERT_EQ(p, r.GetConstRow(y)); 156 ASSERT_EQ(p, r.GetConstRow(y));
157 for (int x = 0; x < width; x++, p++, v++) 157 for (unsigned int x = 0; x < width; x++, p++, v++)
158 { 158 {
159 ASSERT_EQ(*p, v); 159 ASSERT_EQ(*p, v);
160 } 160 }
161 } 161 }
162 } 162 }
171 ASSERT_EQ(r2.GetFormat(), Orthanc::PixelFormat_Grayscale16); 171 ASSERT_EQ(r2.GetFormat(), Orthanc::PixelFormat_Grayscale16);
172 ASSERT_EQ(r2.GetWidth(), width); 172 ASSERT_EQ(r2.GetWidth(), width);
173 ASSERT_EQ(r2.GetHeight(), height); 173 ASSERT_EQ(r2.GetHeight(), height);
174 174
175 v = 0; 175 v = 0;
176 for (int y = 0; y < height; y++) 176 for (unsigned int y = 0; y < height; y++)
177 { 177 {
178 const uint16_t *p = reinterpret_cast<const uint16_t*>((const uint8_t*) r2.GetConstBuffer() + y * r2.GetPitch()); 178 const uint16_t *p = reinterpret_cast<const uint16_t*>((const uint8_t*) r2.GetConstBuffer() + y * r2.GetPitch());
179 ASSERT_EQ(p, r2.GetConstRow(y)); 179 ASSERT_EQ(p, r2.GetConstRow(y));
180 for (int x = 0; x < width; x++, p++, v++) 180 for (unsigned int x = 0; x < width; x++, p++, v++)
181 { 181 {
182 ASSERT_EQ(*p, v); 182 ASSERT_EQ(*p, v);
183 } 183 }
184 } 184 }
185 } 185 }