From 8778ef5322c33b4aa656db8a810010df19b70235 Mon Sep 17 00:00:00 2001 From: David Robillard Date: Wed, 18 Jan 2012 01:33:57 +0000 Subject: Make serd_node_new_integer take int64_t instead of long. Turns out long is sometimes 32-bits even on modern 64-bit machines on certain insane Operating Systems... git-svn-id: http://svn.drobilla.net/serd/trunk@297 490d8e77-9747-427b-9fa3-0b8f29cee8a0 --- src/node.c | 10 +++++----- src/uri.c | 2 +- 2 files changed, 6 insertions(+), 6 deletions(-) (limited to 'src') diff --git a/src/node.c b/src/node.c index a5603d47..73976b44 100644 --- a/src/node.c +++ b/src/node.c @@ -193,12 +193,12 @@ serd_node_new_decimal(double d, unsigned frac_digits) SERD_API SerdNode -serd_node_new_integer(long i) +serd_node_new_integer(int64_t i) { - long abs_i = labs(i); - const long digits = (long)fmax(1.0, ceil(log10((double)abs_i + 1))); - char* buf = (char*)calloc(digits + 2, 1); - SerdNode node = { (const uint8_t*)buf, 0, 0, 0, SERD_LITERAL }; + int64_t abs_i = (i < 0) ? -i : i; + const unsigned digits = fmax(1.0, ceil(log10((double)abs_i + 1))); + char* buf = (char*)calloc(digits + 2, 1); + SerdNode node = { (const uint8_t*)buf, 0, 0, 0, SERD_LITERAL }; // Point s to the end char* s = buf + digits - 1; diff --git a/src/uri.c b/src/uri.c index 58609ba4..d329c4b5 100644 --- a/src/uri.c +++ b/src/uri.c @@ -28,7 +28,7 @@ is_windows_path(const uint8_t* path) return is_alpha(path[0]) && (path[1] == ':' || path[1] == '|') && (path[2] == '/' || path[2] == '\\'); } - + SERD_API const uint8_t* serd_uri_to_path(const uint8_t* uri) -- cgit v1.2.1