Hi all,
    I've just made this two patches to CLAM.

The first fixes libclam debian packages building.
(SConstruct was moved from scons/libs and vmqt was removed)

The second fixes some SDIFIO problems: Configure() tries to open
the file in both SDIFIn and SDIFOut. This generates a lot of problems,
such as two (or more) open with only one close, opening of the wrong
file ("nofile" is always opened/created) and so on.
With this patch no file is opened/created during Configure() and
any check of right filename is moved into Start().

Cheers,
    Giulio.
Index: debian/changelog
===================================================================
--- debian/changelog	(revisione 9958)
+++ debian/changelog	(copia locale)
@@ -1,3 +1,9 @@
+clam (1.0.1-1) unstable; urgency=low
+
+  * debian/rules: Updated to follow Sconstruct changes (changed location and removed vmqt module)
+
+ -- Giulio Paci <[EMAIL PROTECTED]>  Sat,  7 Apr 2007 15:06:32 +0200
+
 clam (0.99.0-1) feisty; urgency=low
 
   * debian/control: python dependency required for libclam-dev
Index: debian/rules
===================================================================
--- debian/rules	(revisione 9958)
+++ debian/rules	(copia locale)
@@ -37,15 +37,14 @@
 configure: configure-stamp
 configure-stamp:
 	dh_testdir
-	cd $(CURDIR)/scons/libs; $(SCONS) configure
+	cd $(CURDIR); $(SCONS) configure
 	touch configure-stamp
 
 
 build: build-stamp
 build-stamp: configure-stamp 
 	dh_testdir
-	cd $(CURDIR)/scons/libs; $(SCONS) core processing audioio vmqt
-	cd $(CURDIR)
+	cd $(CURDIR); $(SCONS) core processing audioio
 	# First, tarballize the examples folder
 	tar zcvf examples.tar.gz examples
 	# and now doxygenate CLAM stuff
@@ -58,7 +57,7 @@
 	dh_testdir
 	dh_testroot
 	rm -f build-stamp configure-stamp
-	-cd $(CURDIR)/scons/libs && $(SCONS) -c
+	-cd $(CURDIR) && $(SCONS) -c
 	find $(CURDIR) -name .*sconf_temp* | xargs rm -rf
 	find $(CURDIR) -type f -name *.pyc | xargs rm -rf
 	find $(CURDIR) -type f -name *.o | xargs rm -rf
@@ -69,9 +68,9 @@
 	find $(CURDIR) -type f -name *.db | xargs rm -rf
 	-rm -rf $(CURDIR)/CLAM.tag $(CURDIR)/*.tar.gz $(CURDIR)/doxygen \
 	  $(CURDIR)/src/Defines/CLAMVersion.cxx src/Defines/CLAMVersion.hxx \
-		$(CURDIR)/scons/libs/.sconsign.dblite scons/libs/config.log \
-		$(CURDIR)/scons/libs/*/{*.conf,include,src,*.so*,*.pc,CLAM} \
-		$(CURDIR)/scons/libs/*.conf
+		$(CURDIR)/.sconsign.dblite scons/libs/config.log \
+		$(CURDIR)/*/{*.conf,include,src,*.so*,*.pc,CLAM} \
+		$(CURDIR)/*.conf
 	dh_clean 
 
 install: build
@@ -80,7 +79,7 @@
 	dh_clean -k 
 	dh_installdirs
 	mkdir -p $(CURDIR)/debian/tmp/usr
-	cd $(CURDIR)/scons/libs && scons install_prefix=$(CURDIR)/debian/tmp/usr install
+	cd $(CURDIR) && scons install_prefix=$(CURDIR)/debian/tmp/usr install
 	dh_install --sourcedir=debian/tmp
 
 # Build architecture-independent files here.
Index: src/Tools/SDIF/SDIFFile.cxx
===================================================================
--- src/Tools/SDIF/SDIFFile.cxx	(revisione 9944)
+++ src/Tools/SDIF/SDIFFile.cxx	(copia locale)
@@ -64,13 +64,14 @@
   	mode |= O_BINARY;
 	#endif
 
-		if (mFile==-1)												// if open file error
+		if (mFile==-1)
 		{
 			//Open the file only if unopened
 			mFile = open(mpName,mode,0644);
 		
-			if (mFile==-1)												// if open file error
+			if (mFile==-1)
 			{
+				// if open file error
 				throw CLAM::ErrOpenFile(mpName); 			// throw filename
 			}
 		}
@@ -81,7 +82,7 @@
 	/* close audio file */
 	void File::Close(void)
 	{
-		if (mFile!=-1)												// if open file error
+		if (mFile!=-1)
 		{
 			//Close the file only if unopened
 			close(mFile);
Index: src/Processing/SDIFIO/SDIFIn.cxx
===================================================================
--- src/Processing/SDIFIO/SDIFIn.cxx	(revisione 9944)
+++ src/Processing/SDIFIO/SDIFIn.cxx	(copia locale)
@@ -21,6 +21,7 @@
 
 #include "SDIFIn.hxx"
 #include "SpectrumConfig.hxx"
+#include "ErrOpenFile.hxx"
 #include "Frame.hxx"
 #include "Segment.hxx"
 #include "SpectralPeakArray.hxx"
@@ -78,34 +79,32 @@
 bool SDIFIn::ConcreteConfigure(const ProcessingConfig& c)
 {
 	CopyAsConcreteConfig(mConfig, c);
-	
-	if ( mConfig.GetFileName() == "nofile") // MRJ: default configuration provided, we just left the object "Unconfigured"
-	  return false;
 
+	return true;
+}
+
+bool SDIFIn::ConcreteStart()
+{
+
 	if(mpFile) delete mpFile;
 	mpFile = new SDIF::File(mConfig.GetFileName().c_str(),SDIF::File::eInput);
 
 	try
-	  {
-	    mpFile->Open();
-	  }
-	catch( Err& e )
 	{
-	  e.Print();
-	  return false;
+		mpFile->Open();
+		return true;
 	}
+	catch ( ErrOpenFile& e )
+	{
+		AddConfigErrorMessage("Inner exception thrown: File could not be opened");
+		AddConfigErrorMessage( e.what() );
 
-	mpFile->Close();//must leave closed file ready to start()
+		return false;
+	}
 
 	return true;
 }
 
-bool SDIFIn::ConcreteStart()
-{
-	mpFile->Open();
-	return true;
-}
-
 bool SDIFIn::ConcreteStop()
 {
 	mpFile->Close();
Index: src/Processing/SDIFIO/SDIFOut.cxx
===================================================================
--- src/Processing/SDIFIO/SDIFOut.cxx	(revisione 9944)
+++ src/Processing/SDIFIO/SDIFOut.cxx	(copia locale)
@@ -73,23 +73,8 @@
 
 bool SDIFOut::ConcreteStart()
 {
-	mpFile->Open();
 
-	return true;
-}
-
-bool SDIFOut::ConcreteStop()
-{
-	mpFile->Close();
-
-	return true;
-}
-
-bool SDIFOut::ConcreteConfigure(const ProcessingConfig& c)
-{
-	CopyAsConcreteConfig(mConfig, c);
 	if(mpFile) delete mpFile;
-
 	mpFile = new SDIF::File(mConfig.GetFileName().c_str(),SDIF::File::eOutput);
 
 	try
@@ -104,9 +89,25 @@
 
 		return false;
 	}
+
+	return true;
 }
 
+bool SDIFOut::ConcreteStop()
+{
+	mpFile->Close();
 
+	return true;
+}
+
+bool SDIFOut::ConcreteConfigure(const ProcessingConfig& c)
+{
+	CopyAsConcreteConfig(mConfig, c);
+
+	return true;
+}
+
+
 const ProcessingConfig& SDIFOut::GetConfig() const
 {
 	return mConfig;
_______________________________________________
Clam-devel mailing list
Clam-devel@llistes.projectes.lafarga.org
https://llistes.projectes.lafarga.org/cgi-bin/mailman/listinfo/clam-devel

Reply via email to