From 47e442de3876a36e3d91ac35b5b2c88780b45d46 Mon Sep 17 00:00:00 2001 From: Vadim Zeitlin Date: Mon, 4 Jul 2011 16:43:37 +0000 Subject: [PATCH] Fix harmless warning about double to long long conversion. Work around g++ -Wconversion warning by writing out the casts explicitly. A better solution would be to have wxLongLong::FromDouble() static function but it would have to be done after 2.9.2. git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@68152 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775 --- src/msw/mediactrl_am.cpp | 10 +++++++++- 1 file changed, 9 insertions(+), 1 deletion(-) diff --git a/src/msw/mediactrl_am.cpp b/src/msw/mediactrl_am.cpp index 95341cbdff..edcb971d6a 100644 --- a/src/msw/mediactrl_am.cpp +++ b/src/msw/mediactrl_am.cpp @@ -2020,7 +2020,15 @@ wxLongLong wxAMMediaBackend::GetDuration() case S_OK: // outDuration is in seconds, we need milliseconds - return static_cast(outDuration * 1000); +#ifdef wxLongLong_t + return static_cast(outDuration * 1000); +#else + // In principle it's possible to have video of duration greater + // than ~1193 hours which corresponds LONG_MAX in milliseconds so + // cast to wxLongLong first and multiply by 1000 only then to avoid + // the overflow (resulting in maximal duration of ~136 years). + return wxLongLong(static_cast(outDuration)) * 1000; +#endif } } -- 2.45.2