From 3d1ee0cf130d1c3dd76f9df4db1b5986ea7f69d6 Mon Sep 17 00:00:00 2001 From: Marc Glisse Date: Sun, 26 Feb 2006 00:25:19 +0000 Subject: [PATCH] Missing std:: --- Core/src/Core/Real.cpp | 13 +++++----- Core/src/Core/extLong.cpp | 2 +- .../test/Polynomial_kernel/numeric_solvers.C | 2 +- Map_overlay_2/test/Boolean_operations/test.C | 3 ++- Nef_S2/src/CGALQt/Qt_widget_OpenGL.C | 3 ++- Snap_rounding_2/test/Snap_rounding_2/test.C | 7 +++--- .../Nearest_neighbor_searching.C | 3 ++- .../Using_fair_splitting_rule.C | 3 ++- .../CGAL/Weighted_Minkowski_distance.h | 24 +++++++++---------- .../test/Stream_lines_2/Stream_line.C | 5 ++-- kdtree/examples/kdtrees/example1.C | 3 ++- kdtree/examples/kdtrees/example2.C | 5 ++-- kdtree/examples/kdtrees/example3.C | 5 ++-- 13 files changed, 44 insertions(+), 34 deletions(-) diff --git a/Core/src/Core/Real.cpp b/Core/src/Core/Real.cpp index 62372096867..d791828d642 100644 --- a/Core/src/Core/Real.cpp +++ b/Core/src/Core/Real.cpp @@ -35,6 +35,7 @@ ***************************************************************************/ #include +#include #if defined (__BORLANDC__) #include #endif @@ -119,19 +120,19 @@ void Real::constructFromString(const char *str, const extLong& prec ) // Moreover, the value of prec is ignored (basically // assumed to be infinity). - if (strchr(str, '/') != NULL) { // this is a rational number + if (std::strchr(str, '/') != NULL) { // this is a rational number rep = new RealBigRat(BigRat(str)); return; } - const char *e = strchr(str, 'e'); + const char *e = std::strchr(str, 'e'); int dot = 0; long e10 = 0; if (e != NULL) - e10 = atol(e+1); // e10 is decimal precision of the input string + e10 = std::atol(e+1); // e10 is decimal precision of the input string // i.e., input is A/10^{e10}. else { - e = str + strlen(str); + e = str + std::strlen(str); #ifdef CORE_DEBUG assert(*e == '\0'); #endif @@ -225,7 +226,7 @@ std::istream& operator >>(std::istream& i, Real& x) { if (p - str == size) { char *t = str; str = new char[size*2]; - memcpy(str, t, size); + std::memcpy(str, t, size); delete [] t; p = str + size; size *= 2; @@ -251,7 +252,7 @@ std::istream& operator >>(std::istream& i, Real& x) { int len = p - str; char *t = str; str = new char[len + 1]; - memcpy(str, t, len); + std::memcpy(str, t, len); delete [] t; p = str + len; } diff --git a/Core/src/Core/extLong.cpp b/Core/src/Core/extLong.cpp index 2f3d38cab8a..ab13eee69d7 100644 --- a/Core/src/Core/extLong.cpp +++ b/Core/src/Core/extLong.cpp @@ -118,7 +118,7 @@ extLong& extLong::operator*= (const extLong& y) { } else { // flag == 0 and y.flag == 0 double d = double(val) * double(y.val); long p = val * y.val; - if (fabs(d - p) <= fabs(d) * relEps) { + if (std::fabs(d - p) <= std::fabs(d) * relEps) { val = p; flag = 0; } else if (d > EXTLONG_MAX) { diff --git a/Kinetic_data_structures/test/Polynomial_kernel/numeric_solvers.C b/Kinetic_data_structures/test/Polynomial_kernel/numeric_solvers.C index ee3a769ef04..2c7432baf39 100644 --- a/Kinetic_data_structures/test/Polynomial_kernel/numeric_solvers.C +++ b/Kinetic_data_structures/test/Polynomial_kernel/numeric_solvers.C @@ -22,7 +22,7 @@ int main(int argc, char* argv[]) { //assert(std::numeric_limits::has_infinity()); if ( argc > 1 ) { - int is_verbose = atoi(argv[1]); + int is_verbose = std::atoi(argv[1]); if ( is_verbose == 0 ) { verbose = false; } else verbose = true; diff --git a/Map_overlay_2/test/Boolean_operations/test.C b/Map_overlay_2/test/Boolean_operations/test.C index 52b0b6edbe2..7303780878c 100755 --- a/Map_overlay_2/test/Boolean_operations/test.C +++ b/Map_overlay_2/test/Boolean_operations/test.C @@ -27,6 +27,7 @@ #include #include #include +#include // Making sure test doesn't fail if LEDA is not installed #if ! defined(CGAL_USE_LEDA) && \ @@ -949,7 +950,7 @@ int main(int argc, char* argv[]) if (argc < 1 || argc > 2) { std::cout << "usage: test data_file" << std::endl; - exit(1); + std::exit(1); } test.start(argv[1]); diff --git a/Nef_S2/src/CGALQt/Qt_widget_OpenGL.C b/Nef_S2/src/CGALQt/Qt_widget_OpenGL.C index 94ab5a8077f..a0a19f573ab 100644 --- a/Nef_S2/src/CGALQt/Qt_widget_OpenGL.C +++ b/Nef_S2/src/CGALQt/Qt_widget_OpenGL.C @@ -25,6 +25,7 @@ #ifdef CGAL_USE_QT #include +#include namespace CGAL { @@ -88,7 +89,7 @@ void Qt_widget_OpenGL::mouseMoveEvent(QMouseEvent* event) { int y = event->y(); switch ( interaction) { case SCALE: - s *= exp( (x - mouse_x + mouse_y -y) * factor_s ); + s *= std::exp( (x - mouse_x + mouse_y -y) * factor_s ); break; case ROTATE: { double old_x = 1.2 * (mouse_x - window_width/2) / window_radius; diff --git a/Snap_rounding_2/test/Snap_rounding_2/test.C b/Snap_rounding_2/test/Snap_rounding_2/test.C index 837ed34394f..75934165fd1 100644 --- a/Snap_rounding_2/test/Snap_rounding_2/test.C +++ b/Snap_rounding_2/test/Snap_rounding_2/test.C @@ -3,6 +3,7 @@ #include #include #include +#include typedef CGAL::Quotient Number_Type; typedef CGAL::Cartesian Rep; @@ -18,14 +19,14 @@ void read_data(int argc,char *argv[],Number_Type &prec,std::list &seg if(argc != 2) { std::cerr << "syntex: test \n"; - exit(1); + std::exit(1); } std::ifstream is(argv[1]); if(is.bad()) { std::cerr << "Bad input file : " << argv[1] << std::endl; - exit(1); + std::exit(1); } is >> number_of_segments; @@ -34,7 +35,7 @@ void read_data(int argc,char *argv[],Number_Type &prec,std::list &seg if(number_of_segments < 1) { std::cerr << "Bad input file(number of segments)" << argv[1] << std::endl; - exit(1); + std::exit(1); } for(i = 0;i < number_of_segments;++i) { diff --git a/Spatial_searching/examples/Spatial_searching/Nearest_neighbor_searching.C b/Spatial_searching/examples/Spatial_searching/Nearest_neighbor_searching.C index 597b7dc0d27..2117db5c0ba 100755 --- a/Spatial_searching/examples/Spatial_searching/Nearest_neighbor_searching.C +++ b/Spatial_searching/examples/Spatial_searching/Nearest_neighbor_searching.C @@ -5,6 +5,7 @@ #include #include #include +#include typedef CGAL::Simple_cartesian K; @@ -30,7 +31,7 @@ int main() { // report the N nearest neighbors and their distance // This should sort all N points by increasing distance from origin for(Neighbor_search::iterator it = search.begin(); it != search.end(); ++it){ - std::cout << it->first << " "<< sqrt(it->second) << std::endl; + std::cout << it->first << " "<< std::sqrt(it->second) << std::endl; } diff --git a/Spatial_searching/examples/Spatial_searching/Using_fair_splitting_rule.C b/Spatial_searching/examples/Spatial_searching/Using_fair_splitting_rule.C index 92dd14dc648..0b1d289c434 100755 --- a/Spatial_searching/examples/Spatial_searching/Using_fair_splitting_rule.C +++ b/Spatial_searching/examples/Spatial_searching/Using_fair_splitting_rule.C @@ -4,6 +4,7 @@ #include #include #include +#include typedef CGAL::Simple_cartesian R; typedef R::Point_2 Point_d; @@ -34,7 +35,7 @@ int main() { // report the N nearest neighbors and their distance // This should sort all N points by increasing distance from origin for(Neighbor_search::iterator it = search.begin(); it != search.end(); ++it){ - std::cout << it->first << " "<< sqrt(it->second) << std::endl; + std::cout << it->first << " "<< std::sqrt(it->second) << std::endl; } return 0; } diff --git a/Spatial_searching/include/CGAL/Weighted_Minkowski_distance.h b/Spatial_searching/include/CGAL/Weighted_Minkowski_distance.h index e0a60616946..da7d7543982 100644 --- a/Spatial_searching/include/CGAL/Weighted_Minkowski_distance.h +++ b/Spatial_searching/include/CGAL/Weighted_Minkowski_distance.h @@ -102,13 +102,13 @@ namespace CGAL { pit = construct_it(p); if (power == FT(0)) { for (unsigned int i = 0; qit != qe; ++qit, ++i) - if (the_weights[i] * fabs((*qit) - (*pit)) > distance) - distance = the_weights[i] * fabs((*qit)-(*pit)); + if (the_weights[i] * std::fabs((*qit) - (*pit)) > distance) + distance = the_weights[i] * std::fabs((*qit)-(*pit)); } else for (unsigned int i = 0; qit != qe; ++qit, ++i) distance += - the_weights[i] * pow(fabs((*qit)-(*pit)),power); + the_weights[i] * std::pow(std::fabs((*qit)-(*pit)),power); return distance; } @@ -139,10 +139,10 @@ namespace CGAL { for (unsigned int i = 0; qit != qe; ++qit, ++i) { if ((*qit) < r.min_coord(i)) distance += the_weights[i] * - pow(r.min_coord(i)-(*qit),power); + std::pow(r.min_coord(i)-(*qit),power); if ((*qit) > r.max_coord(i)) distance += the_weights[i] * - pow((*qit)-r.max_coord(i),power); + std::pow((*qit)-r.max_coord(i),power); } }; return distance; @@ -175,9 +175,9 @@ namespace CGAL { { for (unsigned int i = 0; qit != qe; ++qit, ++i) { if ((*qit) <= (r.min_coord(i)+r.max_coord(i))/FT(2.0)) - distance += the_weights[i] * pow(r.max_coord(i)-(*qit),power); + distance += the_weights[i] * std::pow(r.max_coord(i)-(*qit),power); else - distance += the_weights[i] * pow((*qit)-r.min_coord(i),power); + distance += the_weights[i] * std::pow((*qit)-r.min_coord(i),power); } }; return distance; @@ -191,16 +191,16 @@ namespace CGAL { FT new_dist; if (power == FT(0)) { - if (the_weights[cutting_dimension]*fabs(new_off) + if (the_weights[cutting_dimension]*std::fabs(new_off) > dist) new_dist= - the_weights[cutting_dimension]*fabs(new_off); + the_weights[cutting_dimension]*std::fabs(new_off); else new_dist=dist; } else { new_dist = dist + the_weights[cutting_dimension] * - (pow(fabs(new_off),power)-pow(fabs(old_off),power)); + (std::pow(std::fabs(new_off),power)-std::pow(std::fabs(old_off),power)); } return new_dist; } @@ -210,7 +210,7 @@ namespace CGAL { transformed_distance(FT d) const { if (power <= FT(0)) return d; - else return pow(d,power); + else return std::pow(d,power); } @@ -219,7 +219,7 @@ namespace CGAL { inverse_of_transformed_distance(FT d) const { if (power <= FT(0)) return d; - else return pow(d,1/power); + else return std::pow(d,1/power); } diff --git a/Stream_lines_2/test/Stream_lines_2/Stream_line.C b/Stream_lines_2/test/Stream_lines_2/Stream_line.C index 0cfe0f3f815..e4694590f61 100644 --- a/Stream_lines_2/test/Stream_lines_2/Stream_line.C +++ b/Stream_lines_2/test/Stream_lines_2/Stream_line.C @@ -1,5 +1,6 @@ #include #include +#include #include #include @@ -25,9 +26,9 @@ int main() if (i!=11 && i!=12 && i!=17 && i!=18 && i!=20 && i!=21) { char name[80]; - sprintf(name, "data/%d.vec.cin", i); + std::sprintf(name, "data/%d.vec.cin", i); char namer[80]; - sprintf(namer, "data/%d.stl", i); + std::sprintf(namer, "data/%d.stl", i); std::ifstream infile(name, std::ios::in); double iXSize, iYSize; unsigned int x_samples, y_samples; diff --git a/kdtree/examples/kdtrees/example1.C b/kdtree/examples/kdtrees/example1.C index fec51467494..057a247b1c8 100644 --- a/kdtree/examples/kdtrees/example1.C +++ b/kdtree/examples/kdtrees/example1.C @@ -19,6 +19,7 @@ #include #include #include +#include #include #include @@ -35,7 +36,7 @@ int main() CGAL::Kdtree_d tree(2); points_list l, res; - srand( (unsigned)time(NULL) ); + std::srand( (unsigned)time(NULL) ); std::cout << "Insering evenly 81 points in the square (0,0)-(10,10) ...\n\n"; for (int i=1; i<10; i++) diff --git a/kdtree/examples/kdtrees/example2.C b/kdtree/examples/kdtrees/example2.C index 346da0fa900..00b49d1c74c 100644 --- a/kdtree/examples/kdtrees/example2.C +++ b/kdtree/examples/kdtrees/example2.C @@ -19,6 +19,7 @@ #include #include #include +#include #include #include @@ -38,7 +39,7 @@ typedef std::list points_list; inline double dblRand( void ) { - return (double)rand() / (double)RAND_MAX; + return (double)std::rand() / (double)RAND_MAX; } void random_points( int num, points_list &l ) @@ -59,7 +60,7 @@ int main() { CGAL::Kdtree_d tree(3); - srand( (unsigned)time(NULL) ); + std::srand( (unsigned)time(NULL) ); std::cout << "Choosing randomly 30 points in the cube (0,0,0)-(10,10,10)\n" ; diff --git a/kdtree/examples/kdtrees/example3.C b/kdtree/examples/kdtrees/example3.C index 33dbc5157ee..b104c29c853 100644 --- a/kdtree/examples/kdtrees/example3.C +++ b/kdtree/examples/kdtrees/example3.C @@ -20,6 +20,7 @@ #include #include #include +#include #include #include @@ -90,7 +91,7 @@ typedef std::list points_list; inline double dblRand( void ) { - return (double)rand() / (double)RAND_MAX; + return (double)std::rand() / (double)RAND_MAX; } void random_points( int num, points_list &l, int DIM) @@ -113,7 +114,7 @@ int main() { CGAL::Kdtree_d tree(3); - srand( (unsigned)time(NULL) ); + std::srand( (unsigned)time(NULL) ); std::cout << "Choosing randomly 30 points in the cube (0,0,0)-(10,10,10)\n" ;