changeset 63:577b251cad2f

applied patch to fix bug related to numpy version string parsing
author gyorgyf
date Sat, 05 Oct 2013 13:36:27 +0100
parents 74703a562ce3
children 4ffac7dedddf
files vampy-main.cpp
diffstat 1 files changed, 12 insertions(+), 6 deletions(-) [+]
line wrap: on
line diff
--- a/vampy-main.cpp	Sat Oct 05 13:21:47 2013 +0100
+++ b/vampy-main.cpp	Sat Oct 05 13:36:27 2013 +0100
@@ -39,7 +39,7 @@
 #include "PyPlugin.h"
 #include "PyExtensionModule.h"
 #include "PyExtensionManager.h"
-
+#include <sstream>
 
 #ifdef _WIN32
 #define pathsep ('\\')
@@ -115,6 +115,7 @@
 #ifdef HAVE_NUMPY
 
 	string ver;
+	std::istringstream verStream;
 	float numpyVersion;
 
 	/// attmept to test numpy version before importing the array API
@@ -146,11 +147,16 @@
 
 	ver = PyString_AsString(pyVer);
 	ver = ver.substr(0,ver.rfind("."));
-	if(EOF == sscanf(ver.c_str(), "%f", &numpyVersion))
-	{
-		cerr << "Could not parse Numpy version information." << endl;
-		goto numpyFailure;
-	}
+	/*
+	Applied patch from here: http://vamp-plugins.org/forum/index.php/topic,162.msg387.html#msg387 to replace this:
+    if(EOF == sscanf(ver.c_str(), "%f", &numpyVersion))
+    {
+     cerr << "Could not parse Numpy version information." << endl;
+     goto numpyFailure;
+    }*/
+	// parse version string to float
+    verStream.str(ver);
+    verStream >> numpyVersion;
 
 	cerr << "Numpy runtime version: " << numpyVersion << endl;
 	if (numpyVersion < (float) NUMPY_SHORTVERSION) {