Don't rely on the implicit conversion QString -> const char*.

Don't do it on temporaries.
stddef.h missing in qt3 headers.
This commit is contained in:
Marc Glisse 2010-07-12 10:02:56 +00:00
parent fc1d114c3e
commit e54d65ec06
8 changed files with 20 additions and 18 deletions

View File

@ -403,7 +403,7 @@ private slots:
QFileDialog::getSaveFileName( "triangulation.cgal", QFileDialog::getSaveFileName( "triangulation.cgal",
"Cgal files (*.cgal)", this ); "Cgal files (*.cgal)", this );
if ( !fileName.isNull() ) { // got a file name if ( !fileName.isNull() ) { // got a file name
std::ofstream out(fileName); std::ofstream out(fileName.ascii());
CGAL::set_ascii_mode(out); CGAL::set_ascii_mode(out);
out << tr1 << std::endl; out << tr1 << std::endl;
} }
@ -418,7 +418,7 @@ private slots:
tr1.clear(); tr1.clear();
A.clear(); A.clear();
L.clear(); L.clear();
std::ifstream in(s); std::ifstream in(s.ascii());
CGAL::set_ascii_mode(in); CGAL::set_ascii_mode(in);
in >> tr1; in >> tr1;
Vertex_iterator it = tr1.vertices_begin(); Vertex_iterator it = tr1.vertices_begin();

View File

@ -192,7 +192,7 @@ void MyWindow::fileOpenPm()
statusBar()->message( "File Open abandoned", 2000 ); statusBar()->message( "File Open abandoned", 2000 );
return; return;
} }
std::ifstream inputFile(filename); std::ifstream inputFile(filename.ascii());
// Creates an ifstream object named inputFile // Creates an ifstream object named inputFile
if (! inputFile.is_open()) // Always test file open if (! inputFile.is_open()) // Always test file open
{ {
@ -253,7 +253,7 @@ void MyWindow::fileOpenPm()
*/ */
void MyWindow::load( const QString& filename , bool clear_flag ) void MyWindow::load( const QString& filename , bool clear_flag )
{ {
std::ifstream inputFile(filename); std::ifstream inputFile(filename.ascii());
// Creates an ofstream object named inputFile // Creates an ofstream object named inputFile
if (! inputFile.is_open()) // Always test file open if (! inputFile.is_open()) // Always test file open
{ {
@ -603,7 +603,7 @@ void MyWindow::fileSave()
return; return;
} }
std::ofstream outFile(m_filename); std::ofstream outFile(m_filename.ascii());
// Creates an ofstream object named outFile // Creates an ofstream object named outFile
if (! outFile.is_open()) // Always test file open if (! outFile.is_open()) // Always test file open
{ {

View File

@ -27,6 +27,7 @@
* the differences is in the traits classes. * the differences is in the traits classes.
*/ */
#include <stddef.h>
#include <math.h> #include <math.h>
#include <limits> #include <limits>

View File

@ -512,7 +512,7 @@ void MyWindow::open_dxf_file()
return; return;
file_name=s; file_name=s;
std::ifstream in_file(s); std::ifstream in_file(s.ascii());
if (!in_file.is_open()) if (!in_file.is_open())
{ {
QMessageBox::warning( widget,"Open","Can't open file"); QMessageBox::warning( widget,"Open","Can't open file");
@ -606,7 +606,7 @@ void MyWindow::open_linear_polygon_file()
return; return;
file_name=s; file_name=s;
std::ifstream in_file(s); std::ifstream in_file(s.ascii());
if (!in_file.is_open()) if (!in_file.is_open())
{ {
QMessageBox::warning( widget,"Open","Can't open file"); QMessageBox::warning( widget,"Open","Can't open file");

View File

@ -307,7 +307,7 @@ public slots:
"CGAL files (*.cgal)", this ) ); "CGAL files (*.cgal)", this ) );
if ( s.isEmpty() ) if ( s.isEmpty() )
return; return;
std::ifstream in(s); std::ifstream in(s.ascii());
CGAL::set_ascii_mode(in); CGAL::set_ascii_mode(in);
Nef_polyhedron N_temp(Nef_polyhedron::EMPTY); Nef_polyhedron N_temp(Nef_polyhedron::EMPTY);
Nef_visible2 = N_temp; Nef_visible2 = N_temp;
@ -327,7 +327,7 @@ public slots:
"Cgal files (*.cgal)", this ); "Cgal files (*.cgal)", this );
if ( !fileName.isNull() ) { if ( !fileName.isNull() ) {
// got a file name // got a file name
std::ofstream out(fileName); std::ofstream out(fileName.ascii());
CGAL::set_ascii_mode(out); CGAL::set_ascii_mode(out);
out << Nef_visible << std::endl; out << Nef_visible << std::endl;
} }
@ -338,7 +338,7 @@ public slots:
"CGAL files (*.cgal)", this ) ); "CGAL files (*.cgal)", this ) );
if ( s.isEmpty() ) if ( s.isEmpty() )
return; return;
std::ifstream in(s); std::ifstream in(s.ascii());
CGAL::set_ascii_mode(in); CGAL::set_ascii_mode(in);
Polygon_2_double poly; Polygon_2_double poly;

View File

@ -238,7 +238,7 @@ public slots:
if ( s.isEmpty() ) if ( s.isEmpty() )
return; return;
seg_list.clear(); seg_list.clear();
std::ifstream in(s); std::ifstream in(s.ascii());
CGAL::set_ascii_mode(in); CGAL::set_ascii_mode(in);
int number_of_segments = 0,i; int number_of_segments = 0,i;
CGAL::Segment_data<Rep> seg; CGAL::Segment_data<Rep> seg;
@ -286,7 +286,7 @@ public slots:
"Cgal files (*.cgal)", this ); "Cgal files (*.cgal)", this );
if ( !fileName.isNull() ) { if ( !fileName.isNull() ) {
// got a file name // got a file name
std::ofstream out(fileName); std::ofstream out(fileName.ascii());
CGAL::set_ascii_mode(out); CGAL::set_ascii_mode(out);
out << seg_list.size() << std::endl << prec << std::endl; out << seg_list.size() << std::endl << prec << std::endl;
std::list<Segment_2>::const_iterator it = seg_list.begin(); std::list<Segment_2>::const_iterator it = seg_list.begin();

View File

@ -383,7 +383,7 @@ private slots:
if ( !fileName.isNull() ) if ( !fileName.isNull() )
{ {
std::ofstream out(fileName); std::ofstream out(fileName.ascii());
CGAL::set_ascii_mode(out); CGAL::set_ascii_mode(out);
@ -410,7 +410,8 @@ private slots:
bool auto_create_offsets = true ; bool auto_create_offsets = true ;
offsets.clear() ; offsets.clear() ;
std::ifstream offsets_file(s + QString(".oft") ); QString soft = s + QString(".oft");
std::ifstream offsets_file(soft.ascii());
if ( offsets_file ) if ( offsets_file )
{ {
CGAL::set_ascii_mode(offsets_file); CGAL::set_ascii_mode(offsets_file);
@ -424,7 +425,7 @@ private slots:
auto_create_offsets = false ; auto_create_offsets = false ;
} }
std::ifstream in(s); std::ifstream in(s.ascii());
if ( in ) if ( in )
{ {
CGAL::set_ascii_mode(in); CGAL::set_ascii_mode(in);

View File

@ -134,7 +134,7 @@ class Placement : public QObject
void load( const QString & s ) void load( const QString & s )
{ {
runge_kutta_integrator = new Runge_kutta_integrator(integrating_); runge_kutta_integrator = new Runge_kutta_integrator(integrating_);
std::ifstream infile(s, std::ios::in); std::ifstream infile(s.ascii(), std::ios::in);
double iXSize, iYSize; double iXSize, iYSize;
iXSize = iYSize = 512; iXSize = iYSize = 512;
unsigned int x_samples, y_samples; unsigned int x_samples, y_samples;
@ -352,14 +352,14 @@ class MyWidget : public QGLWidget
QString savedepsfile(){ QString savedepsfile(){
QString s = QFileDialog::getSaveFileName( ".", QString s = QFileDialog::getSaveFileName( ".",
"Encapsulated PostScript files (*.eps)", this, "save file dialog", "Save file to" ); "Encapsulated PostScript files (*.eps)", this, "save file dialog", "Save file to" );
std::ofstream fw(s,std::ios::out); std::ofstream fw(s.ascii(),std::ios::out);
p.Stream_lines->print_stream_lines_eps(fw); p.Stream_lines->print_stream_lines_eps(fw);
return s; return s;
} }
QString savedstlfile(){ QString savedstlfile(){
QString s = QFileDialog::getSaveFileName( ".", QString s = QFileDialog::getSaveFileName( ".",
"STreamLine files (*.stl)", this, "save file dialog", "Save file to" ); "STreamLine files (*.stl)", this, "save file dialog", "Save file to" );
std::ofstream fw(s,std::ios::out); std::ofstream fw(s.ascii(),std::ios::out);
p.Stream_lines->print_stream_lines(fw); p.Stream_lines->print_stream_lines(fw);
return s; return s;
} }