Get rid of some warnings and link errors. WINCE_NSPRPUB_RELEASE_4_2_BETA1
authorblythe%netscape.com
Tue, 05 Feb 2002 19:24:59 +0000
branchWINCE_NSPRPUB_RELEASE_4_2_BETA1
changeset 2215 3be04aa844798c0763a0d54612cf09fb5c248785
parent 2214 fe4762e225e70ff56814bbf95448bcc340196974
child 2216 761d51ae4b868316b1d0a95395c264a57e870bfd
push idunknown
push userunknown
push dateunknown
Get rid of some warnings and link errors. Work in progress.
pr/src/io/prfile.c
pr/src/io/prio.c
pr/src/io/priometh.c
pr/src/io/prlog.c
pr/src/io/prsocket.c
--- a/pr/src/io/prfile.c
+++ b/pr/src/io/prfile.c
@@ -700,17 +700,17 @@ PR_IMPLEMENT(PRStatus) PR_CreatePipe(
     PRFileDesc **readPipe,
     PRFileDesc **writePipe
 )
 {
 #if defined(XP_MAC)
 #pragma unused (readPipe, writePipe)
 #endif
 
-#ifdef WIN32
+#if defined(WIN32) && !defined(WINCE)
     HANDLE readEnd, writeEnd;
     SECURITY_ATTRIBUTES pipeAttributes;
 
     if (!_pr_initialized) _PR_ImplicitInitialization();
 
     ZeroMemory(&pipeAttributes, sizeof(pipeAttributes));
     pipeAttributes.nLength = sizeof(pipeAttributes);
     pipeAttributes.bInheritHandle = TRUE;
--- a/pr/src/io/prio.c
+++ b/pr/src/io/prio.c
@@ -63,20 +63,22 @@ void _PR_InitIO(void)
     _pr_stdin->secret->md.sync_file_io = PR_TRUE;
     _pr_stdout->secret->md.sync_file_io = PR_TRUE;
     _pr_stderr->secret->md.sync_file_io = PR_TRUE;
 #endif
 #else
     /*
      * WINCE has some oddity of _getstdfilex to determine stdin, et. al.
      * As unsure what that code actually does, just get fileno here.
+     *
+     * How odd, _fileno returns a void*, so cast it...
      */
-    _pr_stdin = PR_AllocFileDesc(_fileno(stdin), methods);
-    _pr_stdout = PR_AllocFileDesc(_fileno(stdout), methods);
-    _pr_stderr = PR_AllocFileDesc(_fileno(stderr), methods);
+    _pr_stdin = PR_AllocFileDesc((PRInt32)_fileno(stdin), methods);
+    _pr_stdout = PR_AllocFileDesc((PRInt32)_fileno(stdout), methods);
+    _pr_stderr = PR_AllocFileDesc((PRInt32)_fileno(stderr), methods);
 #endif
 #else
     _pr_stdin = PR_AllocFileDesc(0, methods);
     _pr_stdout = PR_AllocFileDesc(1, methods);
     _pr_stderr = PR_AllocFileDesc(2, methods);
 #endif
     _PR_MD_INIT_FD_INHERITABLE(_pr_stdin, PR_TRUE);
     _PR_MD_INIT_FD_INHERITABLE(_pr_stdout, PR_TRUE);
--- a/pr/src/io/priometh.c
+++ b/pr/src/io/priometh.c
@@ -355,17 +355,17 @@ PR_IMPLEMENT(PRInt32) PR_EmulateSendFile
     PRUint32 addr_offset, mmap_len;
 
     /* Get file size */
     if (PR_SUCCESS != PR_GetOpenFileInfo(sfd->fd, &info)) {
         count = -1;
         goto done;
     }
     if (sfd->file_nbytes &&
-            (info.size < (sfd->file_offset + sfd->file_nbytes))) {
+            ((PRUint32)info.size < (sfd->file_offset + sfd->file_nbytes))) {
         /*
          * there are fewer bytes in file to send than specified
          */
         PR_SetError(PR_INVALID_ARGUMENT_ERROR, 0);
         count = -1;
         goto done;
     }
     if (sfd->file_nbytes)
--- a/pr/src/io/prlog.c
+++ b/pr/src/io/prlog.c
@@ -502,17 +502,22 @@ PR_IMPLEMENT(void) PR_LogFlush(void)
             }
         _PR_UNLOCK_LOG();
     }
 }
 
 PR_IMPLEMENT(void) PR_Abort(void)
 {
     PR_LogPrint("Aborting");
+
+#if !defined(WINCE)
     abort();
+#else
+    TerminateProcess(GetCurrentProcess(), 3 /* exit code, same as abort */);
+#endif
 }
 
 #if defined(XP_OS2)
 /*
  * Added definitions for DebugBreak() for 2 different OS/2 compilers.
  * Doing the int3 on purpose for Visual Age so that a developer can
  * step over the instruction if so desired.  Not always possible if
  * trapping due to exception handling IBM-AKR
@@ -536,17 +541,17 @@ PR_IMPLEMENT(void) PR_Assert(const char 
 #endif
 #ifdef XP_MAC
     dprintf("Assertion failure: %s, at %s:%d\n", s, file, ln);
 #endif
 #if defined(WIN32) || defined(XP_OS2)
     DebugBreak();
 #endif
 #ifndef XP_MAC
-    abort();
+    PR_Abort();
 #endif
 }
 
 #ifdef XP_MAC
 PR_IMPLEMENT(void) PR_Init_Log(void)
 {
 	_PR_InitLog();
 }
--- a/pr/src/io/prsocket.c
+++ b/pr/src/io/prsocket.c
@@ -59,17 +59,17 @@ static PRBool IsValidNetAddrLen(const PR
     /*
      * The definition of the length of a Unix domain socket address
      * is not uniform, so we don't check it.
      */
     if ((addr != NULL)
 #ifdef XP_UNIX
             && (addr->raw.family != AF_UNIX)
 #endif
-            && (PR_NETADDR_SIZE(addr) != addr_len)) {
+            && (PR_NETADDR_SIZE(addr) != (PRUintn)addr_len)) {
 #if defined(LINUX) && __GLIBC__ == 2 && __GLIBC_MINOR__ == 1
         /*
          * In glibc 2.1, struct sockaddr_in6 is 24 bytes.  In glibc 2.2
          * and in the 2.4 kernel, struct sockaddr_in6 has the scope_id
          * field and is 28 bytes.  It is possible for socket functions
          * to return an addr_len greater than sizeof(struct sockaddr_in6).
          * We need to allow that.  (Bugzilla bug #77264)
          */