summaryrefslogtreecommitdiffstats
path: root/nsprpub/pr/tests/pipeself.c
diff options
context:
space:
mode:
authorwolfbeast <mcwerewolf@wolfbeast.com>2020-01-02 21:01:38 +0100
committerwolfbeast <mcwerewolf@wolfbeast.com>2020-01-02 21:01:38 +0100
commitf7d30133221896638f7bf4f66c504255c4b14f48 (patch)
tree5f3e07a049f388a3a309a615b8884318f6668a98 /nsprpub/pr/tests/pipeself.c
parent26b297510a11758727438df4669357a2a2bc42ce (diff)
downloadUXP-f7d30133221896638f7bf4f66c504255c4b14f48.tar
UXP-f7d30133221896638f7bf4f66c504255c4b14f48.tar.gz
UXP-f7d30133221896638f7bf4f66c504255c4b14f48.tar.lz
UXP-f7d30133221896638f7bf4f66c504255c4b14f48.tar.xz
UXP-f7d30133221896638f7bf4f66c504255c4b14f48.zip
Issue #1338 - Part 1: Update NSPR to 4.24
Diffstat (limited to 'nsprpub/pr/tests/pipeself.c')
-rw-r--r--nsprpub/pr/tests/pipeself.c124
1 files changed, 62 insertions, 62 deletions
diff --git a/nsprpub/pr/tests/pipeself.c b/nsprpub/pr/tests/pipeself.c
index 52e6b1349..7066c58d1 100644
--- a/nsprpub/pr/tests/pipeself.c
+++ b/nsprpub/pr/tests/pipeself.c
@@ -94,7 +94,7 @@ int main(int argc, char **argv)
}
pongThread = PR_CreateThread(PR_USER_THREAD, PongThreadFunc, NULL,
- PR_PRIORITY_NORMAL, PR_GLOBAL_THREAD, PR_JOINABLE_THREAD, 0);
+ PR_PRIORITY_NORMAL, PR_GLOBAL_THREAD, PR_JOINABLE_THREAD, 0);
if (pongThread == NULL) {
fprintf(stderr, "PR_CreateThread failed\n");
exit(1);
@@ -144,72 +144,72 @@ int main(int argc, char **argv)
exit(1);
}
-#if defined(XP_UNIX) && !defined(SYMBIAN)
- /*
- * Test PR_Available for pipes
- */
+#if defined(XP_UNIX)
+ /*
+ * Test PR_Available for pipes
+ */
status = PR_CreatePipe(&ping_in, &ping_out);
if (status == PR_FAILURE) {
fprintf(stderr, "PR_CreatePipe failed\n");
exit(1);
}
- nBytes = PR_Write(ping_out, buf, 250);
- if (nBytes == -1) {
- fprintf(stderr, "PR_Write failed: (%d, %d)\n", PR_GetError(),
- PR_GetOSError());
- exit(1);
- }
- nBytes = PR_Available(ping_in);
- if (nBytes < 0) {
- fprintf(stderr, "PR_Available failed: (%d, %d)\n", PR_GetError(),
- PR_GetOSError());
- exit(1);
- } else if (nBytes != 250) {
- fprintf(stderr, "PR_Available: expected 250 bytes but got %d bytes\n",
- nBytes);
- exit(1);
- }
- printf("PR_Available: expected %d, got %d bytes\n",250, nBytes);
- /* read some data */
- nBytes = PR_Read(ping_in, buf, 7);
- if (nBytes == -1) {
- fprintf(stderr, "PR_Read failed\n");
- exit(1);
- }
- /* check available data */
- nBytes = PR_Available(ping_in);
- if (nBytes < 0) {
- fprintf(stderr, "PR_Available failed: (%d, %d)\n", PR_GetError(),
- PR_GetOSError());
- exit(1);
- } else if (nBytes != (250 - 7)) {
- fprintf(stderr, "PR_Available: expected 243 bytes but got %d bytes\n",
- nBytes);
- exit(1);
- }
- printf("PR_Available: expected %d, got %d bytes\n",243, nBytes);
- /* read all data */
- nBytes = PR_Read(ping_in, buf, sizeof(buf));
- if (nBytes == -1) {
- fprintf(stderr, "PR_Read failed\n");
- exit(1);
- } else if (nBytes != 243) {
- fprintf(stderr, "PR_Read failed: expected %d, got %d bytes\n",
- 243, nBytes);
- exit(1);
- }
- /* check available data */
- nBytes = PR_Available(ping_in);
- if (nBytes < 0) {
- fprintf(stderr, "PR_Available failed: (%d, %d)\n", PR_GetError(),
- PR_GetOSError());
- exit(1);
- } else if (nBytes != 0) {
- fprintf(stderr, "PR_Available: expected 0 bytes but got %d bytes\n",
- nBytes);
- exit(1);
- }
- printf("PR_Available: expected %d, got %d bytes\n", 0, nBytes);
+ nBytes = PR_Write(ping_out, buf, 250);
+ if (nBytes == -1) {
+ fprintf(stderr, "PR_Write failed: (%d, %d)\n", PR_GetError(),
+ PR_GetOSError());
+ exit(1);
+ }
+ nBytes = PR_Available(ping_in);
+ if (nBytes < 0) {
+ fprintf(stderr, "PR_Available failed: (%d, %d)\n", PR_GetError(),
+ PR_GetOSError());
+ exit(1);
+ } else if (nBytes != 250) {
+ fprintf(stderr, "PR_Available: expected 250 bytes but got %d bytes\n",
+ nBytes);
+ exit(1);
+ }
+ printf("PR_Available: expected %d, got %d bytes\n",250, nBytes);
+ /* read some data */
+ nBytes = PR_Read(ping_in, buf, 7);
+ if (nBytes == -1) {
+ fprintf(stderr, "PR_Read failed\n");
+ exit(1);
+ }
+ /* check available data */
+ nBytes = PR_Available(ping_in);
+ if (nBytes < 0) {
+ fprintf(stderr, "PR_Available failed: (%d, %d)\n", PR_GetError(),
+ PR_GetOSError());
+ exit(1);
+ } else if (nBytes != (250 - 7)) {
+ fprintf(stderr, "PR_Available: expected 243 bytes but got %d bytes\n",
+ nBytes);
+ exit(1);
+ }
+ printf("PR_Available: expected %d, got %d bytes\n",243, nBytes);
+ /* read all data */
+ nBytes = PR_Read(ping_in, buf, sizeof(buf));
+ if (nBytes == -1) {
+ fprintf(stderr, "PR_Read failed\n");
+ exit(1);
+ } else if (nBytes != 243) {
+ fprintf(stderr, "PR_Read failed: expected %d, got %d bytes\n",
+ 243, nBytes);
+ exit(1);
+ }
+ /* check available data */
+ nBytes = PR_Available(ping_in);
+ if (nBytes < 0) {
+ fprintf(stderr, "PR_Available failed: (%d, %d)\n", PR_GetError(),
+ PR_GetOSError());
+ exit(1);
+ } else if (nBytes != 0) {
+ fprintf(stderr, "PR_Available: expected 0 bytes but got %d bytes\n",
+ nBytes);
+ exit(1);
+ }
+ printf("PR_Available: expected %d, got %d bytes\n", 0, nBytes);
status = PR_Close(ping_in);
if (status == PR_FAILURE) {