From d2f4175c59c6eed8502b45b3ec2074b2b34f6f67 Mon Sep 17 00:00:00 2001 From: weidai Date: Sat, 5 May 2007 02:15:11 +0000 Subject: [PATCH] fix compile with Sun CC --- bench.cpp | 4 ++-- config.h | 2 +- hrtimer.cpp | 6 +----- hrtimer.h | 4 +++- 4 files changed, 7 insertions(+), 9 deletions(-) diff --git a/bench.cpp b/bench.cpp index ff7c39ea..d6d08782 100644 --- a/bench.cpp +++ b/bench.cpp @@ -234,7 +234,7 @@ void BenchMarkByName(const char *factoryName, size_t keyLength = 0, const char * } template -void BenchMarkByNameKeyLess(const char *factoryName, char *displayName=NULL, const NameValuePairs ¶ms = g_nullNameValuePairs, T *x=NULL) +void BenchMarkByNameKeyLess(const char *factoryName, const char *displayName=NULL, const NameValuePairs ¶ms = g_nullNameValuePairs, T *x=NULL) { std::string name = factoryName; if (displayName) @@ -252,7 +252,7 @@ void BenchmarkAll(double t, double hertz) g_allocatedTime = t; g_hertz = hertz; - char *cpb, *cpk; + const char *cpb, *cpk; if (g_hertz) { cpb = "Cycles Per Byte"; diff --git a/config.h b/config.h index 5c332a08..befc36ae 100644 --- a/config.h +++ b/config.h @@ -354,7 +354,7 @@ NAMESPACE_END #define CRYPTOPP_WIN32_AVAILABLE #endif -#if defined(__unix__) || defined(__MACH__) || defined(__NetBSD__) +#if defined(__unix__) || defined(__MACH__) || defined(__NetBSD__) || defined(__sun) #define CRYPTOPP_UNIX_AVAILABLE #endif diff --git a/hrtimer.cpp b/hrtimer.cpp index 2496774f..71c54927 100644 --- a/hrtimer.cpp +++ b/hrtimer.cpp @@ -86,12 +86,8 @@ TimerWord Timer::TicksPerSecond() return freq.QuadPart; #elif defined(CRYPTOPP_UNIX_AVAILABLE) return 1000000; -#elif defined(CLOCKS_PER_SEC) - return CLOCKS_PER_SEC; -#elif defined(CLK_TCK) - return CLK_TCK; #else - return 1000000; + return CLOCKS_PER_SEC; #endif } diff --git a/hrtimer.h b/hrtimer.h index 6bb83019..01c156ca 100644 --- a/hrtimer.h +++ b/hrtimer.h @@ -2,6 +2,9 @@ #define CRYPTOPP_HRTIMER_H #include "config.h" +#ifndef HIGHRES_TIMER_AVAILABLE +#include +#endif NAMESPACE_BEGIN(CryptoPP) @@ -12,7 +15,6 @@ NAMESPACE_BEGIN(CryptoPP) typedef word32 TimerWord; #endif #else - #include typedef clock_t TimerWord; #endif