summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorlevine <levine@ae88bc3d-4319-0410-8dbf-d08b4c9d3795>1998-05-21 22:33:15 +0000
committerlevine <levine@ae88bc3d-4319-0410-8dbf-d08b4c9d3795>1998-05-21 22:33:15 +0000
commit9712eb643d56c13011760442034ed0ee23b1d18d (patch)
treeef2281f04a6e52610c019fa830dac95e74314d8a
parent59b3b0d44c6eae415d2cb7a70e174f9f7148beab (diff)
downloadATCD-9712eb643d56c13011760442034ed0ee23b1d18d.tar.gz
(main): changed type of loop index to u_int to avoid signed/unsigned comparison.
-rw-r--r--TAO/tests/OctetSeq/OctetSeq.cpp146
1 files changed, 73 insertions, 73 deletions
diff --git a/TAO/tests/OctetSeq/OctetSeq.cpp b/TAO/tests/OctetSeq/OctetSeq.cpp
index 768fc476521..1bef9d85af2 100644
--- a/TAO/tests/OctetSeq/OctetSeq.cpp
+++ b/TAO/tests/OctetSeq/OctetSeq.cpp
@@ -27,8 +27,8 @@
static int
test_write_octet (TAO_OutputCDR &cdr,
- char* buf, size_t bufsize,
- CORBA::Environment& env)
+ char* buf, size_t bufsize,
+ CORBA::Environment& env)
{
Test::OctetSeq os (bufsize, bufsize, (CORBA::Octet*)buf);
@@ -40,8 +40,8 @@ test_write_octet (TAO_OutputCDR &cdr,
static int
test_read_octet (TAO_InputCDR &cdr,
- char* buf, size_t bufsize,
- CORBA::Environment& env)
+ char* buf, size_t bufsize,
+ CORBA::Environment& env)
{
Test::OctetSeq os;
@@ -51,7 +51,7 @@ test_read_octet (TAO_InputCDR &cdr,
/* || ACE_OS::memcmp( buf, os.get_buffer (), bufsize) != 0 */)
{
ACE_DEBUG ((LM_DEBUG,
- "OCTET: problem demarshalling or unmatched buffer\n"));
+ "OCTET: problem demarshalling or unmatched buffer\n"));
return -1;
}
return 0;
@@ -59,8 +59,8 @@ test_read_octet (TAO_InputCDR &cdr,
static int
test_write_char (TAO_OutputCDR &cdr,
- char* buf, size_t bufsize,
- CORBA::Environment& env)
+ char* buf, size_t bufsize,
+ CORBA::Environment& env)
{
Test::CharSeq cs (bufsize, bufsize, buf);
@@ -72,8 +72,8 @@ test_write_char (TAO_OutputCDR &cdr,
static int
test_read_char (TAO_InputCDR &cdr,
- char* buf, size_t bufsize,
- CORBA::Environment& env)
+ char* buf, size_t bufsize,
+ CORBA::Environment& env)
{
Test::CharSeq cs;
@@ -83,7 +83,7 @@ test_read_char (TAO_InputCDR &cdr,
/* || ACE_OS::memcmp( buf, cs.get_buffer (), bufsize) != 0 */)
{
ACE_DEBUG ((LM_DEBUG,
- "CHAR: problem demarshalling or unmatched buffer\n"));
+ "CHAR: problem demarshalling or unmatched buffer\n"));
return -1;
}
return 0;
@@ -91,12 +91,12 @@ test_read_char (TAO_InputCDR &cdr,
typedef
int (*Writer)(TAO_OutputCDR& cdr,
- char* buf, size_t bufsize,
- CORBA::Environment& env);
+ char* buf, size_t bufsize,
+ CORBA::Environment& env);
typedef
int (*Reader)(TAO_InputCDR& cdr,
- char* buf, size_t bufsize,
- CORBA::Environment& env);
+ char* buf, size_t bufsize,
+ CORBA::Environment& env);
int
run (char* buf, size_t bufsize,
@@ -116,13 +116,13 @@ run (char* buf, size_t bufsize,
TAO_OutputCDR output;
if (writer (output, buf, x, env) != 0)
- return -1;
+ return -1;
writing.stop_incr ();
reading.start_incr ();
TAO_InputCDR input (output);
if (reader (input, buf, x, env) != 0)
- return -1;
+ return -1;
reading.stop_incr ();
}
double m = n;
@@ -142,8 +142,8 @@ run (char* buf, size_t bufsize,
double write_average = ACE_static_cast(ACE_INT32,wusecs) / m;
double read_average = ACE_static_cast(ACE_INT32,rusecs) / m;
ACE_DEBUG ((LM_DEBUG,
- "%s: %d %.3f %.3f\n",
- name, x, write_average, read_average));
+ "%s: %d %.3f %.3f\n",
+ name, x, write_average, read_average));
}
return 0;
}
@@ -156,79 +156,79 @@ main (int argc, char *argv[])
CORBA::ORB_var orb = CORBA::ORB_init (argc,
argv,
0,
- TAO_TRY_ENV);
+ TAO_TRY_ENV);
TAO_CHECK_ENV;
-
+
int n = 64;
int lo = 64;
int hi = 128000;
int s = 4;
-
+
ACE_Get_Opt get_opt (argc, argv, "n:l:h:s:");
int opt;
-
+
while ((opt = get_opt ()) != EOF)
- {
- switch (opt)
- {
- case 'n':
- n = ACE_OS::atoi (get_opt.optarg);
- break;
- case 'l':
- lo = ACE_OS::atoi (get_opt.optarg);
- break;
- case 'h':
- hi = ACE_OS::atoi (get_opt.optarg);
- break;
- case 's':
- s = ACE_OS::atoi (get_opt.optarg);
- break;
- case '?':
- default:
- ACE_DEBUG ((LM_DEBUG,
- "Usage: %s "
- "-l low "
- "-h high "
- "-s step "
- "-n n "
- "\n"
- "Writes and then reads octet sequences to a CDR stream "
- "starting from <low> up to <high> incrementing "
- "by <step>, at each step run <n> iterations to "
- "average."
- "\n",
- argv[0]));
- return -1;
- }
- }
+ {
+ switch (opt)
+ {
+ case 'n':
+ n = ACE_OS::atoi (get_opt.optarg);
+ break;
+ case 'l':
+ lo = ACE_OS::atoi (get_opt.optarg);
+ break;
+ case 'h':
+ hi = ACE_OS::atoi (get_opt.optarg);
+ break;
+ case 's':
+ s = ACE_OS::atoi (get_opt.optarg);
+ break;
+ case '?':
+ default:
+ ACE_DEBUG ((LM_DEBUG,
+ "Usage: %s "
+ "-l low "
+ "-h high "
+ "-s step "
+ "-n n "
+ "\n"
+ "Writes and then reads octet sequences to a CDR stream "
+ "starting from <low> up to <high> incrementing "
+ "by <step>, at each step run <n> iterations to "
+ "average."
+ "\n",
+ argv[0]));
+ return -1;
+ }
+ }
ACE_DEBUG ((LM_DEBUG, "Running:\n"
- " low: %d\n"
- " hi : %d\n"
- " s : %d\n"
- " n : %d\n",
- lo, hi, s, n));
+ " low: %d\n"
+ " hi : %d\n"
+ " s : %d\n"
+ " n : %d\n",
+ lo, hi, s, n));
// Create a "big" buffer and fill it up.
char* buf = new char[hi];
CORBA::Long l = 0xdeadbeef;
- for (int i = 0; i < hi / sizeof (l); ++i)
- {
- ACE_OS::memcpy (buf + sizeof (l) * i, &l, sizeof (l));
- }
+ for (u_int i = 0; i < hi / sizeof (l); ++i)
+ {
+ ACE_OS::memcpy (buf + sizeof (l) * i, &l, sizeof (l));
+ }
if (run (buf, hi,
- n, lo, s,
- "OCTET", test_write_octet, test_read_octet,
- TAO_TRY_ENV) != 0)
- return 1;
+ n, lo, s,
+ "OCTET", test_write_octet, test_read_octet,
+ TAO_TRY_ENV) != 0)
+ return 1;
TAO_CHECK_ENV;
-
+
if (run (buf, hi,
- n, lo, s,
- "CHAR", test_write_char, test_read_char,
- TAO_TRY_ENV) != 0)
- return 1;
+ n, lo, s,
+ "CHAR", test_write_char, test_read_char,
+ TAO_TRY_ENV) != 0)
+ return 1;
TAO_CHECK_ENV;
delete[] buf;
}