GCC 4.3 fixes, thanks to Tom Browder

git-svn-id: svn://svn.code.sf.net/p/loki-lib/code/trunk@898 7ec92016-0320-0410-acc4-a06ded1c099a
This commit is contained in:
syntheticpp 2008-08-09 15:35:12 +00:00
parent 1ca2df042d
commit c6d6cada99
4 changed files with 9 additions and 13 deletions

View file

@ -516,7 +516,7 @@ namespace Loki
{ {
if(m_vKeys.empty()) if(m_vKeys.empty())
throw EvictionException(); throw EvictionException();
size_type random = static_cast<size_type>((m_vKeys.size()*rand())/int(RAND_MAX + 1)); size_type random = static_cast<size_type>((m_vKeys.size()*rand())/(static_cast<size_type>(RAND_MAX) + 1));
remove(*(m_vKeys.begin()+random)); remove(*(m_vKeys.begin()+random));
} }
const char* name(){return "random";} const char* name(){return "random";}

View file

@ -34,6 +34,9 @@
#include <pthread.h> #include <pthread.h>
#endif #endif
#if !defined(_WIN32) && !defined(_WIN64)
#include <unistd.h> // declares sleep under Linux
#endif
/** @par thread_local Keyword /** @par thread_local Keyword
The mutexes require compilers to provide thread local storage - meaning each The mutexes require compilers to provide thread local storage - meaning each

View file

@ -24,7 +24,7 @@
#include <cstdio> #include <cstdio>
#include <climits> #include <climits>
#include <string> #include <string>
#include <string> #include <cstring>
#include <stdexcept> #include <stdexcept>
#include <utility> #include <utility>
#include <cassert> #include <cassert>
@ -207,7 +207,7 @@ namespace Loki
result_ = -1; result_ = -1;
return *this; return *this;
} }
const size_t len = std::min(strlen(s), prec_); const size_t len = std::min(std::strlen(s), prec_);
if (width_ > len) { if (width_ > len) {
if (LeftJustify()) { if (LeftJustify()) {
Write(s, s + len); Write(s, s + len);
@ -397,15 +397,8 @@ namespace Loki
const Char hex1st = uppercase ? 'A' : 'a'; const Char hex1st = uppercase ? 'A' : 'a';
for (;;) { for (;;) {
const LOKI_SAFEFORMAT_UNSIGNED_LONG next = n / base; const LOKI_SAFEFORMAT_UNSIGNED_LONG next = n / base;
#ifdef _MSC_VER Char c = static_cast<Char>(n - next * base);
#pragma warning(push) c += (c <= static_cast<Char>(9)) ? '0' : static_cast<Char>(hex1st - 10);
#pragma warning(disable: 4244)
#endif
Char c = n - next * base;
#ifdef _MSC_VER
#pragma warning(pop)
#endif
c += (c <= 9) ? '0' : hex1st - 10;
*bufLast = c; *bufLast = c;
n = next; n = next;
if (n == 0) break; if (n == 0) break;

View file

@ -74,7 +74,7 @@ Loki::OrderedStatic<1,L1> l1;
Loki::OrderedStatic<2,L2> l2; Loki::OrderedStatic<2,L2> l2;
Loki::OrderedStatic<1, std::string, std::string(*)() > s1( &func ); Loki::OrderedStatic<1, std::string, std::string(*)() > s1( &func );
Loki::OrderedStatic<2, std::string, Loki::Seq<char *> > s2( "s2" ); Loki::OrderedStatic<2, std::string, Loki::Seq<const char *> > s2( "s2" );
Loki::OrderedStatic<1, Loki::Functor<int>, Loki::Seq<int(*)()> > f1(f); Loki::OrderedStatic<1, Loki::Functor<int>, Loki::Seq<int(*)()> > f1(f);