Fix errors and warnings found on VisualStudio 2005

This commit is contained in:
Jason Turner
2012-11-16 12:27:41 -07:00
parent 4c65e45598
commit afd27a4b01
2 changed files with 15 additions and 4 deletions

View File

@@ -538,13 +538,23 @@ namespace chaiscript
BOOST_ASSERT(sizeof(long) == sizeof(boost::uint64_t) || sizeof(long) * 2 == sizeof(boost::uint64_t));
if ((sizeof(long) < sizeof(boost::uint64_t))
&& (u >> ((sizeof(uint64_t) - sizeof(long)) * 8)) > 0)
#ifdef BOOST_MSVC
//Thank you MSVC, yes we know that a constant value is being used in the if
// statment in this compiler / architecture
#pragma warning(push)
#pragma warning(disable : 4127)
#endif
if ( sizeof(long) < sizeof(boost::uint64_t) && (u >> ((sizeof(boost::uint64_t) - sizeof(long)) * 8)) > 0)
{
//requires something bigger than long
longlong_ = true;
}
#ifdef BOOST_MSVC
#pragma warning(pop)
#endif
if (longlong_)
{
size = sizeof(boost::int64_t) * 8;
@@ -631,7 +641,7 @@ namespace chaiscript
}
if (Binary_()) {
std::string match(start, m_input_pos);
int64_t temp_int = 0;
boost::int64_t temp_int = 0;
size_t pos = 0, end = match.length();
while ((pos < end) && (pos < (2 + sizeof(int) * 8))) {

View File

@@ -7,6 +7,7 @@
#include <iostream>
#include <list>
#include <algorithm>
#include <chaiscript/chaiscript.hpp>
#include <boost/thread.hpp>
@@ -67,7 +68,7 @@ int main()
std::vector<boost::shared_ptr<boost::thread> > threads;
// Ensure at least two, but say only 7 on an 8 core processor
int num_threads = std::max(boost::thread::hardware_concurrency() - 1, 2u);
int num_threads = std::max<unsigned int>(boost::thread::hardware_concurrency() - 1, 2u);
for (int i = 0; i < num_threads; ++i)
{