+ use assignment op to initialize built-in types.

This commit is contained in:
Dane Springmeyer 2012-07-24 14:20:57 -07:00
parent ec12d02209
commit 25a7c6bc01
3 changed files with 27 additions and 24 deletions

View file

@ -39,7 +39,7 @@ namespace mapnik
template <typename T> template <typename T>
bool clip_test(T p,T q,double& tmin,double& tmax) bool clip_test(T p,T q,double& tmin,double& tmax)
{ {
double r(0); double r = 0;
bool result=true; bool result=true;
if (p<0.0) if (p<0.0)
{ {
@ -96,8 +96,8 @@ inline bool point_inside_path(double x,double y,Iter start,Iter end)
double x0=boost::get<0>(*start); double x0=boost::get<0>(*start);
double y0=boost::get<1>(*start); double y0=boost::get<1>(*start);
double x1(0); double x1 = 0;
double y1(0); double y1 = 0;
while (++start!=end) while (++start!=end)
{ {
if ( boost::get<2>(*start) == SEG_MOVETO) if ( boost::get<2>(*start) == SEG_MOVETO)
@ -174,8 +174,8 @@ inline bool point_on_path(double x,double y,Iter start,Iter end, double tol)
{ {
double x0=boost::get<0>(*start); double x0=boost::get<0>(*start);
double y0=boost::get<1>(*start); double y0=boost::get<1>(*start);
double x1(0); double x1 = 0;
double y1(0); double y1 = 0;
while (++start != end) while (++start != end)
{ {
if ( boost::get<2>(*start) == SEG_MOVETO) if ( boost::get<2>(*start) == SEG_MOVETO)
@ -224,10 +224,10 @@ struct filter_at_point
template <typename PathType> template <typename PathType>
double path_length(PathType & path) double path_length(PathType & path)
{ {
double x0(0); double x0 = 0;
double y0(0); double y0 = 0;
double x1(0); double x1 = 0;
double y1(0); double y1 = 0;
path.rewind(0); path.rewind(0);
unsigned command = path.vertex(&x0,&y0); unsigned command = path.vertex(&x0,&y0);
if (command == SEG_END) return 0; if (command == SEG_END) return 0;
@ -244,10 +244,10 @@ double path_length(PathType & path)
template <typename PathType> template <typename PathType>
bool middle_point(PathType & path, double & x, double & y) bool middle_point(PathType & path, double & x, double & y)
{ {
double x0(0); double x0 = 0;
double y0(0); double y0 = 0;
double x1(0); double x1 = 0;
double y1(0); double y1 = 0;
double mid_length = 0.5 * path_length(path); double mid_length = 0.5 * path_length(path);
path.rewind(0); path.rewind(0);
unsigned command = path.vertex(&x0,&y0); unsigned command = path.vertex(&x0,&y0);
@ -334,10 +334,10 @@ template <typename PathType>
bool hit_test(PathType & path, double x, double y, double tol) bool hit_test(PathType & path, double x, double y, double tol)
{ {
bool inside=false; bool inside=false;
double x0(0); double x0 = 0;
double y0(0); double y0 = 0;
double x1(0); double x1 = 0;
double y1(0); double y1 = 0;
path.rewind(0); path.rewind(0);
unsigned command = path.vertex(&x0, &y0); unsigned command = path.vertex(&x0, &y0);
if (command == SEG_END) return false; if (command == SEG_END) return false;

View file

@ -88,8 +88,8 @@ public:
box2d<double> envelope() const box2d<double> envelope() const
{ {
box2d<double> result; box2d<double> result;
double x(0); double x = 0;
double y(0); double y = 0;
rewind(0); rewind(0);
for (unsigned i=0;i<size();++i) for (unsigned i=0;i<size();++i)
{ {

View file

@ -45,15 +45,18 @@ static inline void scale_grid(mapnik::grid::data_type & target,
if (source_width<1 || source_height<1 || if (source_width<1 || source_height<1 ||
target_width<1 || target_height<1) return; target_width<1 || target_height<1) return;
int x=0,y=0,xs=0,ys=0; int x = 0;
int y = 0;
int xs = 0;
int ys = 0;
int tw2 = target_width/2; int tw2 = target_width/2;
int th2 = target_height/2; int th2 = target_height/2;
int offs_x = rint((source_width-target_width-x_off_f*2*source_width)/2); int offs_x = rint((source_width-target_width-x_off_f*2*source_width)/2);
int offs_y = rint((source_height-target_height-y_off_f*2*source_height)/2); int offs_y = rint((source_height-target_height-y_off_f*2*source_height)/2);
unsigned yprt(0); unsigned yprt = 0;
unsigned yprt1(0); unsigned yprt1 = 0;
unsigned xprt(0); unsigned xprt = 0;
unsigned xprt1(0); unsigned xprt1 = 0;
//no scaling or subpixel offset //no scaling or subpixel offset
if (target_height == source_height && target_width == source_width && offs_x == 0 && offs_y == 0){ if (target_height == source_height && target_width == source_width && offs_x == 0 && offs_y == 0){