Eliminated some unnecessary usage of strcpy

This commit is contained in:
Ray Speth 2012-08-17 16:44:50 +00:00
parent 49dbb605ab
commit a549782c7f
12 changed files with 16 additions and 91 deletions

View file

@ -533,20 +533,14 @@ class PDSS_Water;
* or
*
* @code
* char iFile[80], file_ID[80];
* strcpy(iFile, "DH_NaCl.xml");
* sprintf(file_ID,"%s#NaCl_electrolyte", iFile);
* XML_Node *xm = get_XML_NameID("phase", file_ID, 0);
* XML_Node *xm = get_XML_NameID("phase", "DH_NaCl.xml#NaCl_electrolyte", 0);
* DebyeHuckel *dh = new DebyeHuckel(*xm);
* @endcode
*
* or by the following call to importPhase():
*
* @code
* char iFile[80], file_ID[80];
* strcpy(iFile, "DH_NaCl.xml");
* sprintf(file_ID,"%s#NaCl_electrolyte", iFile);
* XML_Node *xm = get_XML_NameID("phase", file_ID, 0);
* XML_Node *xm = get_XML_NameID("phase", "DH_NaCl.xml#NaCl_electrolyte", 0);
* DebyeHuckel dhphase;
* importPhase(*xm, &dhphase);
* @endcode

View file

@ -1119,20 +1119,14 @@ class PDSS_Water;
* or
*
* @code
* char iFile[80], file_ID[80];
* strcpy(iFile, "HMW_NaCl.xml");
* sprintf(file_ID,"%s#NaCl_electrolyte", iFile);
* XML_Node *xm = get_XML_NameID("phase", file_ID, 0);
* XML_Node *xm = get_XML_NameID("phase", "HMW_NaCl.xml#NaCl_electrolyte", 0);
* HMWSoln *dh = new HMWSoln(*xm);
* @endcode
*
* or by the following call to importPhase():
*
* @code
* char iFile[80], file_ID[80];
* strcpy(iFile, "HMW_NaCl.xml");
* sprintf(file_ID,"%s#NaCl_electrolyte", iFile);
* XML_Node *xm = get_XML_NameID("phase", file_ID, 0);
* XML_Node *xm = get_XML_NameID("phase", "HMW_NaCl.xml#NaCl_electrolyte", 0);
* HMWSoln dhphase;
* importPhase(*xm, &dhphase);
* @endcode

View file

@ -85,20 +85,14 @@ class WaterProps;
* or
*
* @code
* char iFile[80], file_ID[80];
* strcpy(iFile, "waterSSTPphase.xml");
* sprintf(file_ID,"%s#water", iFile);
* XML_Node *xm = get_XML_NameID("phase", file_ID, 0);
* XML_Node *xm = get_XML_NameID("phase", "waterSSTPphase.xml#water", 0);
* WaterSSTP *w = new WaterSSTP(*xm);
* @endcode
*
* or by the following call to importPhase():
*
* @code
* char iFile[80], file_ID[80];
* strcpy(iFile, "waterSSTPphase.xml");
* sprintf(file_ID,"%s#water", iFile);
* XML_Node *xm = get_XML_NameID("phase", file_ID, 0);
* XML_Node *xm = get_XML_NameID("phase", "waterSSTPphase.xml#water", 0);
* WaterSSTP water;
* importPhase(*xm, &water);
* @endcode

View file

@ -18,12 +18,7 @@ int main(int argc, char** argv)
string fName = "DH_graph_1.log";
fileLog* fl = new fileLog(fName);
try {
char iFile[80];
strcpy(iFile, "DH_NaCl.xml");
if (argc > 1) {
strcpy(iFile, argv[1]);
}
std::string iFile = (argc > 1) ? argv[1] : "DH_NaCl.xml";
setLogger(fl);
DebyeHuckel* DH = new DebyeHuckel(iFile, "NaCl_electrolyte");

View file

@ -19,12 +19,7 @@ int main(int argc, char** argv)
size_t i;
try {
char iFile[80];
strcpy(iFile, "HMW_NaCl.xml");
if (argc > 1) {
strcpy(iFile, argv[1]);
}
std::string iFile = (argc > 1) ? argv[1] : "HMW_NaCl.xml";
double Cp0_R[20], pmCp[20];
HMWSoln* HMW = new HMWSoln(iFile, "NaCl_electrolyte");

View file

@ -19,12 +19,7 @@ int main(int argc, char** argv)
size_t i;
try {
char iFile[80];
strcpy(iFile, "HMW_NaCl.xml");
if (argc > 1) {
strcpy(iFile, argv[1]);
}
std::string iFile = (argc > 1) ? argv[1] : "HMW_NaCl.xml";
double Cp0_R[20], pmCp[20];
HMWSoln* HMW = new HMWSoln(iFile, "NaCl_electrolyte");

View file

@ -17,12 +17,7 @@ int main(int argc, char** argv)
size_t i;
string commandFile;
try {
char iFile[80];
strcpy(iFile, "HMW_NaCl.xml");
if (argc > 1) {
strcpy(iFile, argv[1]);
}
std::string iFile = (argc > 1) ? argv[1] : "HMW_NaCl.xml";
double Temp = 273.15 + 275.;
double aTemp[7];

View file

@ -22,13 +22,7 @@ int main(int argc, char** argv)
int extraCols = 1;
try {
//Cantera::ThermoPhase *tp = 0;
char iFile[80];
strcpy(iFile, "HMW_NaCl.xml");
if (argc > 1) {
strcpy(iFile, argv[1]);
}
std::string iFile = (argc > 1) ? argv[1] : "HMW_NaCl.xml";
HMWSoln* HMW = new HMWSoln(iFile, "NaCl_electrolyte");

View file

@ -19,12 +19,7 @@ int main(int argc, char** argv)
size_t i;
try {
char iFile[80];
strcpy(iFile, "HMW_NaCl.xml");
if (argc > 1) {
strcpy(iFile, argv[1]);
}
std::string iFile = (argc > 1) ? argv[1] : "HMW_NaCl.xml";
double Enth0_RT[20], pmEnth[20], molarEnth;
HMWSoln* HMW = new HMWSoln(iFile, "NaCl_electrolyte");

View file

@ -18,12 +18,7 @@ int main(int argc, char** argv)
size_t i;
try {
char iFile[80];
strcpy(iFile, "HMW_NaCl.xml");
if (argc > 1) {
strcpy(iFile, argv[1]);
}
std::string iFile = (argc > 1) ? argv[1] : "HMW_NaCl.xml";
double V0[20], pmV[20];
HMWSoln* HMW = new HMWSoln(iFile, "NaCl_electrolyte");

View file

@ -16,14 +16,8 @@ using namespace Cantera;
int main(int argc, char** argv)
{
try {
//Cantera::ThermoPhase *tp = 0;
char iFile[80], file_ID[80];
strcpy(iFile, "NaCl_Solid.xml");
if (argc > 1) {
strcpy(iFile, argv[1]);
}
sprintf(file_ID,"%s#NaCl(S)", iFile);
std::string iFile = (argc > 1) ? argv[1] : "NaCl_Solid.xml";
std::string file_ID = iFile + "#NaCl(S)";
XML_Node* xm = get_XML_NameID("phase", file_ID, 0);
StoichSubstanceSSTP* solid = new StoichSubstanceSSTP(*xm);

View file

@ -23,22 +23,7 @@ int main()
#endif
double pres;
try {
WaterSSTP* w = new WaterSSTP("waterTPphase.xml","");
delete w;
char iFile[80], file_ID[80];
strcpy(iFile, "waterTPphase.xml");
sprintf(file_ID,"%s#water", iFile);
XML_Node* xm = get_XML_NameID("phase", file_ID, 0);
w = new WaterSSTP(*xm);
delete w;
strcpy(iFile, "waterTPphase.xml");
sprintf(file_ID,"%s#water", iFile);
xm = get_XML_NameID("phase", file_ID, 0);
w = new WaterSSTP();
importPhase(*xm, w);
WaterSSTP* w = new WaterSSTP("waterTPphase.xml", "water");
/*
* Print out the triple point conditions