cplusplus: fix for loop sizes
Array indeces are pointers and should use pointer sizes. Signed-off-by: Rosen Penev <rosenp@gmail.com>
This commit is contained in:
parent
3732751bf9
commit
63f64c5055
@ -64,7 +64,7 @@ to_vectorv( int n, ... )
|
||||
va_list ap;
|
||||
|
||||
va_start( ap, n );
|
||||
for( int i = 0; i < n; i++ )
|
||||
for( std::vector<double>::size_type i = 0; i < size_t(n); i++ )
|
||||
vector[i] = va_arg( ap, double );
|
||||
va_end( ap );
|
||||
|
||||
@ -82,7 +82,7 @@ to_vector( int n, double array[] )
|
||||
{
|
||||
std::vector<double> vector( n );
|
||||
|
||||
for( int i = 0; i < n; i++ )
|
||||
for( std::vector<double>::size_type i = 0; i < size_t(n); i++ )
|
||||
vector[i] = array[i];
|
||||
|
||||
return( vector );
|
||||
@ -93,7 +93,7 @@ negate( std::vector<double> vector )
|
||||
{
|
||||
std::vector<double> new_vector( vector.size() );
|
||||
|
||||
for( unsigned int i = 0; i < vector.size(); i++ )
|
||||
for( std::vector<double>::size_type i = 0; i < vector.size(); i++ )
|
||||
new_vector[i] = vector[i] * -1;
|
||||
|
||||
return( new_vector );
|
||||
@ -104,7 +104,7 @@ invert( std::vector<double> vector )
|
||||
{
|
||||
std::vector<double> new_vector( vector.size() );
|
||||
|
||||
for( unsigned int i = 0; i < vector.size(); i++ )
|
||||
for( std::vector<double>::size_type i = 0; i < vector.size(); i++ )
|
||||
new_vector[i] = 1.0 / vector[i];
|
||||
|
||||
return( new_vector );
|
||||
@ -210,7 +210,6 @@ VOption::set( const char *name, std::vector<int> value )
|
||||
Pair *pair = new Pair( name );
|
||||
|
||||
int *array;
|
||||
unsigned int i;
|
||||
|
||||
pair->input = true;
|
||||
|
||||
@ -219,7 +218,7 @@ VOption::set( const char *name, std::vector<int> value )
|
||||
static_cast< int >( value.size() ) );
|
||||
array = vips_value_get_array_int( &pair->value, NULL );
|
||||
|
||||
for( i = 0; i < value.size(); i++ )
|
||||
for( std::vector<double>::size_type i = 0; i < value.size(); i++ )
|
||||
array[i] = value[i];
|
||||
|
||||
options.push_back( pair );
|
||||
@ -234,7 +233,6 @@ VOption::set( const char *name, std::vector<double> value )
|
||||
Pair *pair = new Pair( name );
|
||||
|
||||
double *array;
|
||||
unsigned int i;
|
||||
|
||||
pair->input = true;
|
||||
|
||||
@ -243,7 +241,7 @@ VOption::set( const char *name, std::vector<double> value )
|
||||
static_cast< int >( value.size() ) );
|
||||
array = vips_value_get_array_double( &pair->value, NULL );
|
||||
|
||||
for( i = 0; i < value.size(); i++ )
|
||||
for( std::vector<double>::size_type i = 0; i < value.size(); i++ )
|
||||
array[i] = value[i];
|
||||
|
||||
options.push_back( pair );
|
||||
@ -258,7 +256,6 @@ VOption::set( const char *name, std::vector<VImage> value )
|
||||
Pair *pair = new Pair( name );
|
||||
|
||||
VipsImage **array;
|
||||
unsigned int i;
|
||||
|
||||
pair->input = true;
|
||||
|
||||
@ -267,7 +264,7 @@ VOption::set( const char *name, std::vector<VImage> value )
|
||||
static_cast< int >( value.size() ) );
|
||||
array = vips_value_get_array_image( &pair->value, NULL );
|
||||
|
||||
for( i = 0; i < value.size(); i++ ) {
|
||||
for( std::vector<double>::size_type i = 0; i < value.size(); i++ ) {
|
||||
VipsImage *vips_image = value[i].get_image();
|
||||
|
||||
array[i] = vips_image;
|
||||
@ -488,10 +485,8 @@ VOption::get_operation( VipsOperation *operation )
|
||||
double *array =
|
||||
vips_value_get_array_double( value,
|
||||
&length );
|
||||
int j;
|
||||
|
||||
((*i)->vvector)->resize( length );
|
||||
for( j = 0; j < length; j++ )
|
||||
for( size_t j = 0; j < length; j++ )
|
||||
(*((*i)->vvector))[j] = array[j];
|
||||
}
|
||||
else if( type == VIPS_TYPE_BLOB ) {
|
||||
|
Loading…
Reference in New Issue
Block a user