r3536 - trunk/libmutil/source

erik at minisip.org erik at minisip.org
Wed Nov 28 17:52:09 CET 2007


Author: erik
Date: 2007-11-28 17:52:08 +0100 (Wed, 28 Nov 2007)
New Revision: 3536

Modified:
   trunk/libmutil/source/FileSystem.cxx
   trunk/libmutil/source/XMLParser.cxx
Log:

 * XMLParser bug fixing (introduced in last commit).



Modified: trunk/libmutil/source/FileSystem.cxx
===================================================================
--- trunk/libmutil/source/FileSystem.cxx	2007-11-28 16:01:58 UTC (rev 3535)
+++ trunk/libmutil/source/FileSystem.cxx	2007-11-28 16:52:08 UTC (rev 3536)
@@ -33,7 +33,6 @@
 
 
 LocalFile::LocalFile(string path) {
-	cerr << "EEEE: trying to open <"<<path<<">"<<endl;
 	file.open( path.c_str(), ios::out | ios::in | ios::binary );
 	if (!file.is_open()){
 		throw FileException("Could not open file");

Modified: trunk/libmutil/source/XMLParser.cxx
===================================================================
--- trunk/libmutil/source/XMLParser.cxx	2007-11-28 16:01:58 UTC (rev 3535)
+++ trunk/libmutil/source/XMLParser.cxx	2007-11-28 16:52:08 UTC (rev 3536)
@@ -201,32 +201,13 @@
 
 }
 
-XMLFileParser::XMLFileParser(string filename_, XMLParserCallback *cb):XMLParser(cb), filename(filename_){
+XMLFileParser::XMLFileParser(string filename_, XMLParserCallback *cb):
+		XMLParser(cb), 
+		filename(filename_)
+{
 
-	fs = new LocalFileSystem;
-
+	fs = new LocalFileSystem();
 	init();
-	
-	string s = "";
-	if (filename != ""){
-		ifstream file(filename.c_str());
-		if (!file){
-			throw XMLFileNotFound( "Could not read file " + filename );
-		}
-
-
-		int32_t bufsize=20; 
-		char *buf = (char *)calloc(bufsize,1);
-		do{
-			for (int32_t i=0; i<bufsize; i++)
-				buf[i]=0;
-			file.read(buf,bufsize-1);
-			s = s+string(buf);
-		}while(!(!file));
-		free(buf);
-
-	}
-	parsestring(s);
 }
 
 XMLFileParser::XMLFileParser(string filename_, MRef<FileSystem*> fs_, XMLParserCallback *cb) : 
@@ -243,7 +224,6 @@
 		MRef<File*> file;
 		try{
 			file = fs->open(filename);
-			ifstream file(filename.c_str());
 		}catch(const FileException &e){
 			throw XMLFileNotFound( "Could not read file " + filename );
 		}
@@ -257,13 +237,11 @@
 			//file.read(buf,bufsize-1);
 			file->read(buf, bufsize-1);
 			s = s+string(buf);
-		}while(/*!(!file)*/ !file->eof());
+		}while(!file->eof());
 		free(buf);
 
 	}
 	parsestring(s);
-
-	
 }
 
 



More information about the Minisip-devel mailing list