diff options
-rw-r--r-- | serd/serd.h | 2 | ||||
-rw-r--r-- | src/node.c | 10 | ||||
-rw-r--r-- | src/uri.c | 2 |
3 files changed, 7 insertions, 7 deletions
diff --git a/serd/serd.h b/serd/serd.h index 06e0af43..c69d0eaa 100644 --- a/serd/serd.h +++ b/serd/serd.h @@ -429,7 +429,7 @@ 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); /** Create a node by serialising @c buf into an xsd:base64Binary string. @@ -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; @@ -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) |