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 * or
* *
* @code * @code
* char iFile[80], file_ID[80]; * XML_Node *xm = get_XML_NameID("phase", "DH_NaCl.xml#NaCl_electrolyte", 0);
* strcpy(iFile, "DH_NaCl.xml");
* sprintf(file_ID,"%s#NaCl_electrolyte", iFile);
* XML_Node *xm = get_XML_NameID("phase", file_ID, 0);
* DebyeHuckel *dh = new DebyeHuckel(*xm); * DebyeHuckel *dh = new DebyeHuckel(*xm);
* @endcode * @endcode
* *
* or by the following call to importPhase(): * or by the following call to importPhase():
* *
* @code * @code
* char iFile[80], file_ID[80]; * XML_Node *xm = get_XML_NameID("phase", "DH_NaCl.xml#NaCl_electrolyte", 0);
* strcpy(iFile, "DH_NaCl.xml");
* sprintf(file_ID,"%s#NaCl_electrolyte", iFile);
* XML_Node *xm = get_XML_NameID("phase", file_ID, 0);
* DebyeHuckel dhphase; * DebyeHuckel dhphase;
* importPhase(*xm, &dhphase); * importPhase(*xm, &dhphase);
* @endcode * @endcode

View file

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

View file

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

View file

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

View file

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

View file

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

View file

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

View file

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

View file

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

View file

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

View file

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

View file

@ -23,22 +23,7 @@ int main()
#endif #endif
double pres; double pres;
try { try {
WaterSSTP* w = new WaterSSTP("waterTPphase.xml",""); WaterSSTP* w = new WaterSSTP("waterTPphase.xml", "water");
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);
/* /*
* Print out the triple point conditions * Print out the triple point conditions