summaryrefslogtreecommitdiff
path: root/tests/SV_Shared_Memory_Test.cpp
diff options
context:
space:
mode:
authorjxh <jxh@ae88bc3d-4319-0410-8dbf-d08b4c9d3795>1997-05-24 01:12:07 +0000
committerjxh <jxh@ae88bc3d-4319-0410-8dbf-d08b4c9d3795>1997-05-24 01:12:07 +0000
commitd4d97b74ddb4632f44731e96987a4f3a1b4129aa (patch)
tree58685840c0a96883ed29fcf8c72d3136588bf1b7 /tests/SV_Shared_Memory_Test.cpp
parent518d1a487eb1df080f6b4bbdf1c8cbec7f3e8061 (diff)
downloadATCD-d4d97b74ddb4632f44731e96987a4f3a1b4129aa.tar.gz
Chuck Gehr pointed out some code that assumed ASCII alphabet. This is
now fixed.
Diffstat (limited to 'tests/SV_Shared_Memory_Test.cpp')
-rw-r--r--tests/SV_Shared_Memory_Test.cpp18
1 files changed, 6 insertions, 12 deletions
diff --git a/tests/SV_Shared_Memory_Test.cpp b/tests/SV_Shared_Memory_Test.cpp
index e5d7348c26a..e7e9eee727c 100644
--- a/tests/SV_Shared_Memory_Test.cpp
+++ b/tests/SV_Shared_Memory_Test.cpp
@@ -28,7 +28,9 @@ static ACE_Malloc<ACE_SHARED_MEMORY_POOL, ACE_SV_Semaphore_Simple> allocator;
const int SEM_KEY_1 = ACE_DEFAULT_SEM_KEY + 1;
const int SEM_KEY_2 = ACE_DEFAULT_SEM_KEY + 2;
+
const int SHMSZ = 27;
+const char SHMDATA[SHMSZ] = "abcdefghijklmnopqrstuvwxyz";
static int
parent (char *shm)
@@ -42,12 +44,8 @@ parent (char *shm)
ACE_ASSERT (synch.open (SEM_KEY_2,
ACE_SV_Semaphore_Complex::ACE_CREATE, 0) != -1);
- char *s = shm;
-
- for (char c = 'a'; c <= 'z'; c++)
- *s++ = c;
-
- *s = '\0';
+ for (int i = 0; i < SHMSZ; i++)
+ shm[i] = SHMDATA[i];
if (mutex.release () == -1)
ACE_ERROR ((LM_ERROR, "(%P) %p", "parent mutex.release"));
@@ -81,12 +79,8 @@ child (char *shm)
else
ACE_ERROR_RETURN ((LM_ERROR, "(%P) child mutex.tryacquire"), 1);
- char t = 'a';
- for (char *s = (char *) shm; *s != '\0'; s++)
- {
- ACE_ASSERT (t == s[0]);
- t++;
- }
+ for (int i = 0; i < SHMSZ; i++)
+ ACE_ASSERT (SHMDATA[i] == shm[i]);
if (synch.release () == -1)
ACE_ERROR_RETURN ((LM_ERROR, "(%P) child synch.release"), 1);