summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorDavid Robillard <d@drobilla.net>2008-12-21 22:48:35 +0000
committerDavid Robillard <d@drobilla.net>2008-12-21 22:48:35 +0000
commit1f173010b87ce43da9c3635ffda96629a5beef40 (patch)
tree15096f0cce317581bec01859ef83ae520cd6903a
parentf437b0aa5459fa16a4c24aefb523e06dda328bc0 (diff)
downloadraul-1f173010b87ce43da9c3635ffda96629a5beef40.tar.gz
raul-1f173010b87ce43da9c3635ffda96629a5beef40.tar.bz2
raul-1f173010b87ce43da9c3635ffda96629a5beef40.zip
Don't serialise Nan or infinite port values (fix ticket #312).
git-svn-id: http://svn.drobilla.net/lad/trunk/raul@1895 a436a847-0d15-0410-975c-d299462d15a1
-rw-r--r--raul/AtomRDF.hpp3
1 files changed, 3 insertions, 0 deletions
diff --git a/raul/AtomRDF.hpp b/raul/AtomRDF.hpp
index 518991f..365aade 100644
--- a/raul/AtomRDF.hpp
+++ b/raul/AtomRDF.hpp
@@ -21,6 +21,7 @@
#include <cstring>
#include <string>
#include <sstream>
+#include <math.h>
#include "raul/Atom.hpp"
#include "redlandmm/Node.hpp"
@@ -72,6 +73,8 @@ atom_to_node(Redland::World& world, const Atom& atom)
type = librdf_new_uri(world.world(), CUC("http://www.w3.org/2001/XMLSchema#integer"));
break;
case Atom::FLOAT:
+ if (isnan(atom.get_float()) || isinf(atom.get_float()))
+ break;
os.precision(8);
os << atom.get_float();
str = os.str();