--- branches/development/src/io/ifstrstream.cpp 2012/09/13 14:10:11 1798 +++ branches/development/src/io/ifstrstream.cpp 2013/05/15 15:09:35 1874 @@ -35,13 +35,13 @@ * * [1] Meineke, et al., J. Comp. Chem. 26, 252-271 (2005). * [2] Fennell & Gezelter, J. Chem. Phys. 124, 234104 (2006). - * [3] Sun, Lin & Gezelter, J. Chem. Phys. 128, 24107 (2008). + * [3] Sun, Lin & Gezelter, J. Chem. Phys. 128, 234107 (2008). * [4] Kuang & Gezelter, J. Chem. Phys. 133, 164101 (2010). * [5] Vardeman, Stocker & Gezelter, J. Chem. Theory Comput. 7, 834 (2011). */ /** - * @file basic_ifstrstream.cpp + * @file ifstrstream.cpp * @author Teng Lin * @date 10/14/2004 * @version 1.0 @@ -72,9 +72,9 @@ namespace OpenMD { /** * Explicit constructor - * @filename String containing the name of the file to be opened - * @mode Flags describing the requested i/o mode for the file, default value is ios_base::in - * @checkFilename Flags indicating checking the file name in parallel + * @param filename String containing the name of the file to be opened + * @param mode Flags describing the requested i/o mode for the file, default value is ios_base::in + * @param checkFilename Flags indicating checking the file name in parallel */ #ifdef IS_MPI ifstrstream::ifstrstream(const char* filename, std::ios_base::openmode mode, bool checkFilename) @@ -103,9 +103,9 @@ namespace OpenMD { * Opens a file and associats a buffer with the specified file to perform the i/o operations * (single mode). Master reads a file and brocasts its content to the other slave nodes. After * brocasting, every nodes fall back to stringstream (parallel mode). - * @filename String containing the name of the file to be opened - * @mode Flags describing the requested i/o mode for the file - * @checkFilename Flags indicating checking the file name in parallel + * @param filename String containing the name of the file to be opened + * @param mode Flags describing the requested i/o mode for the file + * @param checkFilename Flags indicating checking the file name in parallel */ void ifstrstream::open(const char* filename, std::ios_base::openmode mode, bool checkFilename){ @@ -160,8 +160,9 @@ namespace OpenMD { * Internal function used to open the file * @return true if succesfully opens a file (single mode) or gets the file content (parallel mode) * otherwise return false - * @filename String containing the name of the file to be opened - * @mode Flags describing the requested i/o mode for the file + * @param filename String containing the name of the file to be opened + * @param mode Flags describing the requested i/o mode for the file + * @param checkFilename Flags indicating checking the file name in parallel * @todo use try - catch syntax to make the program more readable */ @@ -221,7 +222,7 @@ namespace OpenMD { if (fileSize < 0) { fin.close(); - delete fbuf; + delete[] fbuf; return false; } @@ -233,7 +234,7 @@ namespace OpenMD { //close the file and delete the buffer fin.close(); internalStringBuf_.str(fbuf); - delete [] fbuf; + delete[] fbuf; }else{ fileSize = FileNotExists; MPI::COMM_WORLD.Bcast(&fileSize, 1, MPI::LONG, masterNode); @@ -255,7 +256,7 @@ namespace OpenMD { else diffFilename = 1; - delete masterFilename; + delete[] masterFilename; MPI::COMM_WORLD.Allreduce(&diffFilename, &error, 1, MPI::INT, MPI::SUM);