Bugzilla bug #4464: cast enum PRThreadPriority to PRIntn before
authorwtc%netscape.com
Thu, 01 Apr 1999 04:16:12 +0000
changeset 522 8bcb2f3d5c7795375df3bbae37abfbe1e1d82f80
parent 521 89e51b24310bce73555b03290cf7ef78d06ad172
child 523 a835d6e823b49f54c2b81c30465c1c5f1fdf862d
push idunknown
push userunknown
push dateunknown
bugs4464
Bugzilla bug #4464: cast enum PRThreadPriority to PRIntn before doing comparisons so that enum PRThreadPriority is treated as a signed type. Thanks to Jeremy Lea <reg@shale.csir.co.za> for reporting this bug.
pr/src/threads/combined/pruthr.c
--- a/pr/src/threads/combined/pruthr.c
+++ b/pr/src/threads/combined/pruthr.c
@@ -1542,19 +1542,19 @@ ErrorExit:
 PR_IMPLEMENT(void) PR_SetThreadPriority(PRThread *thread,
     PRThreadPriority newPri)
 {
 
     /* 
     First, pin down the priority.  Not all compilers catch passing out of
     range enum here.  If we let bad values thru, priority queues won't work.
     */
-    if (newPri > PR_PRIORITY_LAST) {
+    if ((PRIntn)newPri > (PRIntn)PR_PRIORITY_LAST) {
         newPri = PR_PRIORITY_LAST;
-    } else if (newPri < PR_PRIORITY_FIRST) {
+    } else if ((PRIntn)newPri < (PRIntn)PR_PRIORITY_FIRST) {
         newPri = PR_PRIORITY_FIRST;
     }
         
     if ( _PR_IS_NATIVE_THREAD(thread) ) {
         thread->priority = newPri;
         _PR_MD_SET_PRIORITY(&(thread->md), newPri);
     } else _PR_SetThreadPriority(thread, newPri);
 }