Fix errors:

"Chain.cpp", line 40: Error: The function "sprintf" must have a prototype.
  "Chain.cpp", line 73: Error: The function "sprintf" must have a prototype.
  "Heterogen.cpp", line 95: Error: The function "sprintf" must have a prototype.
  "PDB.cpp", line 66: Error: The function "sscanf" must have a prototype.
  "PDB.cpp", line 68: Error: The function "sscanf" must have a prototype.
  "PDB.cpp", line 92: Error: The function "sscanf" must have a prototype.
detected by Sun CC.
This commit is contained in:
Laurent Rineau 2008-03-11 11:33:27 +00:00
parent daa0426d6a
commit 7e5ba0b225
3 changed files with 14 additions and 12 deletions

View File

@ -22,7 +22,7 @@
#include <CGAL/PDB/internal/Error_logger.h>
#include <CGAL/PDB/internal/pdb_utils.h>
#include <sstream>
#include <stdio.h>
#include <cstdio>
CGAL_PDB_BEGIN_NAMESPACE
//Residue dummy_residue;
@ -38,7 +38,7 @@ void Chain::write_pdb(std::ostream &out) const {
char line[81];
sprintf(line, "MODEL %8d ", 1);
std::sprintf(line, "MODEL %8d ", 1);
out << line << std::endl;
// int anum=1;
@ -71,7 +71,7 @@ int Chain::write(char chain, int start_index, std::ostream &out) const {
}
const char *terformat="TER %5d %3s %c %3d%c";
if (!residues_.empty()) {
sprintf(line, terformat, start_index,
std::sprintf(line, terformat, start_index,
Monomer::type_string(last_type).c_str(), chain,
last_resindex.index(),' ');
out << line << std::endl;

View File

@ -24,7 +24,7 @@
#include <limits>
#include <sstream>
#include <stdio.h>
#include <cstdio>
CGAL_PDB_BEGIN_NAMESPACE
@ -94,11 +94,11 @@ int Heterogen::write(std::string name, int num,
//char chain=' ';
//"HETATM%5d %4s %3s %4d %8.3f%8.3f%8.3f%6.2f%6.2f %4s%2s%2s";
sprintf(line, CGAL_PDB_INTERNAL_NS::hetatom_line_oformat_,
start_index++, al.c_str(),
name.c_str(), num,
pt.x(), pt.y(), pt.z(), a.occupancy(), a.temperature_factor(),
a.element().c_str(), " ");
std::sprintf(line, CGAL_PDB_INTERNAL_NS::hetatom_line_oformat_,
start_index++, al.c_str(),
name.c_str(), num,
pt.x(), pt.y(), pt.z(), a.occupancy(), a.temperature_factor(),
a.element().c_str(), " ");
out << line << std::endl;
//++anum;
}

View File

@ -23,6 +23,8 @@
#include <cassert>
#include <CGAL/PDB/internal/Error_logger.h>
#include <cctype>
#include <cstdio>
CGAL_PDB_BEGIN_NAMESPACE
PDB::PDB(std::istream &in, bool print_errors) {
@ -63,9 +65,9 @@ void PDB::load(std::istream &in, bool print_errors){
header_.push_back(std::string(line));
int ti;
char chain;
if (sscanf(line, "COMPND %d CHAIN: %c", &ti, &chain) == 2) {
if (std::sscanf(line, "COMPND %d CHAIN: %c", &ti, &chain) == 2) {
names[chain]=last_name;
} else if (sscanf(line, "COMPND %d MOLECULE:", &ti) ==1) {
} else if (std::sscanf(line, "COMPND %d MOLECULE:", &ti) ==1) {
int len= std::strlen(line);
CGAL_assertion(line[len]=='\0');
--len;
@ -89,7 +91,7 @@ void PDB::load(std::istream &in, bool print_errors){
} else if (lt== CGAL_PDB_INTERNAL_NS::MODEL) {
int mnum=0;
char buf[81];
sscanf(line, "%s %d", buf, &mnum);
std::sscanf(line, "%s %d", buf, &mnum);
//new_model(Model_key(mnum), Model());
cur_model= Model_key(mnum);
} else if ( lt== CGAL_PDB_INTERNAL_NS::HETATM