Permalink
Browse files

Fix some implicit casting in ASP

I'm trying to stomp down some of the -Wconversion warnings that I've
been finding in VW.
  • Loading branch information...
1 parent 97f5e29 commit 99a56cc616f0bd619ded86ed85491ae43c591d5e Zack Moratto committed Oct 13, 2010
View
2 src/asp/Core/InpaintView.h
@@ -95,7 +95,7 @@ namespace inpaint_p {
}
// Iterate and apply convolution seperately to each channel
- for ( int c = 0; c < vw::PixelNumChannels<typename SourceT::pixel_type>::value;
+ for ( vw::uint32 c = 0; c < vw::PixelNumChannels<typename SourceT::pixel_type>::value;
c++ )
for ( int d = 0; d < 10*max_distance*max_distance; d++ )
for ( std::list<vw::Vector2i>::const_iterator iter = processing_order.begin();
View
6 src/asp/Core/tests/TestBlobIndexThreaded.cxx
@@ -17,19 +17,19 @@ TEST(BlobIndexThreaded, TestImage1) {
DiskImageView<PixelGray<uint8> > input("ThreadTest1.tif");
EXPECT_EQ( 20, input.cols() );
BlobIndexThreaded bindex( create_mask(input,255), 1000, 10 );
- EXPECT_EQ( 2, bindex.num_blobs() );
+ EXPECT_EQ( 2u, bindex.num_blobs() );
}
TEST(BlobIndexThreaded, TestImage2) {
DiskImageView<PixelGray<uint8> > input("ThreadTest2.tif");
EXPECT_EQ( 10, input.cols() );
BlobIndexThreaded bindex( create_mask(input,255), 1000, 5 );
- EXPECT_EQ( 1, bindex.num_blobs() );
+ EXPECT_EQ( 1u, bindex.num_blobs() );
}
TEST(BlobIndexThreaded, TestImage3) {
DiskImageView<PixelGray<uint8> > input("ThreadTest3.tif");
EXPECT_EQ( 10, input.cols() );
BlobIndexThreaded bindex( create_mask(input,255), 1000, 5 );
- EXPECT_EQ( 2, bindex.num_blobs() );
+ EXPECT_EQ( 2u, bindex.num_blobs() );
}
View
2 src/asp/Core/tests/TestErodeView.cxx
@@ -20,7 +20,7 @@ TEST(ErodeView, basic_test) {
EXPECT_TRUE( is_valid(test(1,1)) );
BlobIndexThreaded bindex( test, 100 );
- EXPECT_EQ( 1, bindex.num_blobs() );
+ EXPECT_EQ( 1u, bindex.num_blobs() );
ImageViewRef<PixelMask<uint8> > erode_ref =
ErodeView<ImageView<PixelMask<uint8> > >( test, bindex );
View
10 src/asp/IsisIO/tests/TestEphemerisEquations.cxx
@@ -17,7 +17,7 @@ double DELTA = 1e-6;
TEST(EphemerisEquations, polynomial_equal_order) {
PolyEquation poly(0);
- EXPECT_EQ( poly.size(), 3 );
+ EXPECT_EQ( poly.size(), 3u );
EXPECT_EQ( poly.type(), "PolyEquation" );
poly[0] = 10;
poly[1] = 1;
@@ -38,7 +38,7 @@ TEST(EphemerisEquations, polynomial_equal_order) {
EXPECT_EQ( 20, test[2] );
PolyEquation poly2(1);
- EXPECT_EQ( poly2.size(), 6 );
+ EXPECT_EQ( poly2.size(), 6u );
poly2[0] = 10; poly2[1] = 0.5;
poly2[2] = 5; poly2[3] = -0.5;
poly2[4] = 0; poly2[5] = 6;
@@ -51,7 +51,7 @@ TEST(EphemerisEquations, polynomial_equal_order) {
TEST(EphemerisEquations, polynomial_variable_order) {
PolyEquation poly(0,2,1);
- EXPECT_EQ( 6, poly.size() );
+ EXPECT_EQ( 6u, poly.size() );
EXPECT_EQ( poly.type(), "PolyEquation" );
poly[0] = 11;
poly[1] = -5; poly[2] = 0.6; poly[3] = .1;
@@ -77,7 +77,7 @@ TEST(EphemerisEquations, polynomial_defined_const) {
PolyEquation poly(x_coeff,
y_coeff,
z_coeff);
- EXPECT_EQ( 6, poly.size() );
+ EXPECT_EQ( 6u, poly.size() );
EXPECT_EQ( poly.type(), "PolyEquation" );
EXPECT_EQ( -5, poly[1] );
@@ -92,7 +92,7 @@ TEST(EphemerisEquations, reversepolish) {
std::string y_eq("t sin 4 * t +");
std::string z_eq("t t 2 * * 5 t / - abs");
RPNEquation rpn( x_eq, y_eq, z_eq );
- EXPECT_EQ( 5, rpn.size() );
+ EXPECT_EQ( 5u, rpn.size() );
EXPECT_EQ( "RPNEquation", rpn.type() );
Vector3 test = rpn(-1.5);
View
2 src/asp/Sessions/ISIS/StereoSessionIsis.h
@@ -102,7 +102,7 @@ class IsisSpecialPixelFunc: public vw::UnaryReturnSameType {
PixelT operator() (PixelT const& pix) const {
typedef typename CompoundChannelType<PixelT>::type channel_type;
typedef Helper<channel_type, void> help;
- for (int n = 0; n < CompoundNumChannels<PixelT>::value; ++n) {
+ for (size_t n = 0; n < CompoundNumChannels<PixelT>::value; ++n) {
if (help::IsSpecial(compound_select_channel<const channel_type&>(pix,n)))
if (help::IsHighPixel(compound_select_channel<const channel_type&>(pix,n)))
return m_replacement_high;
View
2 src/asp/Tools/point2dem.cc
@@ -228,7 +228,7 @@ int main( int argc, char *argv[] ) {
// average location of the points. If the average location has a
// negative x value (think in ECEF coordinates) then we should
// be using [0,360].
- int subsample_amt = norm_2(Vector2(point_image.cols(),point_image.rows())) / 1024;
+ int subsample_amt = norm_2(Vector2i(point_image.cols(),point_image.rows())) / 1024;
if (subsample_amt < 1 ) subsample_amt = 1;
Vector3 avg_location =
mean_pixel_value(subsample(point_image, subsample_amt));
View
6 src/asp/Tools/stereo_filtering.h
@@ -191,12 +191,12 @@ namespace vw {
// and greater than or equal to 64 px;
int previous_num_threads = vw_settings().default_num_threads();
int sub_threads = vw_settings().default_num_threads() + 1;
- int tile_power = 0;
+ uint32 tile_power = 0;
while ( tile_power < 6 && sub_threads > 1) {
sub_threads--;
- tile_power = int( log10(500e6*sub_scale*sub_scale/(4.0*float(sub_threads)))/(2*log10(2)));
+ tile_power = uint32( log10(500e6*sub_scale*sub_scale/(4.0*float(sub_threads)))/(2*log10(2)));
}
- int sub_tile_size = int ( pow(2., tile_power) );
+ uint32 sub_tile_size = 1 << tile_power;
if ( sub_tile_size > vw_settings().default_tile_size() )
sub_tile_size = vw_settings().default_tile_size();
View
2 src/asp/Tools/stereo_preprocessing.h
@@ -69,7 +69,7 @@ namespace vw {
sub_threads--;
tile_power = int( log10(500e6*sub_scale*sub_scale/(4.0*float(sub_threads)))/(2*log10(2)));
}
- int sub_tile_size = int ( pow(2., tile_power) );
+ uint32 sub_tile_size = 1u << tile_power;
if ( sub_tile_size > vw_settings().default_tile_size() )
sub_tile_size = vw_settings().default_tile_size();

0 comments on commit 99a56cc

Please sign in to comment.