summaryrefslogtreecommitdiff
path: root/TAO/examples/Advanced/ch_21/icp.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'TAO/examples/Advanced/ch_21/icp.cpp')
-rw-r--r--TAO/examples/Advanced/ch_21/icp.cpp30
1 files changed, 10 insertions, 20 deletions
diff --git a/TAO/examples/Advanced/ch_21/icp.cpp b/TAO/examples/Advanced/ch_21/icp.cpp
index 3a32948c9b5..4c3bb1c076a 100644
--- a/TAO/examples/Advanced/ch_21/icp.cpp
+++ b/TAO/examples/Advanced/ch_21/icp.cpp
@@ -123,15 +123,10 @@ ICP_offline(unsigned long id)
// exact temperature: 40%
static
-short
-vary_temp(short temp)
+long
+vary_temp(long temp)
{
- #if defined (__BORLANDC__) || defined (_MSC_VER)
- long r = ACE_OS::rand() % 50;
- #else
- long r = lrand48() % 50;
- #endif
-
+ long r = ACE_OS::rand() % 50;
long delta;
if (r < 5)
delta = 3;
@@ -141,12 +136,7 @@ vary_temp(short temp)
delta = 1;
else
delta = 0;
- #if defined (__BORLANDC__) || defined (_MSC_VER)
- if (ACE_OS::rand() % 2)
- #else
- if (lrand48() % 2)
- #endif
-
+ if (ACE_OS::rand() % 2)
delta = -delta;
return temp + delta;
@@ -192,7 +182,7 @@ private:
// determined by vary_temp().
static
-short
+long
actual_temp(const StateMap::iterator & pos)
{
long sum = 0;
@@ -258,15 +248,15 @@ ICP_get(
return -1; // Must be thermostat
ACE_OS::memcpy(
value, &pos->second.nominal_temp,
- std::min(len, sizeof(pos->second.nominal_temp))
+ ace_min(len, sizeof(pos->second.nominal_temp))
);
} else if (ACE_OS::strcmp(attr, "temperature") == 0) {
- short temp = actual_temp(pos);
- ACE_OS::memcpy(value, &temp, std::min(len, sizeof(temp)));
+ long temp = actual_temp(pos);
+ ACE_OS::memcpy(value, &temp, ace_min(len, sizeof(temp)));
} else if (ACE_OS::strcmp(attr, "MIN_TEMP") == 0) {
- ACE_OS::memcpy(value, &MIN_TEMP, std::min(len, sizeof(MIN_TEMP)));
+ ACE_OS::memcpy(value, &MIN_TEMP, ace_min(len, sizeof(MIN_TEMP)));
} else if (ACE_OS::strcmp(attr, "MAX_TEMP") == 0) {
- ACE_OS::memcpy(value, &MAX_TEMP, std::min(len, sizeof(MAX_TEMP)));
+ ACE_OS::memcpy(value, &MAX_TEMP, ace_min(len, sizeof(MAX_TEMP)));
} else {
return -1; // No such attribute
}