Bug 1307958 - -Werror=sign-compare in ./nsprpub subdirectory draft
authorISHIKAWA, Chiaki <ishikawa@yk.rim.or.jp>
Sat, 09 Nov 2019 11:00:01 +0900
changeset 81067 612a9d760177fb896e2c29c5dda0c00995a75087
parent 81066 689d1f0b5de889dfce734cda40753ddea4646f8f
child 81068 d049d4d11ddc23b590f2d55fada3e70a3afa87d7
push id9744
push userishikawa@yk.rim.or.jp
push dateSat, 09 Nov 2019 02:01:06 +0000
treeherdertry-comm-central@56c83244ac0e [default view] [failures only]
bugs1307958
Bug 1307958 - -Werror=sign-compare in ./nsprpub subdirectory
mozilla-M-C-005-nsprpub-sign-compare-rev01.patch
new file mode 100644
--- /dev/null
+++ b/mozilla-M-C-005-nsprpub-sign-compare-rev01.patch
@@ -0,0 +1,581 @@
+# HG changeset patch
+# User ISHIKAWA, Chiaki <ishikawa@yk.rim.or.jp>
+# Parent  4f914ee4145c7b6117cdc03fb58d9cc758d99879
+Bug 1307958 - -Werror=sign-compare in ./nsprpub subdirectory
+
+diff --git a/nsprpub/lib/libc/src/plgetopt.c b/nsprpub/lib/libc/src/plgetopt.c
+--- a/nsprpub/lib/libc/src/plgetopt.c
++++ b/nsprpub/lib/libc/src/plgetopt.c
+@@ -144,29 +144,29 @@ PR_IMPLEMENT(PLOptStatus) PL_GetNextOpt(
+     ** If we already have a '-' or '--' in hand, xargv points to the next
+     ** option. See if we can find a match in the list of possible
+     ** options supplied.
+     */
+     if (internal->minus == 2)
+     {
+         char * foundEqual = strchr(internal->xargv,'=');
+         PRIntn optNameLen = foundEqual ? (foundEqual - internal->xargv) :
+-                            strlen(internal->xargv);
++                              (PRIntn) strlen(internal->xargv);
+         const PLLongOpt *longOpt = internal->longOpts;
+         PLOptStatus result = PL_OPT_BAD;
+ 
+         opt->option = 0;
+         opt->value  = NULL;
+ 
+         for (; longOpt->longOptName; ++longOpt)
+         {
+             if (strncmp(longOpt->longOptName, internal->xargv, optNameLen)) {
+                 continue;    /* not a possible match */
+             }
+-            if (strlen(longOpt->longOptName) != optNameLen) {
++            if (strlen(longOpt->longOptName) != (size_t) optNameLen) {
+                 continue;    /* not a match */
+             }
+             /* option name match */
+             opt->longOptIndex = longOpt - internal->longOpts;
+             opt->longOption   = longOpt->longOption;
+             /* value is part of the current argv[] element if = was found */
+             /* note: this sets value even for long options that do not
+              * require option if specified as --long=value */
+diff --git a/nsprpub/pr/src/io/priometh.c b/nsprpub/pr/src/io/priometh.c
+--- a/nsprpub/pr/src/io/priometh.c
++++ b/nsprpub/pr/src/io/priometh.c
+@@ -330,17 +330,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))) {
++        ((unsigned long int) 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) {
+diff --git a/nsprpub/pr/src/io/prprf.c b/nsprpub/pr/src/io/prprf.c
+--- a/nsprpub/pr/src/io/prprf.c
++++ b/nsprpub/pr/src/io/prprf.c
+@@ -315,17 +315,17 @@ static int cvt_ll(SprintfState *ss, PRIn
+ ** XXX stop using snprintf to convert floating point
+ */
+ static int cvt_f(SprintfState *ss, double d, const char *fmt0, const char *fmt1)
+ {
+     char fin[20];
+     char fout[300];
+     int amount = fmt1 - fmt0;
+ 
+-    if (amount <= 0 || amount >= sizeof(fin)) {
++    if (amount <= 0 || (unsigned long int) amount >= sizeof(fin)) {
+         /* Totally bogus % command to snprintf. Just ignore it */
+         return 0;
+     }
+     memcpy(fin, fmt0, amount);
+     fin[amount] = 0;
+ 
+     /* Convert floating point using the native snprintf code */
+ #ifdef DEBUG
+@@ -941,17 +941,17 @@ do_longlong:
+ 
+             case 'e':
+             case 'E':
+             case 'f':
+             case 'g':
+                 u.d = nas ? nap->u.d : va_arg(ap, double);
+                 if( nas != NULL ) {
+                     i = fmt - dolPt;
+-                    if( i < sizeof( pattern ) ) {
++                    if( (unsigned long int) i < sizeof( pattern ) ) {
+                         pattern[0] = '%';
+                         memcpy( &pattern[1], dolPt, i );
+                         rv = cvt_f(ss, u.d, pattern, &pattern[i+1] );
+                     }
+                 } else {
+                     rv = cvt_f(ss, u.d, fmt0, fmt);
+                 }
+ 
+diff --git a/nsprpub/pr/src/md/unix/unix.c b/nsprpub/pr/src/md/unix/unix.c
+--- a/nsprpub/pr/src/md/unix/unix.c
++++ b/nsprpub/pr/src/md/unix/unix.c
+@@ -3512,17 +3512,17 @@ PRStatus _MD_CreateFileMap(PRFileMap *fm
+     PRFileInfo info;
+     PRUint32 sz;
+ 
+     LL_L2UI(sz, size);
+     if (sz) {
+         if (PR_GetOpenFileInfo(fmap->fd, &info) == PR_FAILURE) {
+             return PR_FAILURE;
+         }
+-        if (sz > info.size) {
++        if (sz > (unsigned) info.size) {
+             /*
+              * Need to extend the file
+              */
+             if (fmap->prot != PR_PROT_READWRITE) {
+                 PR_SetError(PR_NO_ACCESS_RIGHTS_ERROR, 0);
+                 return PR_FAILURE;
+             }
+             if (PR_Seek(fmap->fd, sz - 1, PR_SEEK_SET) == -1) {
+diff --git a/nsprpub/pr/src/misc/prdtoa.c b/nsprpub/pr/src/misc/prdtoa.c
+--- a/nsprpub/pr/src/misc/prdtoa.c
++++ b/nsprpub/pr/src/misc/prdtoa.c
+@@ -567,17 +567,19 @@ Balloc
+     }
+     else {
+         x = 1 << k;
+ #ifdef Omit_Private_Memory
+         rv = (Bigint *)MALLOC(sizeof(Bigint) + (x-1)*sizeof(ULong));
+ #else
+         len = (sizeof(Bigint) + (x-1)*sizeof(ULong) + sizeof(double) - 1)
+               /sizeof(double);
+-        if (k <= Kmax && pmem_next - private_mem + len <= PRIVATE_mem) {
++        if (k <= Kmax &&
++            0 <= pmem_next - private_mem + len &&
++            (long unsigned int) (pmem_next - private_mem + len) <= PRIVATE_mem) {
+             rv = (Bigint*)pmem_next;
+             pmem_next += len;
+         }
+         else {
+             rv = (Bigint*)MALLOC(len*sizeof(double));
+         }
+ #endif
+         rv->k = k;
+@@ -2759,17 +2761,17 @@ rv_alloc(i) int i;
+ #else
+ rv_alloc(int i)
+ #endif
+ {
+     int j, k, *r;
+ 
+     j = sizeof(ULong);
+     for(k = 0;
+-        sizeof(Bigint) - sizeof(ULong) - sizeof(int) + j <= i;
++        (int) sizeof(Bigint) - (int) sizeof(ULong) - (int) sizeof(int) + j <= i;
+         j <<= 1) {
+         k++;
+     }
+     r = (int*)Balloc(k);
+     *r = k;
+     return
+ #ifndef MULTIPLE_THREADS
+         dtoa_result =
+diff --git a/nsprpub/pr/src/misc/prnetdb.c b/nsprpub/pr/src/misc/prnetdb.c
+--- a/nsprpub/pr/src/misc/prnetdb.c
++++ b/nsprpub/pr/src/misc/prnetdb.c
+@@ -678,17 +678,17 @@ PR_IMPLEMENT(PRStatus) PR_GetHostByName(
+ #endif
+ 
+     if (!_pr_initialized) {
+         _PR_ImplicitInitialization();
+     }
+ 
+ #if defined(_PR_HAVE_GETHOST_R)
+     tmpbuf = localbuf;
+-    if (bufsize > sizeof(localbuf))
++    if ((unsigned long int) bufsize > sizeof(localbuf))
+     {
+         tmpbuf = (char *)PR_Malloc(bufsize);
+         if (NULL == tmpbuf)
+         {
+             PR_SetError(PR_OUT_OF_MEMORY_ERROR, 0);
+             return rv;
+         }
+     }
+@@ -875,17 +875,17 @@ PR_IMPLEMENT(PRStatus) PR_GetIPNodeByNam
+     }
+     else {
+         md_af = af;
+     }
+ #endif
+ 
+ #if defined(_PR_HAVE_GETHOST_R)
+     tmpbuf = localbuf;
+-    if (bufsize > sizeof(localbuf))
++    if ((unsigned long int) bufsize > sizeof(localbuf))
+     {
+         tmpbuf = (char *)PR_Malloc(bufsize);
+         if (NULL == tmpbuf)
+         {
+             PR_SetError(PR_OUT_OF_MEMORY_ERROR, 0);
+             return rv;
+         }
+     }
+@@ -1080,17 +1080,17 @@ PR_IMPLEMENT(PRStatus) PR_GetHostByAddr(
+         PR_ASSERT(hostaddr->raw.family == AF_INET);
+         PR_ASSERT(af == AF_INET);
+         addr = &hostaddr->inet.ip;
+         addrlen = sizeof(hostaddr->inet.ip);
+     }
+ 
+ #if defined(_PR_HAVE_GETHOST_R)
+     tmpbuf = localbuf;
+-    if (bufsize > sizeof(localbuf))
++    if ((unsigned long int) bufsize > sizeof(localbuf))
+     {
+         tmpbuf = (char *)PR_Malloc(bufsize);
+         if (NULL == tmpbuf)
+         {
+             PR_SetError(PR_OUT_OF_MEMORY_ERROR, 0);
+             return rv;
+         }
+     }
+diff --git a/nsprpub/pr/src/pthreads/ptio.c b/nsprpub/pr/src/pthreads/ptio.c
+--- a/nsprpub/pr/src/pthreads/ptio.c
++++ b/nsprpub/pr/src/pthreads/ptio.c
+@@ -229,17 +229,17 @@ PRBool IsValidNetAddr(const PRNetAddr *a
+ static PRBool IsValidNetAddrLen(const PRNetAddr *addr, PRInt32 addr_len)
+ {
+     /*
+      * The definition of the length of a Unix domain socket address
+      * is not uniform, so we don't check it.
+      */
+     if ((addr != NULL)
+         && (addr->raw.family != AF_UNIX)
+-        && (PR_NETADDR_SIZE(addr) != addr_len)) {
++        && (PR_NETADDR_SIZE(addr) != (unsigned) 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)
+          */
+@@ -767,17 +767,17 @@ static PRBool pt_connect_cont(pt_Continu
+     return PR_TRUE; /* this one is cooked */
+ }  /* pt_connect_cont */
+ 
+ static PRBool pt_accept_cont(pt_Continuation *op, PRInt16 revents)
+ {
+     op->syserrno = 0;
+     op->result.code = accept(
+                           op->arg1.osfd, op->arg2.buffer, op->arg3.addr_len);
+-    if (-1 == op->result.code)
++    if ((unsigned) -1 == (unsigned) op->result.code)
+     {
+         op->syserrno = errno;
+         if (EWOULDBLOCK == errno || EAGAIN == errno || ECONNABORTED == errno) {
+             return PR_FALSE;    /* do nothing - this one ain't finished */
+         }
+     }
+     return PR_TRUE;
+ }  /* pt_accept_cont */
+@@ -787,17 +787,17 @@ static PRBool pt_read_cont(pt_Continuati
+     /*
+      * Any number of bytes will complete the operation. It need
+      * not (and probably will not) satisfy the request. The only
+      * error we continue is EWOULDBLOCK|EAGAIN.
+      */
+     op->result.code = read(
+                           op->arg1.osfd, op->arg2.buffer, op->arg3.amount);
+     op->syserrno = errno;
+-    return ((-1 == op->result.code) &&
++    return (((unsigned) -1 == (unsigned) op->result.code) &&
+             (EWOULDBLOCK == op->syserrno || EAGAIN == op->syserrno)) ?
+            PR_FALSE : PR_TRUE;
+ }  /* pt_read_cont */
+ 
+ static PRBool pt_recv_cont(pt_Continuation *op, PRInt16 revents)
+ {
+     /*
+      * Any number of bytes will complete the operation. It need
+@@ -811,17 +811,17 @@ static PRBool pt_recv_cont(pt_Continuati
+     else
+         op->result.code = recv(
+                               op->arg1.osfd, op->arg2.buffer, op->arg3.amount, op->arg4.flags);
+ #else
+     op->result.code = recv(
+                           op->arg1.osfd, op->arg2.buffer, op->arg3.amount, op->arg4.flags);
+ #endif
+     op->syserrno = errno;
+-    return ((-1 == op->result.code) &&
++    return (((unsigned) -1 == (unsigned) op->result.code) &&
+             (EWOULDBLOCK == op->syserrno || EAGAIN == op->syserrno)) ?
+            PR_FALSE : PR_TRUE;
+ }  /* pt_recv_cont */
+ 
+ static PRBool pt_send_cont(pt_Continuation *op, PRInt16 revents)
+ {
+     PRIntn bytes;
+ #if defined(SOLARIS)
+@@ -920,20 +920,20 @@ static PRBool pt_writev_cont(pt_Continua
+      * a pair altogether.
+      */
+     bytes = writev(op->arg1.osfd, iov, op->arg3.amount);
+     op->syserrno = errno;
+     if (bytes >= 0)  /* this is progress */
+     {
+         PRIntn iov_index;
+         op->result.code += bytes;  /* accumulate the number sent */
+-        for (iov_index = 0; iov_index < op->arg3.amount; ++iov_index)
++        for (iov_index = 0; iov_index < (int) op->arg3.amount; ++iov_index)
+         {
+             /* how much progress did we make in the i/o vector? */
+-            if (bytes < iov[iov_index].iov_len)
++            if ((unsigned) bytes < iov[iov_index].iov_len)
+             {
+                 /* this element's not done yet */
+                 char **bp = (char**)&(iov[iov_index].iov_base);
+                 iov[iov_index].iov_len -= bytes;  /* there's that much left */
+                 *bp += bytes;  /* starting there */
+                 break;  /* go off and do that */
+             }
+             bytes -= iov[iov_index].iov_len;  /* that element's consumed */
+@@ -979,17 +979,17 @@ static PRBool pt_sendto_cont(pt_Continua
+ 
+ static PRBool pt_recvfrom_cont(pt_Continuation *op, PRInt16 revents)
+ {
+     pt_SockLen addr_len = sizeof(PRNetAddr);
+     op->result.code = recvfrom(
+                           op->arg1.osfd, op->arg2.buffer, op->arg3.amount,
+                           op->arg4.flags, (struct sockaddr*)op->arg5.addr, &addr_len);
+     op->syserrno = errno;
+-    return ((-1 == op->result.code) &&
++    return (((unsigned) -1 == (unsigned) op->result.code) &&
+             (EWOULDBLOCK == op->syserrno || EAGAIN == op->syserrno)) ?
+            PR_FALSE : PR_TRUE;
+ }  /* pt_recvfrom_cont */
+ 
+ #ifdef AIX
+ static PRBool pt_aix_sendfile_cont(pt_Continuation *op, PRInt16 revents)
+ {
+     struct sf_parms *sf_struct = (struct sf_parms *) op->arg2.buffer;
+@@ -1160,17 +1160,17 @@ static PRBool pt_linux_sendfile_cont(pt_
+         if (op->syserrno != EWOULDBLOCK && op->syserrno != EAGAIN) {
+             op->result.code = -1;
+             return PR_TRUE;
+         }
+         rv = 0;
+     }
+     PR_ASSERT(rv == op->offset - oldoffset);
+     op->result.code += rv;
+-    if (rv < op->count) {
++    if (rv < (ssize_t) op->count) {
+         op->count -= rv;
+         return PR_FALSE;
+     }
+     return PR_TRUE;
+ }
+ #endif  /* LINUX */
+ 
+ void _PR_InitIO(void)
+@@ -1291,27 +1291,27 @@ static void pt_MapError(void (*mapper)(P
+         default:
+             mapper(syserrno);
+     }
+ }  /* pt_MapError */
+ 
+ static PRStatus pt_Close(PRFileDesc *fd)
+ {
+     if ((NULL == fd) || (NULL == fd->secret)
+-        || ((_PR_FILEDESC_OPEN != fd->secret->state)
+-            && (_PR_FILEDESC_CLOSED != fd->secret->state)))
++        || ((_PR_FILEDESC_OPEN != (unsigned) fd->secret->state)
++            && (_PR_FILEDESC_CLOSED != (unsigned) fd->secret->state)))
+     {
+         PR_SetError(PR_BAD_DESCRIPTOR_ERROR, 0);
+         return PR_FAILURE;
+     }
+     if (pt_TestAbort()) {
+         return PR_FAILURE;
+     }
+ 
+-    if (_PR_FILEDESC_OPEN == fd->secret->state)
++    if (_PR_FILEDESC_OPEN == (unsigned) fd->secret->state)
+     {
+         if (-1 == close(fd->secret->md.osfd))
+         {
+             pt_MapError(_PR_MD_MAP_CLOSE_ERROR, errno);
+             return PR_FAILURE;
+         }
+         fd->secret->state = _PR_FILEDESC_CLOSED;
+     }
+@@ -1433,17 +1433,17 @@ static PRInt32 pt_Writev(
+             /*
+              * If we moved some bytes, how does that implicate the
+              * i/o vector list?  In other words, exactly where are
+              * we within that array?  What are the parameters for
+              * resumption?  Maybe we're done!
+              */
+             for ( ; osiov_len > 0; osiov++, osiov_len--)
+             {
+-                if (bytes < osiov->iov_len)
++                if ((unsigned) bytes < osiov->iov_len)
+                 {
+                     /* this one's not done yet */
+                     osiov->iov_base = (char*)osiov->iov_base + bytes;
+                     osiov->iov_len -= bytes;
+                     break;  /* go off and do that */
+                 }
+                 bytes -= osiov->iov_len;  /* this one's done cooked */
+             }
+@@ -2824,17 +2824,17 @@ static PRInt32 pt_LinuxSendFile(PRFileDe
+                 count = -1;
+                 goto failed;
+             }
+             rv = 0;
+         }
+         PR_ASSERT(rv == offset - sfd->file_offset);
+         count += rv;
+ 
+-        if (rv < file_nbytes_to_send) {
++        if (rv < (ssize_t) file_nbytes_to_send) {
+             pt_Continuation op;
+ 
+             op.arg1.osfd = sd->secret->md.osfd;
+             op.in_fd = sfd->fd->secret->md.osfd;
+             op.offset = offset;
+             op.count = file_nbytes_to_send - rv;
+             op.result.code = count;
+             op.timeout = timeout;
+@@ -2866,17 +2866,17 @@ failed:
+             _PR_MD_MAP_SETSOCKOPT_ERROR(errno);
+             count = -1;
+         }
+     }
+     if (count != -1) {
+         if (flags & PR_TRANSMITFILE_CLOSE_SOCKET) {
+             PR_Close(sd);
+         }
+-        PR_ASSERT(count == sfd->hlen + sfd->tlen + file_nbytes_to_send);
++        PR_ASSERT((unsigned) count == sfd->hlen + sfd->tlen + file_nbytes_to_send);
+     }
+     return count;
+ }
+ #endif  /* LINUX */
+ 
+ #ifdef AIX
+ extern  int _pr_aix_send_file_use_disabled;
+ #endif
+@@ -4075,24 +4075,24 @@ static PRInt32 _pr_poll_with_poll(
+     }
+     else
+     {
+ #define STACK_POLL_DESC_COUNT 64
+         struct pollfd stack_syspoll[STACK_POLL_DESC_COUNT];
+         struct pollfd *syspoll;
+         PRIntn index, msecs;
+ 
+-        if (npds <= STACK_POLL_DESC_COUNT)
++        if (npds <= (int) STACK_POLL_DESC_COUNT)
+         {
+             syspoll = stack_syspoll;
+         }
+         else
+         {
+             PRThread *me = PR_GetCurrentThread();
+-            if (npds > me->syspoll_count)
++            if (npds > (int) me->syspoll_count)
+             {
+                 PR_Free(me->syspoll_list);
+                 me->syspoll_list =
+                     (struct pollfd*)PR_MALLOC(npds * sizeof(struct pollfd));
+                 if (NULL == me->syspoll_list)
+                 {
+                     me->syspoll_count = 0;
+                     PR_SetError(PR_OUT_OF_MEMORY_ERROR, 0);
+@@ -4149,17 +4149,17 @@ static PRInt32 _pr_poll_with_poll(
+                 {
+                     /* now locate the NSPR layer at the bottom of the stack */
+                     PRFileDesc *bottom = PR_GetIdentitiesLayer(
+                                              pds[index].fd, PR_NSPR_IO_LAYER);
+                     /* ignore a socket without PR_NSPR_IO_LAYER available */
+ 
+                     pds[index].out_flags = 0;  /* pre-condition */
+                     if ((NULL != bottom)
+-                        && (_PR_FILEDESC_OPEN == bottom->secret->state))
++                        && (_PR_FILEDESC_OPEN == (unsigned) bottom->secret->state))
+                     {
+                         if (0 == ready)
+                         {
+                             syspoll[index].fd = bottom->secret->md.osfd;
+                             syspoll[index].events = 0;
+                             if (in_flags_read & PR_POLL_READ)
+                             {
+                                 pds[index].out_flags |=
+@@ -5030,17 +5030,17 @@ PR_IMPLEMENT(PRInt32) PR_SetSysfdTableSi
+     PRInt32 tableMax = PR_GetSysfdTableMax();
+ 
+     if (tableMax < 0) {
+         return -1;
+     }
+     rlim.rlim_max = tableMax;
+ 
+     /* Grow as much as we can; even if too big */
+-    if ( rlim.rlim_max < table_size ) {
++    if ( rlim.rlim_max < (unsigned) table_size ) {
+         rlim.rlim_cur = rlim.rlim_max;
+     }
+     else {
+         rlim.rlim_cur = table_size;
+     }
+ 
+     if ( setrlimit(RLIMIT_NOFILE, &rlim) < 0) {
+         return -1;
+diff --git a/nsprpub/pr/src/pthreads/ptthread.c b/nsprpub/pr/src/pthreads/ptthread.c
+--- a/nsprpub/pr/src/pthreads/ptthread.c
++++ b/nsprpub/pr/src/pthreads/ptthread.c
+@@ -212,17 +212,17 @@ static void *_pt_root(void *arg)
+         while (!thred->okToDelete) {
+             PR_WaitCondVar(pt_book.cv, PR_INTERVAL_NO_TIMEOUT);
+         }
+     }
+ 
+     if (thred->state & PT_THREAD_SYSTEM) {
+         pt_book.system -= 1;
+     }
+-    else if (--pt_book.user == pt_book.this_many) {
++    else if (--pt_book.user == (signed) pt_book.this_many) {
+         PR_NotifyAllCondVar(pt_book.cv);
+     }
+     if (NULL == thred->prev) {
+         pt_book.first = thred->next;
+     }
+     else {
+         thred->prev->next = thred->next;
+     }
+@@ -473,17 +473,17 @@ static PRThread* _PR_CreateThread(
+ 
+         if (0 != rv)
+         {
+             PRIntn oserr = rv;
+             PR_Lock(pt_book.ml);
+             if (thred->state & PT_THREAD_SYSTEM) {
+                 pt_book.system -= 1;
+             }
+-            else if (--pt_book.user == pt_book.this_many) {
++            else if (--pt_book.user == (signed) pt_book.this_many) {
+                 PR_NotifyAllCondVar(pt_book.cv);
+             }
+             PR_Unlock(pt_book.ml);
+ 
+             PR_Free(thred->stack);
+             PR_Free(thred);  /* all that work ... poof! */
+             PR_SetError(PR_INSUFFICIENT_RESOURCES_ERROR, oserr);
+             thred = NULL;  /* and for what? */
+@@ -1122,17 +1122,17 @@ PR_IMPLEMENT(PRStatus) PR_Cleanup(void)
+ {
+     PRThread *me = PR_GetCurrentThread();
+     int rv;
+     PR_LOG(_pr_thread_lm, PR_LOG_MIN, ("PR_Cleanup: shutting down NSPR"));
+     PR_ASSERT(me->state & PT_THREAD_PRIMORD);
+     if (me->state & PT_THREAD_PRIMORD)
+     {
+         PR_Lock(pt_book.ml);
+-        while (pt_book.user > pt_book.this_many) {
++        while (pt_book.user > (signed) pt_book.this_many) {
+             PR_WaitCondVar(pt_book.cv, PR_INTERVAL_NO_TIMEOUT);
+         }
+         if (me->state & PT_THREAD_SYSTEM) {
+             pt_book.system -= 1;
+         }
+         else {
+             pt_book.user -= 1;
+         }