Changeset c510a7 for molecuilder
- Timestamp:
- Apr 29, 2008, 12:19:51 PM (17 years ago)
- Children:
- e936b3
- Parents:
- 307fd1
- Location:
- molecuilder/src
- Files:
-
- 7 edited
Legend:
- Unmodified
- Added
- Removed
-
molecuilder/src/builder.cpp
r307fd1 rc510a7 691 691 void SaveConfig(char *ConfigFileName, config *configuration, periodentafel *periode, molecule *mol) 692 692 { 693 char filename[ 255];693 char filename[MAXSTRINGSIZE]; 694 694 ofstream output; 695 695 … … 752 752 ofstream output; 753 753 string line; 754 char filename[ 255];754 char filename[MAXSTRINGSIZE]; 755 755 char *ConfigFileName = NULL; 756 756 char *ElementsFileName = NULL; -
molecuilder/src/config.cpp
r307fd1 rc510a7 13 13 config::config() 14 14 { 15 mainname = (char *) MallocString(sizeof(char)* 255,"config constructor: mainname");16 defaultpath = (char *) MallocString(sizeof(char)* 255,"config constructor: mainname");17 pseudopotpath = (char *) MallocString(sizeof(char)* 255,"config constructor: mainname");18 configpath = (char *) MallocString(sizeof(char)* 255,"config constructor: mainname");19 configname = (char *) MallocString(sizeof(char)* 255,"config constructor: mainname");15 mainname = (char *) MallocString(sizeof(char)*MAXSTRINGSIZE,"config constructor: mainname"); 16 defaultpath = (char *) MallocString(sizeof(char)*MAXSTRINGSIZE,"config constructor: mainname"); 17 pseudopotpath = (char *) MallocString(sizeof(char)*MAXSTRINGSIZE,"config constructor: mainname"); 18 configpath = (char *) MallocString(sizeof(char)*MAXSTRINGSIZE,"config constructor: mainname"); 19 configname = (char *) MallocString(sizeof(char)*MAXSTRINGSIZE,"config constructor: mainname"); 20 20 strcpy(mainname,"pcp"); 21 21 strcpy(defaultpath,"not specified"); … … 414 414 char *ptr = NULL; 415 415 int last = -1; 416 for(int i=0;i< 255;i++) {416 for(int i=0;i<MAXSTRINGSIZE;i++) { 417 417 if (filename[i] == '/') 418 418 last = i; … … 1168 1168 case(string_type): 1169 1169 if (value != NULL) { 1170 if (maxlength == -1) maxlength = strlen((char *)value); // get maximum size of string array 1170 //if (maxlength == -1) maxlength = strlen((char *)value); // get maximum size of string array 1171 maxlength = MAXSTRINGSIZE; 1171 1172 length = maxlength > (dummy-dummy1) ? (dummy-dummy1) : maxlength; // cap at maximum 1172 1173 strncpy((char *)value, dummy1, length); // copy as much -
molecuilder/src/defs.hpp
r307fd1 rc510a7 37 37 enum value_type { string_type, double_type, int_type, row_int, row_double, grid, lower_trigrid, upper_trigrid}; 38 38 39 // maximum length of any char array 40 #define MAXSTRINGSIZE 255 41 39 42 // various standard filenames 40 43 #define DEFAULTCONFIG "main_pcp_linux" -
molecuilder/src/moleculelist.cpp
r307fd1 rc510a7 304 304 { 305 305 ofstream outputFragment; 306 char FragmentName[ 255];307 char PathBackup[ 255];306 char FragmentName[MAXSTRINGSIZE]; 307 char PathBackup[MAXSTRINGSIZE]; 308 308 bool result = true; 309 309 bool intermediateResult = true; 310 310 atom *Walker = NULL; 311 311 vector BoxDimension; 312 char TEFilename[ 255];312 char TEFilename[MAXSTRINGSIZE]; 313 313 char *FragmentNumber; 314 314 int FragmentCounter = 0; -
molecuilder/src/molecules.cpp
r307fd1 rc510a7 1892 1892 ifstream KeySetFile; 1893 1893 stringstream line; 1894 char *filename = (char *) Malloc(sizeof(char)* 255, "molecule::ParseKeySetFile - filename");1894 char *filename = (char *) Malloc(sizeof(char)*MAXSTRINGSIZE, "molecule::ParseKeySetFile - filename"); 1895 1895 1896 1896 if (FragmentList != NULL) { // check list pointer … … 1905 1905 // each line represents a new fragment 1906 1906 int NumberOfFragments = 0; 1907 char *buffer = (char *) Malloc(sizeof(char)* 255, "molecule::ParseKeySetFile - *buffer");1907 char *buffer = (char *) Malloc(sizeof(char)*MAXSTRINGSIZE, "molecule::ParseKeySetFile - *buffer"); 1908 1908 // 1. scan through file to know number of fragments 1909 1909 while (!KeySetFile.eof()) { 1910 KeySetFile.getline(buffer, 255);1910 KeySetFile.getline(buffer, MAXSTRINGSIZE); 1911 1911 if (strlen(buffer) > 0) // there is at least on possible number on the parsed line 1912 1912 NumberOfFragments++; … … 1919 1919 NumberOfFragments = 0; 1920 1920 while ((!KeySetFile.eof()) && (FragmentList->NumberOfMolecules > NumberOfFragments)) { 1921 KeySetFile.getline(buffer, 255);1921 KeySetFile.getline(buffer, MAXSTRINGSIZE); 1922 1922 KeySet CurrentSet; 1923 1923 if ((strlen(buffer) > 0) && (ScanBufferIntoKeySet(out, buffer, CurrentSet))) // if at least one valid atom was added, write config … … 1946 1946 ofstream AdjacencyFile; 1947 1947 atom *Walker = NULL; 1948 char *filename = (char *) Malloc(sizeof(char)* 255, "molecule::StoreAdjacencyToFile - filename");1948 char *filename = (char *) Malloc(sizeof(char)*MAXSTRINGSIZE, "molecule::StoreAdjacencyToFile - filename"); 1949 1949 bool status = true; 1950 1950 … … 1982 1982 bool molecule::CheckAdjacencyFileAgainstMolecule(ofstream *out, char *path, atom **ListOfAtoms, int bondorder) 1983 1983 { 1984 char *filename = (char *) Malloc(sizeof(char)* 255, "molecule::CheckAdjacencyFileAgainstMolecule - filename");1984 char *filename = (char *) Malloc(sizeof(char)*MAXSTRINGSIZE, "molecule::CheckAdjacencyFileAgainstMolecule - filename"); 1985 1985 ifstream File; 1986 1986 bool status = true; … … 1996 1996 1997 1997 // determine order from file 1998 File.getline(filename, 255);1998 File.getline(filename, MAXSTRINGSIZE); 1999 1999 if (bondorder != atoi(&filename[5])) { 2000 2000 *out << "Bond order desired is " << bondorder << " and does not match one in file " << filename[6] << "." << endl; … … 2003 2003 // Parse the file line by line and count the bonds 2004 2004 while (!File.eof()) { 2005 File.getline(filename, 255);2005 File.getline(filename, MAXSTRINGSIZE); 2006 2006 stringstream line; 2007 2007 line.str(filename); -
molecuilder/src/molecules.hpp
r307fd1 rc510a7 247 247 element *start; //!< start of element list 248 248 element *end; //!< end of element list 249 char header1[ 255]; //!< store first header line250 char header2[ 255]; //!< store second header line249 char header1[MAXSTRINGSIZE]; //!< store first header line 250 char header2[MAXSTRINGSIZE]; //!< store second header line 251 251 252 252 periodentafel(); -
molecuilder/src/periodentafel.cpp
r307fd1 rc510a7 175 175 infile.open(filename); 176 176 if (infile != NULL) { 177 infile.getline(header1, 255);178 infile.getline(header2, 255); // skip first two header lines177 infile.getline(header1, MAXSTRINGSIZE); 178 infile.getline(header2, MAXSTRINGSIZE); // skip first two header lines 179 179 cout << "Parsed elements:"; 180 180 while (!infile.eof()) {
Note:
See TracChangeset
for help on using the changeset viewer.