From e039555d0eccdcf1a49b597c0f4c3ef9bdb2bca4 Mon Sep 17 00:00:00 2001 From: Thiago Macieira Date: Thu, 5 Mar 2015 22:47:28 -0800 Subject: Update strto(u)ll.c to not produce a warning with -Wcast-qual This only works if you #include from a C++ source, of course. The diff is updated to apply over the following sources: https://raw.githubusercontent.com/freebsd/freebsd/release/10.1.0/lib/libc/stdlib/strtoull.c https://raw.githubusercontent.com/freebsd/freebsd/release/10.1.0/lib/libc/stdlib/strtoll.c Change-Id: Ia0aac2f09e9245339951ffff13c8d5e2113d4f36 Reviewed-by: Lars Knoll --- ...reeBSD-strto-u-ll-functions-to-work-insid.patch | 24 ++++++++++++---------- src/3rdparty/freebsd/strtoll.c | 2 +- src/3rdparty/freebsd/strtoull.c | 2 +- 3 files changed, 15 insertions(+), 13 deletions(-) (limited to 'src/3rdparty/freebsd') diff --git a/src/3rdparty/freebsd/0001-Patch-the-FreeBSD-strto-u-ll-functions-to-work-insid.patch b/src/3rdparty/freebsd/0001-Patch-the-FreeBSD-strto-u-ll-functions-to-work-insid.patch index ac7580d5c4..b21d483a9c 100644 --- a/src/3rdparty/freebsd/0001-Patch-the-FreeBSD-strto-u-ll-functions-to-work-insid.patch +++ b/src/3rdparty/freebsd/0001-Patch-the-FreeBSD-strto-u-ll-functions-to-work-insid.patch @@ -9,15 +9,15 @@ Changes: - rename from strtoxx_l to qt_strtoxx (merging the two functions) - remove __restrict - remove the locale_t parameter and use ascii_isspace instead of isspace_l + - fix compilation with -Wcast-qual (requires C++) -Change-Id: I1e522e12da90eb35eefcf4025102dc11b22c60a5 --- - src/3rdparty/freebsd/strtoll.c | 27 +++++---------------------- - src/3rdparty/freebsd/strtoull.c | 27 +++++---------------------- - 2 files changed, 10 insertions(+), 44 deletions(-) + src/3rdparty/freebsd/strtoll.c | 27 ++++----------------------- + src/3rdparty/freebsd/strtoull.c | 27 ++++----------------------- + 2 files changed, 8 insertions(+), 46 deletions(-) diff --git a/src/3rdparty/freebsd/strtoll.c b/src/3rdparty/freebsd/strtoll.c -index 16a8196..0ded267 100644 +index 16a8196..7b4505e 100644 --- a/src/3rdparty/freebsd/strtoll.c +++ b/src/3rdparty/freebsd/strtoll.c @@ -32,18 +32,6 @@ @@ -39,7 +39,7 @@ index 16a8196..0ded267 100644 /* * Convert a string to a long long integer. * -@@ -51,15 +39,15 @@ __FBSDID("$FreeBSD$"); +@@ -51,15 +39,13 @@ __FBSDID("$FreeBSD$"); * alphabets and digits are each contiguous. */ long long @@ -72,7 +72,8 @@ index 16a8196..0ded267 100644 - acc = -acc; + acc = (unsigned long long) -(long long)acc; if (endptr != NULL) - *endptr = (char *)(any ? s - 1 : nptr); +- *endptr = (char *)(any ? s - 1 : nptr); ++ *endptr = const_cast(any ? s - 1 : nptr); return (acc); } -long long @@ -81,7 +82,7 @@ index 16a8196..0ded267 100644 - return strtoll_l(nptr, endptr, base, __get_locale()); -} diff --git a/src/3rdparty/freebsd/strtoull.c b/src/3rdparty/freebsd/strtoull.c -index dc40e0e..cb04adb 100644 +index dc40e0e..1eb9257 100644 --- a/src/3rdparty/freebsd/strtoull.c +++ b/src/3rdparty/freebsd/strtoull.c @@ -32,18 +32,6 @@ @@ -103,7 +104,7 @@ index dc40e0e..cb04adb 100644 /* * Convert a string to an unsigned long long integer. * -@@ -51,15 +39,15 @@ __FBSDID("$FreeBSD$"); +@@ -51,15 +39,13 @@ __FBSDID("$FreeBSD$"); * alphabets and digits are each contiguous. */ unsigned long long @@ -136,7 +137,8 @@ index dc40e0e..cb04adb 100644 - acc = -acc; + acc = (unsigned long long) -(long long)acc; if (endptr != NULL) - *endptr = (char *)(any ? s - 1 : nptr); +- *endptr = (char *)(any ? s - 1 : nptr); ++ *endptr = const_cast(any ? s - 1 : nptr); return (acc); } -unsigned long long @@ -145,5 +147,5 @@ index dc40e0e..cb04adb 100644 - return strtoull_l(nptr, endptr, base, __get_locale()); -} -- -1.8.4.5 +2.1.4 diff --git a/src/3rdparty/freebsd/strtoll.c b/src/3rdparty/freebsd/strtoll.c index 6f06e03dc8..7b4505eddc 100644 --- a/src/3rdparty/freebsd/strtoll.c +++ b/src/3rdparty/freebsd/strtoll.c @@ -129,6 +129,6 @@ noconv: } else if (neg) acc = (unsigned long long) -(long long)acc; if (endptr != NULL) - *endptr = (char *)(any ? s - 1 : nptr); + *endptr = const_cast(any ? s - 1 : nptr); return (acc); } diff --git a/src/3rdparty/freebsd/strtoull.c b/src/3rdparty/freebsd/strtoull.c index 7cb97f02f4..1eb92578d4 100644 --- a/src/3rdparty/freebsd/strtoull.c +++ b/src/3rdparty/freebsd/strtoull.c @@ -107,6 +107,6 @@ noconv: } else if (neg) acc = (unsigned long long) -(long long)acc; if (endptr != NULL) - *endptr = (char *)(any ? s - 1 : nptr); + *endptr = const_cast(any ? s - 1 : nptr); return (acc); } -- cgit v1.2.3