diff --git a/pub/lib/file_in.cpp b/pub/lib/file_in.cpp index df4b9bc8f17c977e1ddb3aab6e5f9e0e5c9cb5a6..79b20f2d646e9aa04eba2c3e4b7f94464561ca04 100644 --- a/pub/lib/file_in.cpp +++ b/pub/lib/file_in.cpp @@ -62,11 +62,9 @@ void NFileIn::load(void) FS.close(); } else throw "unknown file extension [" + fext + "]"; - fclose( F_in ); } catch(string& ex) { - // for y08 only cerr << "Cannot load " << vflong[i] << ": " << ex << endl; if (F_in) fclose(F_in); @@ -172,9 +170,8 @@ void NFileIn::Load_08(ifstream& FS,string flong) const YAML::Node& pName = doc["Formula"]; if( !pName ) throw S("DEFICIENT FILE: no formula"); - //string expr; - string expr=pName.as<string>(); - fc->parse_function( expr ); + string s = pName.as<string>(); + fc->parse_function( s ); fc->curve_set_defaults(); } @@ -217,8 +214,7 @@ void NFileIn::Load_08(ifstream& FS,string flong) while( val != "" ) { triv::string_extract_line( val, &lin, &res ); double vx, vy, dy; - if( sscanf( lin.c_str(), - "%lg %lg %lg\n",&vx, &vy, &dy )!=3 ) + if( sscanf( lin.c_str(), "%lg %lg %lg\n",&vx, &vy, &dy )!=3 ) throw "xyd: bad data line: " + lin; sout->push_xyd( vx, vy, dy ); val = res; diff --git a/pub/lib/file_out.cpp b/pub/lib/file_out.cpp index 128ca92466e6cc3045a76d8819efa0ceef276fb9..5c540de08812be76f413e94273b9d0553d360606 100644 --- a/pub/lib/file_out.cpp +++ b/pub/lib/file_out.cpp @@ -38,12 +38,12 @@ void NFileOut::save( string fmt, bool allow_overwrite ) while( (f=iter()) ) { // query output file name outfnam = wask( "Save as (."+fmt+")", f->name); - if ( outfnam=="" ) return; + if ( outfnam=="" ) + return; f->name = outfnam; outfnam += "."+fmt; // document file save - f->lDoc.push_back( "fs " + outfnam + " # " + - triv::time2strg( time(0) ) ); + f->lDoc.push_back( "fs " + outfnam + " # " + triv::time2strg( time(0) ) ); // prevent unintended overwriting if( !allow_overwrite ){ if ( (file = fopen(outfnam.c_str(), "r")) ) {