From 299e3f0ad6525b9456130d559362f29d09d85149 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Luk=C3=A1=C5=A1=20Lalinsk=C3=BD?= Date: Mon, 24 Jan 2011 07:32:31 +0000 Subject: [PATCH] Define a macro to properly construct std::bitset git-svn-id: svn://anonsvn.kde.org/home/kde/trunk/kdesupport/taglib@1216679 283d02a7-25f6-0310-bc7c-ecb5cbfe19da --- taglib/ape/apefooter.cpp | 2 +- taglib/mpc/mpcproperties.cpp | 2 +- taglib/mpeg/mpegheader.cpp | 2 +- taglib/toolkit/taglib.h | 6 ++++++ 4 files changed, 9 insertions(+), 3 deletions(-) diff --git a/taglib/ape/apefooter.cpp b/taglib/ape/apefooter.cpp index 6cef213b..0805e9e0 100644 --- a/taglib/ape/apefooter.cpp +++ b/taglib/ape/apefooter.cpp @@ -189,7 +189,7 @@ void Footer::parse(const ByteVector &data) // Read the flags - std::bitset<32> flags(static_cast(data.mid(20, 4).toUInt(false))); + std::bitset<32> flags(TAGLIB_CONSTRUCT_BITSET(data.mid(20, 4).toUInt(false))); d->headerPresent = flags[31]; d->footerPresent = !flags[30]; diff --git a/taglib/mpc/mpcproperties.cpp b/taglib/mpc/mpcproperties.cpp index b644053b..9adc6924 100644 --- a/taglib/mpc/mpcproperties.cpp +++ b/taglib/mpc/mpcproperties.cpp @@ -113,7 +113,7 @@ void MPC::Properties::read() if(d->version >= 7) { frames = d->data.mid(4, 4).toUInt(false); - std::bitset<32> flags(static_cast(d->data.mid(8, 4).toUInt(false))); + std::bitset<32> flags(TAGLIB_CONSTRUCT_BITSET(d->data.mid(8, 4).toUInt(false))); d->sampleRate = sftable[flags[17] * 2 + flags[16]]; d->channels = 2; } diff --git a/taglib/mpeg/mpegheader.cpp b/taglib/mpeg/mpegheader.cpp index ecd4fc84..c715dbc1 100644 --- a/taglib/mpeg/mpegheader.cpp +++ b/taglib/mpeg/mpegheader.cpp @@ -168,7 +168,7 @@ void MPEG::Header::parse(const ByteVector &data) return; } - std::bitset<32> flags(static_cast(data.toUInt())); + std::bitset<32> flags(TAGLIB_CONSTRUCT_BITSET(data.toUInt())); // Check for the second byte's part of the MPEG synch diff --git a/taglib/toolkit/taglib.h b/taglib/toolkit/taglib.h index 920f1b38..811d4584 100644 --- a/taglib/toolkit/taglib.h +++ b/taglib/toolkit/taglib.h @@ -36,6 +36,12 @@ #define TAGLIB_IGNORE_MISSING_DESTRUCTOR #endif +#if (defined(_MSC_VER) && _MSC_VER >= 1600) +#define TAGLIB_CONSTRUCT_BITSET(x) static_cast(x) +#else +#define TAGLIB_CONSTRUCT_BITSET(x) static_cast(x) +#endif + #include //! A namespace for all TagLib related classes and functions