remove last msvc warnings

git-svn-id: svn://svn.code.sf.net/p/loki-lib/code/trunk@448 7ec92016-0320-0410-acc4-a06ded1c099a
This commit is contained in:
syntheticpp 2006-01-07 10:31:24 +00:00
parent e06a92ea87
commit f09bf76ce3
2 changed files with 13 additions and 8 deletions

View file

@ -204,7 +204,7 @@ namespace Loki
// read the result
operator int() const {
return result_;
return static_cast<int>(result_);
}
private:
@ -341,7 +341,7 @@ namespace Loki
memcpy(fmtBuf, fmt, (format_ - fmt) * sizeof(Char));
fmtBuf[format_ - fmt] = 0;
#ifdef _MSC_VER
const int stored = _snprintf(resultBuf,
const int stored = _snprintf_s(resultBuf,
#else
const int stored = snprintf(resultBuf,
#endif

View file

@ -16,6 +16,11 @@
#include "../SmallObj/timer.h"
#if defined(_MSC_VER)
#define sprintf sprintf_s
#define _snprintf _snprintf_s
#endif
using namespace std;
using namespace Loki;
@ -31,7 +36,7 @@ Integral2 RandomInt(Integral1 low, Integral2 up)
assert(n > 0);
const unsigned int bucket_size = RAND_MAX / n;
const size_t bucket_size = RAND_MAX / n;
assert(bucket_size > 0);
Integral2 r;
@ -39,7 +44,7 @@ Integral2 RandomInt(Integral1 low, Integral2 up)
r = Integral2(rand() / bucket_size);
while (r > n);
r += low2;
r = r + low2;
assert(r >= low2 && r <= up);
return r;
}
@ -147,8 +152,8 @@ int main(int argc, char** argv)
string formatSpec(lead + "|%");
// Generate a random set of flags
static const string flags("-+0 #");
unsigned int maxFlags = RandomInt(0u, flags.length() - 1);
for (unsigned int i = 0; i != maxFlags; ++i)
size_t maxFlags = RandomInt(0u, flags.length() - 1);
for (size_t i = 0; i != maxFlags; ++i)
{
formatSpec += flags[RandomInt(0u, flags.length() - 1)];
}
@ -175,12 +180,12 @@ int main(int argc, char** argv)
static const string type("cdeEfgGinopsuxX");*/
static const string type("cdeEfgGinosuxX");
const char typeSpec = type[RandomInt(0, type.size() - 1)];
const char typeSpec = type[RandomInt(0u, type.size() - 1)];
// Generate an optional type prefix
static const string prefix("hl");
if (typeSpec != 's' && RandomInt(0, 1))
{
formatSpec += prefix[RandomInt(0, prefix.size() - 1)];
formatSpec += prefix[RandomInt(0u, prefix.size() - 1)];
}
formatSpec += typeSpec;
formatSpec += '|';