Use universal typoes for cross-platform compatibility NSS_LIBPKIX_BRANCH
authorrichard.freedman%sun.com
Tue, 16 Aug 2005 19:12:52 +0000
branchNSS_LIBPKIX_BRANCH
changeset 6009 308445b1b6c5fc7625ea9fc701aa7d42275ef2fb
parent 6008 26d684d696b6c743d7af32af71bae3b8e39e3ca0
child 6018 c768926068983416dfca58b433f1b5bb489ba783
push idunknown
push userunknown
push dateunknown
Use universal typoes for cross-platform compatibility
security/nss/cmd/libpkix/pkix_pl/module/socket/test_socket.c
--- a/security/nss/cmd/libpkix/pkix_pl/module/socket/test_socket.c
+++ b/security/nss/cmd/libpkix/pkix_pl/module/socket/test_socket.c
@@ -123,17 +123,17 @@ PKIX_Boolean server()
 			(rendezvousSock,
 			rcvBuf1,
 			sizeof(rcvBuf1),
 			&bytesRead,
 			plContext));
 
 		if (bytesRead >= 0) {
 			/* confirm that rcvBuf1 = sendBuf1 */
-			if ((bytesRead != strlen(sendBuf1) + 1) ||
+			if ((bytesRead != (PRInt32)PL_strlen(sendBuf1) + 1) ||
 			    (strncmp(sendBuf1, rcvBuf1, bytesRead) != 0)) {
 				testError("Receive buffer mismatch\n");
 			}
 
 			serverState = SERVER_SEND2;
 			keepGoing = PKIX_TRUE;
 		} else {
 			serverState = SERVER_POLL1;
@@ -141,17 +141,17 @@ PKIX_Boolean server()
 		break;
 	case SERVER_POLL1:
 		subTest("SERVER_POLL1");
 		PKIX_TEST_EXPECT_NO_ERROR(rvCallbackList->pollCallback
 			(rendezvousSock, NULL, &bytesRead, plContext));
 
 		if (bytesRead >= 0) {
 			/* confirm that rcvBuf1 = sendBuf1 */
-			if ((bytesRead != strlen(sendBuf1) + 1) ||
+			if ((bytesRead != (PRInt32)PL_strlen(sendBuf1) + 1) ||
 			    (strncmp(sendBuf1, rcvBuf1, bytesRead) != 0)) {
 				testError("Receive buffer mismatch\n");
 			}
 
 			serverState = SERVER_SEND2;
 			keepGoing = PKIX_TRUE;
 		}
 		break;
@@ -290,33 +290,33 @@ PKIX_Boolean client() {
 			(cSock,
 			rcvBuf2,
 			sizeof(rcvBuf2),
 			&bytesRead,
 			plContext));
 
 		if (bytesRead >= 0) {
 			/* confirm that rcvBuf2 = sendBuf2 */
-			if ((bytesRead != strlen(sendBuf2) + 1) ||
+			if ((bytesRead != (PRInt32)PL_strlen(sendBuf2) + 1) ||
 			    (strncmp(sendBuf2, rcvBuf2, bytesRead) != 0)) {
 				testError("Receive buffer mismatch\n");
 			}
 			clientState = CLIENT_SEND3;
 			keepGoing = PKIX_TRUE;
 		} else {
 			clientState = CLIENT_POLL2;
 		}
 		break;
 	case CLIENT_POLL2:
 		subTest("CLIENT_POLL2");
 		PKIX_TEST_EXPECT_NO_ERROR(cCallbackList->pollCallback
 			(cSock, NULL, &bytesRead, plContext));
 		if (bytesRead >= 0) {
 			/* confirm that rcvBuf2 = sendBuf2 */
-			if ((bytesRead != strlen(sendBuf2) + 1) ||
+			if ((bytesRead != (PRInt32)PL_strlen(sendBuf2) + 1) ||
 			    (strncmp(sendBuf2, rcvBuf2, bytesRead) != 0)) {
 				testError("Receive buffer mismatch\n");
 			}
 			clientState = CLIENT_SEND3;
 		}
 		break;
 	case CLIENT_SEND3:
 		subTest("CLIENT_SEND3");
@@ -404,23 +404,23 @@ void dispatcher()
 	
 	} while ((serverState != SERVER_DONE) || (clientState != CLIENT_DONE));
 
 	PKIX_TEST_RETURN();
 }
 
 int main(int argc, char *argv[]) {
 
-	PKIX_UInt32 j = 0;
+	int j = 0;
 	PKIX_UInt32 actualMinorVersion;
 	char buf[PR_NETDB_BUF_SIZE];
 	char *serverName = NULL;
 	char *sepPtr = NULL;
 	PRHostEnt hostent;
-	PKIX_UInt32 portNum = 0;
+	PRUint16 portNum = 0;
 	PRStatus prstatus = PR_FAILURE;
 	PRErrorCode cStat = 0;
 	void *ipaddr = NULL;
 
 	PKIX_TEST_STD_VARS();
 
 	startTests("Socket");
 
@@ -444,32 +444,32 @@ int main(int argc, char *argv[]) {
                 goto cleanup;
 	}
 
 	serverName = argv[j + 1];
 	sepPtr = strchr(serverName, ':');
 	if (sepPtr) {
 		*sepPtr++ = '\0';
 		prstatus = PR_GetHostByName(serverName, buf, sizeof(buf), &hostent);
-		portNum = atoi(sepPtr);
+		portNum = (PRUint16)atoi(sepPtr);
 	} else {
 		prstatus = PR_GetHostByName(serverName, buf, sizeof(buf), &hostent);
-		portNum = LDAP_PORT;
+		portNum = (PRUint16)LDAP_PORT;
 	}
 
 	if ((prstatus != PR_SUCCESS) || (hostent.h_length != 4)) {
                 printUsage(argv[0]);
                 pkixTestErrorMsg = "Invalid command line argument.";
                 goto cleanup;
 	}
 
 	netAddr.inet.family = PR_AF_INET;
 	netAddr.inet.port = PR_htons(portNum);
 	ipaddr = hostent.h_addr_list[0]; 
-	netAddr.inet.ip = PR_htonl(*(PKIX_UInt32 *)ipaddr); 
+	netAddr.inet.ip = PR_htonl(*(PRUint32 *)ipaddr); 
 
 	backlog = 5;
 
 	/* timeout = PR_INTERVAL_NO_TIMEOUT; */
 	timeout = 0;
 	/* timeout = 0; /* nonblocking */
 
 	PKIX_TEST_EXPECT_NO_ERROR(pkix_pl_Socket_Create