-
Notifications
You must be signed in to change notification settings - Fork 42
Fix warnings when building for Android and MinGW #186
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Conversation
65f4905 to
bd93f70
Compare
|
@JeromeMartinez I did not test with C++Builder (license expired). If there are still warnings there then maybe we need to Ran through Cppcheck, seems okay with only false positives Visual Studio code analysis found no issues. |
923d9e4 to
0bf4c82
Compare
JeromeMartinez
left a comment
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Your modifications don't do the same thing (signed vs unsigned), I needed to updated it like that for having it working correctly:
Source/ZenLib/Utils.cpp | 33 +++++++++++++++++----------------
1 file changed, 17 insertions(+), 16 deletions(-)
diff --git a/Source/ZenLib/Utils.cpp b/Source/ZenLib/Utils.cpp
index 452c0f0..4074c70 100644
--- a/Source/ZenLib/Utils.cpp
+++ b/Source/ZenLib/Utils.cpp
@@ -19,6 +19,7 @@
#include "ZenLib/Utils.h"
#include <cmath>
#include <complex>
+#include <limits>
//---------------------------------------------------------------------------
namespace ZenLib
@@ -972,10 +973,10 @@ void int64u_int32u (int64u BigInt, int32u &High, int32u &Low)
int32s float32_int32s (float32 F, bool Rounded)
{
//Out of boundaries
- if (F>=(float32)0x7FFFFFFF)
- return (int32s)0x7FFFFFFF;
- if (F<=(float32)0x80000000)
- return (int32s)0x80000000;
+ if (F>=(float32)std::numeric_limits<int32s>::max())
+ return std::numeric_limits<int32s>::max();
+ if (F<=(float32)std::numeric_limits<int32s>::min())
+ return std::numeric_limits<int32s>::min();
//Not rounded
if (!Rounded)
@@ -991,10 +992,10 @@ int32s float32_int32s (float32 F, bool Rounded)
int64s float32_int64s (float32 F, bool Rounded)
{
//Out of boundaries
- if (F>=(float32)0x7FFFFFFFFFFFFFFFLL)
- return (int64s)0x7FFFFFFFFFFFFFFFLL;
- if (F<=(float32)0x8000000000000000LL)
- return (int64s)0x8000000000000000LL;
+ if (F>=(float32)std::numeric_limits<int64s>::max())
+ return std::numeric_limits<int64s>::max();
+ if (F<=(float32)std::numeric_limits<int64s>::min())
+ return std::numeric_limits<int64s>::min();
//Not rounded
if (!Rounded)
@@ -1010,10 +1011,10 @@ int64s float32_int64s (float32 F, bool Rounded)
int32s float64_int32s (float64 F, bool Rounded)
{
//Out of boundaries
- if (F>=(float64)0x7FFFFFFF)
- return (int32s)0x7FFFFFFF;
- if (F<=(float64)0x80000000)
- return (int32s)0x80000000;
+ if (F>=(float64)std::numeric_limits<int32s>::max())
+ return std::numeric_limits<int32s>::max();
+ if (F<=(float64)std::numeric_limits<int32s>::min())
+ return std::numeric_limits<int32s>::min();
//Not rounded
if (!Rounded)
@@ -1029,10 +1030,10 @@ int32s float64_int32s (float64 F, bool Rounded)
int64s float64_int64s (float64 F, bool Rounded)
{
//Out of boundaries
- if (F>=(float64)0x7FFFFFFFFFFFFFFFLL)
- return (int64s)0x7FFFFFFFFFFFFFFFLL;
- if (F<=(float64)0x8000000000000000LL)
- return (int64s)0x8000000000000000LL;
+ if (F>=(float64)std::numeric_limits<int64s>::max())
+ return std::numeric_limits<int64s>::max();
+ if (F<=(float64)std::numeric_limits<int64s>::min())
+ return std::numeric_limits<int64s>::min();
//Not rounded
if (!Rounded)Please update the corresponding commit.
Co-Authored-By: Jérôme Martinez <jerome@mediaarea.net>
|
Thank you. |
Fix warnings when building for Android
Better select between gmtime, gmtime_r, gmtime_s and localtime, localtime_r, localtime_s as well as _s variants.
Change MinGW x64 CI to use newer UCRT variant.