Ravenports generated: 19 Oct 2020 02:49
[ravenports.git] / bucket_D2 / nspr
1 # Buildsheet autogenerated by ravenadm tool -- Do not edit.
2
3 NAMEBASE=               nspr
4 VERSION=                4.29
5 KEYWORDS=               devel
6 VARIANTS=               standard
7 SDESC[standard]=        Platform-neutral API for system-like functions
8 HOMEPAGE=               http://www.mozilla.org/projects/nspr/index.html
9 CONTACT=                nobody
10
11 DOWNLOAD_GROUPS=        main
12 SITES[main]=            MOZILLA/nspr/releases/v4.29/src
13 DISTFILE[1]=            nspr-4.29.tar.gz:main
14 DF_INDEX=               1
15 SPKGS[standard]=        single
16
17 OPTIONS_AVAILABLE=      none
18 OPTIONS_STANDARD=       none
19
20 USES=                   cpe gmake
21
22 DISTNAME=               nspr-4.29/nspr
23
24 CPE_PRODUCT=            netscape_portable_runtime
25 CPE_VENDOR=             mozilla
26 FPC_EQUIVALENT=         devel/nspr
27
28 MUST_CONFIGURE=         gnu
29 CONFIGURE_ARGS=         --enable-64bit
30
31 post-patch:
32         # Do not install tools to build itself
33         ${REINPLACE_CMD} -e '/RELEASE_BINS/d' \
34                 ${WRKSRC}/pr/src/misc/Makefile.in
35
36 post-install:
37         ${STRIP_CMD} ${STAGEDIR}${PREFIX}/lib/*.${LIBEXT}
38
39 [FILE:207:descriptions/desc.single]
40 Netscape Portable Runtime (NSPR) provides a platform-neutral API for
41 system level and libc like functions. The API is used in the Mozilla
42 client, many of Netscape/AOL/iPlanet's and other software offerings.
43
44
45 [FILE:95:distinfo]
46 22286bdb8059d74632cc7c2865c139e63953ecfb33bf4362ab58827e86e92582      1078192 nspr-4.29.tar.gz
47
48
49 [FILE:1124:manifests/plist.single]
50 bin/nspr-config
51 include/nspr/
52  nspr.h
53  plarena.h
54  plarenas.h
55  plbase64.h
56  plerror.h
57  plgetopt.h
58  plhash.h
59  plstr.h
60  pratom.h
61  prbit.h
62  prclist.h
63  prcmon.h
64  prcountr.h
65  prcpucfg.h
66  prcvar.h
67  prdtoa.h
68  prenv.h
69  prerr.h
70  prerror.h
71  prinet.h
72  prinit.h
73  prinrval.h
74  prio.h
75  pripcsem.h
76  prlink.h
77  prlock.h
78  prlog.h
79  prlong.h
80  prmem.h
81  prmon.h
82  prmwait.h
83  prnetdb.h
84  prolock.h
85  prpdce.h
86  prprf.h
87  prproces.h
88  prrng.h
89  prrwlock.h
90  prshm.h
91  prshma.h
92  prsystem.h
93  prthread.h
94  prtime.h
95  prtpool.h
96  prtrace.h
97  prtypes.h
98  prvrsion.h
99  prwin16.h
100 include/nspr/md/
101  _aix32.cfg
102  _aix64.cfg
103  _bsdi.cfg
104  _darwin.cfg
105  _dragonfly.cfg
106  _freebsd.cfg
107  _hpux32.cfg
108  _hpux64.cfg
109  _linux.cfg
110  _netbsd.cfg
111  _nto.cfg
112  _openbsd.cfg
113  _os2.cfg
114  _qnx.cfg
115  _riscos.cfg
116  _scoos.cfg
117  _solaris.cfg
118  _unixware.cfg
119  _unixware7.cfg
120  _win95.cfg
121  _winnt.cfg
122 include/nspr/obsolete/
123  pralarm.h
124  probslet.h
125  protypes.h
126  prsem.h
127 include/nspr/private/
128  pprio.h
129  pprthred.h
130  prpriv.h
131 @(,,444) lib/libnspr4.a
132 @(,,444) lib/libnspr4.so
133 @(,,444) lib/libplc4.a
134 @(,,444) lib/libplc4.so
135 @(,,444) lib/libplds4.a
136 @(,,444) lib/libplds4.so
137 lib/pkgconfig/nspr.pc
138 share/aclocal/nspr.m4
139
140
141 [FILE:1192:patches/patch-bug301986]
142 pthread_t can well be a 64-bit value -- on FreeBSD/amd64, for example.
143 Better to just keep calling it pthread_t isntead of casting to anything.
144
145         -mi
146
147 --- pr/include/private/pprthred.h.orig  2020-08-20 23:04:43 UTC
148 +++ pr/include/private/pprthred.h
149 @@ -11,6 +11,7 @@
150  ** developers only.
151  */
152  #include "nspr.h"
153 +#include <pthread.h>
154  
155  #if defined(XP_OS2)
156  #define INCL_DOS
157 @@ -59,7 +60,7 @@ NSPR_API(void) PR_DetachThread(void);
158  ** Get the id of the named thread. Each thread is assigned a unique id
159  ** when it is created or attached.
160  */
161 -NSPR_API(PRUint32) PR_GetThreadID(PRThread *thread);
162 +NSPR_API(pthread_t) PR_GetThreadID(PRThread *thread);
163  
164  /*
165  ** Set the procedure that is called when a thread is dumped. The procedure
166 --- pr/src/pthreads/ptthread.c.orig     2020-08-20 23:04:43 UTC
167 +++ pr/src/pthreads/ptthread.c
168 @@ -1183,9 +1183,9 @@ PR_IMPLEMENT(void) PR_ProcessExit(PRIntn
169      _exit(status);
170  }
171  
172 -PR_IMPLEMENT(PRUint32) PR_GetThreadID(PRThread *thred)
173 +PR_IMPLEMENT(pthread_t) PR_GetThreadID(PRThread *thred)
174  {
175 -    return (PRUint32)thred->id;  /* and I don't know what they will do with it */
176 +    return thred->id;  /* and I don't know what they will do with it */
177  }
178  
179  /*
180
181
182 [FILE:489:patches/patch-config_nspr.pc.in]
183 --- config/nspr.pc.in.orig      2020-08-20 23:04:43 UTC
184 +++ config/nspr.pc.in
185 @@ -6,5 +6,5 @@ includedir=@includedir@
186  Name: NSPR
187  Description: The Netscape Portable Runtime
188  Version: @MOD_MAJOR_VERSION@.@MOD_MINOR_VERSION@.@MOD_PATCH_VERSION@
189 -Libs: -L@libdir@ -lplds@MOD_MAJOR_VERSION@ -lplc@MOD_MAJOR_VERSION@ -lnspr@MOD_MAJOR_VERSION@
190 -Cflags: -I@includedir@
191 +Libs: -L${libdir} -lplds@MOD_MAJOR_VERSION@ -lplc@MOD_MAJOR_VERSION@ -lnspr@MOD_MAJOR_VERSION@ @OS_LIBS@
192 +Cflags: -I${includedir}
193
194
195 [FILE:2589:patches/patch-configure]
196 --- configure.orig      2020-08-20 23:04:43 UTC
197 +++ configure
198 @@ -6560,6 +6560,21 @@ tools are selected during the Xcode/Deve
199      fi
200      ;;
201  
202 +*-dragonfly*)
203 +    if test -z "$USE_NSPR_THREADS"; then
204 +        USE_PTHREADS=1
205 +    fi
206 +    $as_echo "#define XP_UNIX 1" >>confdefs.h
207 +    $as_echo "#define HAVE_BSD_FLOCK 1" >>confdefs.h
208 +    $as_echo "#define HAVE_SOCKLEN_T 1" >>confdefs.h
209 +    CFLAGS="$CFLAGS $(DSO_CFLAGS) -ansi -Wall"
210 +    MKSHLIB='$(CC) $(DSO_LDOPTS) -o $@'
211 +    DSO_CFLAGS=-fPIC
212 +    DSO_LDOPTS='-shared -Wl,-soname -Wl,$(notdir $@)'
213 +    MDCPUCFG_H=_dragonfly.cfg
214 +    PR_MD_CSRCS=freebsd.c
215 +    ;;
216 +
217  *-freebsd*)
218      if test -z "$USE_NSPR_THREADS"; then
219          USE_PTHREADS=1
220 @@ -7229,7 +7244,6 @@ $as_echo "$as_me: WARNING: Unknown versi
221      CPU_ARCH=`uname -p`
222      MDCPUCFG_H=_solaris.cfg
223      PR_MD_CSRCS=solaris.c
224 -    LD=/usr/ccs/bin/ld
225      MKSHLIB='$(CC) $(DSO_LDOPTS) -o $@'
226      RESOLVE_LINK_SYMBOLS=1
227      case "${OS_RELEASE}" in
228 @@ -7237,7 +7251,6 @@ $as_echo "$as_me: WARNING: Unknown versi
229          ;;
230      *)
231          # It is safe to use the -Bdirect linker flag on Solaris 10 or later.
232 -        USE_B_DIRECT=1
233          ;;
234      esac
235      if test -n "$GNU_CC"; then
236 @@ -7933,7 +7946,7 @@ $as_echo_n "checking whether ${CC-cc} ac
237         if test -z "`egrep -i '(unrecognize|unknown)' conftest.out | grep pthread`" && test -z "`egrep -i '(error|incorrect)' conftest.out`" ; then
238             ac_cv_have_dash_pthread=yes
239                 case "$target_os" in
240 -           freebsd*)
241 +           freebsd*|dragonfly*)
242  # Freebsd doesn't use -pthread for compiles, it uses them for linking
243              ;;
244             *)
245 @@ -7971,7 +7984,7 @@ $as_echo "$ac_cv_have_dash_pthreads" >&6
246              _PTHREAD_LDFLAGS=
247          fi
248             ;;
249 -    *-freebsd*)
250 +    *-freebsd*|*-dragonfly*)
251             $as_echo "#define _REENTRANT 1" >>confdefs.h
252  
253             $as_echo "#define _THREAD_SAFE 1" >>confdefs.h
254 @@ -8061,7 +8074,7 @@ case "$target" in
255  
256      fi
257      ;;
258 -*-freebsd*)
259 +*-freebsd*|*-dragonfly*)
260      if test -n "$USE_NSPR_THREADS"; then
261          $as_echo "#define _PR_LOCAL_THREADS_ONLY 1" >>confdefs.h
262  
263 @@ -8114,17 +8127,7 @@ _ACEOF
264  
265          $as_echo "#define HAVE_POINTER_LOCALTIME_R 1" >>confdefs.h
266  
267 -        if test "$OS_TEST" = "i86pc"; then
268 -            if test -n "$USE_64"; then
269 -               PR_MD_ASFILES=os_SunOS_x86_64.s
270 -            else
271 -               PR_MD_ASFILES=os_SunOS_x86.s
272 -            fi
273 -        else
274 -            if test -n "$USE_64"; then
275 -                PR_MD_ASFILES=os_SunOS_sparcv9.s
276 -            fi
277 -        fi
278 +        PR_MD_ASFILES=os_SunOS_x86_64.s
279      fi
280      ;;
281  *-nto*)
282
283
284 [FILE:29818:patches/patch-libtests]
285 --- lib/tests/arena.c.orig      2020-08-20 23:04:43 UTC
286 +++ lib/tests/arena.c
287 @@ -36,6 +36,7 @@ void DumpAll( void )
288      return;
289  }
290  
291 +#if 0
292  /*
293  ** Test Arena allocation.
294  */
295 @@ -96,6 +97,7 @@ static void ArenaGrow( void )
296  
297      return;
298  } /* end ArenaGrow() */
299 +#endif
300  
301  
302  /*
303 --- lib/tests/base64t.c.orig    2020-08-20 23:04:43 UTC
304 +++ lib/tests/base64t.c
305 @@ -2362,7 +2362,6 @@ PRBool test_008(void)
306      for( i = 0; i < sizeof(array)/sizeof(array[0]); i++ )
307      {
308          PRUint32 plen = PL_strlen(array[i].plaintext);
309 -        PRUint32 clen = ((plen + 2)/3)*4;
310  
311          char *rv = PL_Base64Encode(array[i].plaintext, plen, (char *)0);
312  
313 @@ -3122,9 +3121,6 @@ PRBool test_024(void)
314  
315      for( i = 0; i < sizeof(array)/sizeof(array[0]); i++ )
316      {
317 -        PRUint32 plen = PL_strlen(array[i].plaintext);
318 -        PRUint32 clen = ((plen + 2)/3)*4;
319 -
320          char *rv = PL_Base64Encode(array[i].plaintext, 0, (char *)0);
321  
322          if( (char *)0 == rv )
323 @@ -3258,8 +3254,6 @@ PRBool test_027(void)
324  
325      for( i = 0; i < sizeof(array)/sizeof(array[0]); i++ )
326      {
327 -        PRUint32 clen = PL_strlen(array[i].cyphertext);
328 -
329          char *rv = PL_Base64Decode(array[i].cyphertext, 0, (char *)0);
330  
331          if( (char *)0 == rv )
332 --- lib/tests/string.c.orig     2020-08-20 23:04:43 UTC
333 +++ lib/tests/string.c
334 @@ -127,7 +127,7 @@ PRBool test_003(void)
335          rv = PL_strcpy(array[i].dest, array[i].str);
336          if( array[i].rv != rv )
337          {
338 -            printf("FAIL %d: (0x%x, %s)->0x%x\n", i, array[i].dest,
339 +            printf("FAIL %d: (%p, %s)->%p\n", i, array[i].dest,
340                     array[i].str ? array[i].str : "(null)", rv);
341              return PR_FALSE;
342          }
343 @@ -240,8 +240,8 @@ PRBool test_004(void)
344          rv = PL_strncpy(array[i].dest, array[i].str, array[i].len);
345          if( array[i].rv != rv )
346          {
347 -            printf("FAIL %d: (0x%x, %s, %lu)->0x%x\n", i, array[i].dest,
348 -                   array[i].str ? array[i].str : "(null)", array[i].len, rv);
349 +            printf("FAIL %d: (%p, %s, %u)->%p\n", i, array[i].dest,
350 +                   array[i].str ? array[i].str : "(null)", (unsigned)array[i].len, rv);
351              return PR_FALSE;
352          }
353  
354 @@ -367,8 +367,8 @@ PRBool test_005(void)
355          rv = PL_strncpyz(array[i].dest, array[i].str, array[i].len);
356          if( array[i].rv != rv )
357          {
358 -            printf("FAIL %d: (0x%x, %s, %lu)->0x%x\n", i, array[i].dest,
359 -                   array[i].str ? array[i].str : "(null)", array[i].len, rv);
360 +            printf("FAIL %d: (%p, %s, %u)->%p\n", i, array[i].dest,
361 +                   array[i].str ? array[i].str : "(null)", (unsigned)array[i].len, rv);
362              return PR_FALSE;
363          }
364  
365 @@ -421,7 +421,7 @@ PRBool test_006(void)
366  
367          if( (char *)0 == rv )
368          {
369 -            printf("FAIL %d: 0x%x -> 0\n", i, array[i]);
370 +            printf("FAIL %d: %p -> 0\n", i, array[i]);
371              return PR_FALSE;
372          }
373  
374 @@ -507,8 +507,8 @@ PRBool test_007(void)
375  
376          if( (char *)0 == rv )
377          {
378 -            printf("FAIL %d: %s,%lu -> 0\n", i,
379 -                   array[i].str ? array[i].str : "(null)", array[i].len);
380 +            printf("FAIL %d: %s,%u -> 0\n", i,
381 +                   array[i].str ? array[i].str : "(null)", (unsigned)array[i].len);
382              return PR_FALSE;
383          }
384  
385 @@ -700,10 +700,10 @@ PRBool test_009(void)
386          {
387              if( (char *)0 != rv )
388              {
389 -                printf("FAIL %d: %s+%s/%lu -> %.32s, not zero\n", i,
390 +                printf("FAIL %d: %s+%s/%u -> %.32s, not zero\n", i,
391                         array[i].first ? array[i].first : "(null)",
392                         array[i].second ? array[i].second : "(null)",
393 -                       array[i].length, rv);
394 +                       (unsigned)array[i].length, rv);
395                  return PR_FALSE;
396              }
397          }
398 @@ -711,10 +711,10 @@ PRBool test_009(void)
399          {
400              if( (char *)0 == rv )
401              {
402 -                printf("FAIL %d: %s+%s/%lu -> null, not %s\n", i,
403 +                printf("FAIL %d: %s+%s/%u -> null, not %s\n", i,
404                         array[i].first ? array[i].first : "(null)",
405                         array[i].second ? array[i].second : "(null)",
406 -                       array[i].length, array[i].result);
407 +                       (unsigned)array[i].length, array[i].result);
408                  return PR_FALSE;
409              }
410              else
411 @@ -726,10 +726,10 @@ PRBool test_009(void)
412                  {
413                      if( *a != *b )
414                      {
415 -                        printf("FAIL %d: %s+%s/%lu -> %.32s, not %s\n", i,
416 +                        printf("FAIL %d: %s+%s/%u -> %.32s, not %s\n", i,
417                                 array[i].first ? array[i].first : "(null)",
418                                 array[i].second ? array[i].second : "(null)",
419 -                               array[i].length, rv, array[i].result);
420 +                               (unsigned)array[i].length, rv, array[i].result);
421                          return PR_FALSE;
422                      }
423  
424 @@ -741,10 +741,10 @@ PRBool test_009(void)
425                  {
426                      if( (char)0 != *b )
427                      {
428 -                        printf("FAIL %d: %s+%s/%lu -> not nulled\n", i,
429 +                        printf("FAIL %d: %s+%s/%u -> not nulled\n", i,
430                                 array[i].first ? array[i].first : "(null)",
431                                 array[i].second ? array[i].second : "(null)",
432 -                               array[i].length);
433 +                               (unsigned)array[i].length);
434                          return PR_FALSE;
435                      }
436                  }
437 @@ -752,10 +752,10 @@ PRBool test_009(void)
438                  {
439                      if( (char)0 == *b )
440                      {
441 -                        printf("FAIL %d: %s+%s/%lu -> overrun\n", i,
442 +                        printf("FAIL %d: %s+%s/%u -> overrun\n", i,
443                                 array[i].first ? array[i].first : "(null)",
444                                 array[i].second ? array[i].second : "(null)",
445 -                               array[i].length);
446 +                               (unsigned)array[i].length);
447                          return PR_FALSE;
448                      }
449                  }
450 @@ -832,10 +832,10 @@ PRBool test_010(void)
451          {
452              if( (char *)0 != rv )
453              {
454 -                printf("FAIL %d: %s+%s/%lu -> %.32s, not zero\n", i,
455 +                printf("FAIL %d: %s+%s/%u -> %.32s, not zero\n", i,
456                         array[i].first ? array[i].first : "(null)",
457                         array[i].second ? array[i].second : "(null)",
458 -                       array[i].length, rv);
459 +                       (unsigned)array[i].length, rv);
460                  return PR_FALSE;
461              }
462          }
463 @@ -843,10 +843,10 @@ PRBool test_010(void)
464          {
465              if( (char *)0 == rv )
466              {
467 -                printf("FAIL %d: %s+%s/%lu -> null, not %s\n", i,
468 +                printf("FAIL %d: %s+%s/%u -> null, not %s\n", i,
469                         array[i].first ? array[i].first : "(null)",
470                         array[i].second ? array[i].second : "(null)",
471 -                       array[i].length, array[i].result);
472 +                       (unsigned)array[i].length, array[i].result);
473                  return PR_FALSE;
474              }
475              else
476 @@ -858,10 +858,10 @@ PRBool test_010(void)
477                  {
478                      if( *a != *b )
479                      {
480 -                        printf("FAIL %d: %s+%s/%lu -> %.32s, not %s\n", i,
481 +                        printf("FAIL %d: %s+%s/%u -> %.32s, not %s\n", i,
482                                 array[i].first ? array[i].first : "(null)",
483                                 array[i].second ? array[i].second : "(null)",
484 -                               array[i].length, rv, array[i].result);
485 +                               (unsigned)array[i].length, rv, array[i].result);
486                          return PR_FALSE;
487                      }
488  
489 @@ -1104,10 +1104,10 @@ PRBool test_012(void)
490                  break;
491          }
492  
493 -        printf("FAIL %d: %s-%s/%ld -> %d, not %d\n", i,
494 +        printf("FAIL %d: %s-%s/%d -> %d, not %d\n", i,
495                 array[i].one ? array[i].one : "(null)",
496                 array[i].two ? array[i].two : "(null)",
497 -               array[i].max, rv, array[i].sign);
498 +               (int)array[i].max, rv, array[i].sign);
499          return PR_FALSE;
500      }
501  
502 @@ -1338,10 +1338,10 @@ PRBool test_014(void)
503                  break;
504          }
505  
506 -        printf("FAIL %d: %s-%s/%ld -> %d, not %d\n", i,
507 +        printf("FAIL %d: %s-%s/%d -> %d, not %d\n", i,
508                 array[i].one ? array[i].one : "(null)",
509                 array[i].two ? array[i].two : "(null)",
510 -               array[i].max, rv, array[i].sign);
511 +               (int)array[i].max, rv, array[i].sign);
512          return PR_FALSE;
513      }
514  
515 @@ -1411,15 +1411,15 @@ PRBool test_015(void)
516          {
517              if( (char *)0 == rv )
518              {
519 -                printf("FAIL %d: %s,%c -> null, not +%lu\n", i, array[i].str,
520 -                       array[i].chr, array[i].off);
521 +                printf("FAIL %d: %s,%c -> null, not +%u\n", i, array[i].str,
522 +                       array[i].chr, (unsigned)array[i].off);
523                  return PR_FALSE;
524              }
525  
526              if( &array[i].str[ array[i].off ] != rv )
527              {
528 -                printf("FAIL %d: %s,%c -> 0x%x, not 0x%x+%lu\n", i, array[i].str,
529 -                       array[i].chr, rv, array[i].str, array[i].off);
530 +                printf("FAIL %d: %s,%c -> %p, not %p+%u\n", i, array[i].str,
531 +                       array[i].chr, rv, array[i].str, (unsigned)array[i].off);
532                  return PR_FALSE;
533              }
534          }
535 @@ -1491,15 +1491,15 @@ PRBool test_016(void)
536          {
537              if( (char *)0 == rv )
538              {
539 -                printf("FAIL %d: %s,%c -> null, not +%lu\n", i, array[i].str,
540 -                       array[i].chr, array[i].off);
541 +                printf("FAIL %d: %s,%c -> null, not +%u\n", i, array[i].str,
542 +                       array[i].chr, (unsigned)array[i].off);
543                  return PR_FALSE;
544              }
545  
546              if( &array[i].str[ array[i].off ] != rv )
547              {
548 -                printf("FAIL %d: %s,%c -> 0x%x, not 0x%x+%lu\n", i, array[i].str,
549 -                       array[i].chr, rv, array[i].str, array[i].off);
550 +                printf("FAIL %d: %s,%c -> %p, not %p+%u\n", i, array[i].str,
551 +                       array[i].chr, rv, array[i].str, (unsigned)array[i].off);
552                  return PR_FALSE;
553              }
554          }
555 @@ -1566,8 +1566,8 @@ PRBool test_017(void)
556          {
557              if( (char *)0 != rv )
558              {
559 -                printf("FAIL %d: %s,%c/%lu -> %.32s, not zero\n", i, array[i].str,
560 -                       array[i].chr, array[i].max, rv);
561 +                printf("FAIL %d: %s,%c/%u -> %.32s, not zero\n", i, array[i].str,
562 +                       array[i].chr, (unsigned)array[i].max, rv);
563                  return PR_FALSE;
564              }
565          }
566 @@ -1575,15 +1575,15 @@ PRBool test_017(void)
567          {
568              if( (char *)0 == rv )
569              {
570 -                printf("FAIL %d: %s,%c/%lu -> null, not +%lu\n", i, array[i].str,
571 -                       array[i].chr, array[i].max, array[i].off);
572 +                printf("FAIL %d: %s,%c/%u -> null, not +%u\n", i, array[i].str,
573 +                       array[i].chr, (unsigned)array[i].max, (unsigned)array[i].off);
574                  return PR_FALSE;
575              }
576  
577              if( &array[i].str[ array[i].off ] != rv )
578              {
579 -                printf("FAIL %d: %s,%c/%lu -> 0x%x, not 0x%x+%lu\n", i, array[i].str,
580 -                       array[i].chr, array[i].max, rv, array[i].str, array[i].off);
581 +                printf("FAIL %d: %s,%c/%u -> %p, not %p+%u\n", i, array[i].str,
582 +                       array[i].chr, (unsigned)array[i].max, rv, array[i].str, (unsigned)array[i].off);
583                  return PR_FALSE;
584              }
585          }
586 @@ -1650,8 +1650,8 @@ PRBool test_018(void)
587          {
588              if( (char *)0 != rv )
589              {
590 -                printf("FAIL %d: %s,%c/%lu -> %.32s, not zero\n", i, array[i].str,
591 -                       array[i].chr, array[i].max, rv);
592 +                printf("FAIL %d: %s,%c/%u -> %.32s, not zero\n", i, array[i].str,
593 +                       array[i].chr, (unsigned)array[i].max, rv);
594                  return PR_FALSE;
595              }
596          }
597 @@ -1659,15 +1659,15 @@ PRBool test_018(void)
598          {
599              if( (char *)0 == rv )
600              {
601 -                printf("FAIL %d: %s,%c/%lu -> null, not +%lu\n", i, array[i].str,
602 -                       array[i].chr, array[i].max, array[i].off);
603 +                printf("FAIL %d: %s,%c/%u -> null, not +%u\n", i, array[i].str,
604 +                       array[i].chr, (unsigned)array[i].max, (unsigned)array[i].off);
605                  return PR_FALSE;
606              }
607  
608 -            if( &array[i].str[ array[i].off ] != rv )
609 +            if( &array[i].str[ array[i].off ] != rv)
610              {
611 -                printf("FAIL %d: %s,%c/%lu -> 0x%x, not 0x%x+%lu\n", i, array[i].str,
612 -                       array[i].chr, array[i].max, rv, array[i].str, array[i].off);
613 +                printf("FAIL %d: %s,%c/%u -> %p, not %p+%u\n", i, array[i].str,
614 +                       array[i].chr, (unsigned)array[i].max, rv, array[i].str, (unsigned)array[i].off);
615                  return PR_FALSE;
616              }
617          }
618 @@ -1746,19 +1746,19 @@ PRBool test_019(void)
619          {
620              if( (char *)0 == rv )
621              {
622 -                printf("FAIL %d: %s,%s -> null, not +%lu\n", i,
623 +                printf("FAIL %d: %s,%s -> null, not +%u\n", i,
624                         array[i].str ? array[i].str : "(null)",
625                         array[i].chrs ? array[i].chrs : "(null)",
626 -                       array[i].off);
627 +                       (unsigned)array[i].off);
628                  return PR_FALSE;
629              }
630  
631              if( &array[i].str[ array[i].off ] != rv )
632              {
633 -                printf("FAIL %d: %s,%s -> 0x%x, not 0x%x+%lu\n", i,
634 +                printf("FAIL %d: %s,%s -> %p, not %p+%u\n", i,
635                         array[i].str ? array[i].str : "(null)",
636                         array[i].chrs ? array[i].chrs : "(null)",
637 -                       rv, array[i].str, array[i].off);
638 +                       rv, array[i].str, (unsigned)array[i].off);
639                  return PR_FALSE;
640              }
641          }
642 @@ -1837,19 +1837,19 @@ PRBool test_020(void)
643          {
644              if( (char *)0 == rv )
645              {
646 -                printf("FAIL %d: %s,%s -> null, not +%lu\n", i,
647 +                printf("FAIL %d: %s,%s -> null, not +%u\n", i,
648                         array[i].str ? array[i].str : "(null)",
649                         array[i].chrs ? array[i].chrs : "(null)",
650 -                       array[i].off);
651 +                       (unsigned)array[i].off);
652                  return PR_FALSE;
653              }
654  
655              if( &array[i].str[ array[i].off ] != rv )
656              {
657 -                printf("FAIL %d: %s,%s -> 0x%x, not 0x%x+%lu\n", i,
658 +                printf("FAIL %d: %s,%s -> %p, not %p+%u\n", i,
659                         array[i].str ? array[i].str : "(null)",
660                         array[i].chrs ? array[i].chrs : "(null)",
661 -                       rv, array[i].str, array[i].off);
662 +                       rv, array[i].str, (unsigned)array[i].off);
663                  return PR_FALSE;
664              }
665          }
666 @@ -1923,10 +1923,10 @@ PRBool test_021(void)
667          {
668              if( (char *)0 != rv )
669              {
670 -                printf("FAIL %d: %s,%s/%lu -> %.32s, not null\n", i,
671 +                printf("FAIL %d: %s,%s/%u -> %.32s, not null\n", i,
672                         array[i].str ? array[i].str : "(null)",
673                         array[i].chrs ? array[i].chrs : "(null)",
674 -                       array[i].max, rv);
675 +                       (unsigned)array[i].max, rv);
676                  return PR_FALSE;
677              }
678          }
679 @@ -1934,19 +1934,19 @@ PRBool test_021(void)
680          {
681              if( (char *)0 == rv )
682              {
683 -                printf("FAIL %d: %s,%s/%lu -> null, not +%lu\n", i,
684 +                printf("FAIL %d: %s,%s/%u -> null, not +%u\n", i,
685                         array[i].str ? array[i].str : "(null)",
686                         array[i].chrs ? array[i].chrs : "(null)",
687 -                       array[i].max, array[i].off);
688 +                       (unsigned)array[i].max, array[i].off);
689                  return PR_FALSE;
690              }
691  
692              if( &array[i].str[ array[i].off ] != rv )
693              {
694 -                printf("FAIL %d: %s,%s/%lu -> 0x%x, not 0x%x+%lu\n", i,
695 +                printf("FAIL %d: %s,%s/%u -> %p, not %p+%u\n", i,
696                         array[i].str ? array[i].str : "(null)",
697                         array[i].chrs ? array[i].chrs : "(null)",
698 -                       array[i].max, rv, array[i].str, array[i].off);
699 +                       (unsigned)array[i].max, rv, array[i].str, array[i].off);
700                  return PR_FALSE;
701              }
702          }
703 @@ -2029,10 +2029,10 @@ PRBool test_022(void)
704          {
705              if( (char *)0 != rv )
706              {
707 -                printf("FAIL %d: %s,%s/%lu -> %.32s, not null\n", i,
708 +                printf("FAIL %d: %s,%s/%u -> %.32s, not null\n", i,
709                         array[i].str ? array[i].str : "(null)",
710                         array[i].chrs ? array[i].chrs : "(null)",
711 -                       array[i].max, rv);
712 +                       (unsigned)array[i].max, rv);
713                  return PR_FALSE;
714              }
715          }
716 @@ -2040,19 +2040,19 @@ PRBool test_022(void)
717          {
718              if( (char *)0 == rv )
719              {
720 -                printf("FAIL %d: %s,%s/%lu -> null, not +%lu\n", i,
721 +                printf("FAIL %d: %s,%s/%u -> null, not +%u\n", i,
722                         array[i].str ? array[i].str : "(null)",
723                         array[i].chrs ? array[i].chrs : "(null)",
724 -                       array[i].max, array[i].off);
725 +                       (unsigned)array[i].max, array[i].off);
726                  return PR_FALSE;
727              }
728  
729              if( &array[i].str[ array[i].off ] != rv )
730              {
731 -                printf("FAIL %d: %s,%s/%lu -> 0x%x, not 0x%x+%lu\n", i,
732 +                printf("FAIL %d: %s,%s/%u -> %p, not %p+%u\n", i,
733                         array[i].str ? array[i].str : "(null)",
734                         array[i].chrs ? array[i].chrs : "(null)",
735 -                       array[i].max, rv, array[i].str, array[i].off);
736 +                       (unsigned)array[i].max, rv, array[i].str, array[i].off);
737                  return PR_FALSE;
738              }
739          }
740 @@ -2148,19 +2148,19 @@ PRBool test_023(void)
741          {
742              if( (char *)0 == rv )
743              {
744 -                printf("FAIL %d: %s,%s -> null, not 0x%x+%lu\n", i,
745 +                printf("FAIL %d: %s,%s -> null, not %p+%u\n", i,
746                         array[i].str ? array[i].str : "(null)",
747                         array[i].sub ? array[i].sub : "(null)",
748 -                       array[i].str, array[i].off);
749 +                       array[i].str, (unsigned)array[i].off);
750                  return PR_FALSE;
751              }
752  
753              if( &array[i].str[ array[i].off ] != rv )
754              {
755 -                printf("FAIL %d: %s,%s -> 0x%x, not 0x%x+%lu\n", i,
756 +                printf("FAIL %d: %s,%s -> %p, not %p+%u\n", i,
757                         array[i].str ? array[i].str : "(null)",
758                         array[i].sub ? array[i].sub : "(null)",
759 -                       rv, array[i].str, array[i].off);
760 +                       rv, array[i].str, (unsigned)array[i].off);
761                  return PR_FALSE;
762              }
763          }
764 @@ -2256,19 +2256,19 @@ PRBool test_024(void)
765          {
766              if( (char *)0 == rv )
767              {
768 -                printf("FAIL %d: %s,%s -> null, not 0x%x+%lu\n", i,
769 +                printf("FAIL %d: %s,%s -> null, not %p+%u\n", i,
770                         array[i].str ? array[i].str : "(null)",
771                         array[i].sub ? array[i].sub : "(null)",
772 -                       array[i].str, array[i].off);
773 +                       array[i].str, (unsigned)array[i].off);
774                  return PR_FALSE;
775              }
776  
777              if( &array[i].str[ array[i].off ] != rv )
778              {
779 -                printf("FAIL %d: %s,%s -> 0x%x, not 0x%x+%lu\n", i,
780 +                printf("FAIL %d: %s,%s -> %p, not %p+%u\n", i,
781                         array[i].str ? array[i].str : "(null)",
782                         array[i].sub ? array[i].sub : "(null)",
783 -                       rv, array[i].str, array[i].off);
784 +                       rv, array[i].str, (unsigned)array[i].off);
785                  return PR_FALSE;
786              }
787          }
788 @@ -2375,10 +2375,10 @@ PRBool test_025(void)
789          {
790              if( (char *)0 != rv )
791              {
792 -                printf("FAIL %d: %s,%s/%lu -> %.32s, not null\n", i,
793 +                printf("FAIL %d: %s,%s/%u -> %.32s, not null\n", i,
794                         array[i].str ? array[i].str : "(null)",
795                         array[i].sub ? array[i].sub : "(null)",
796 -                       array[i].max, rv);
797 +                       (unsigned)array[i].max, rv);
798                  return PR_FALSE;
799              }
800          }
801 @@ -2386,19 +2386,19 @@ PRBool test_025(void)
802          {
803              if( (char *)0 == rv )
804              {
805 -                printf("FAIL %d: %s,%s/%lu -> null, not 0x%x+%lu\n", i,
806 +                printf("FAIL %d: %s,%s/%u -> null, not %p+%u\n", i,
807                         array[i].str ? array[i].str : "(null)",
808                         array[i].sub ? array[i].sub : "(null)",
809 -                       array[i].max, array[i].str, array[i].off);
810 +                       (unsigned)array[i].max, array[i].str, (unsigned)array[i].off);
811                  return PR_FALSE;
812              }
813  
814              if( &array[i].str[ array[i].off ] != rv )
815              {
816 -                printf("FAIL %d: %s,%s/%lu -> 0x%x, not 0x%x+%lu\n", i,
817 +                printf("FAIL %d: %s,%s/%u -> %p, not %p+%u\n", i,
818                         array[i].str ? array[i].str : "(null)",
819                         array[i].sub ? array[i].sub : "(null)",
820 -                       array[i].max, rv, array[i].str, array[i].off);
821 +                       (unsigned)array[i].max, rv, array[i].str, (unsigned)array[i].off);
822                  return PR_FALSE;
823              }
824          }
825 @@ -2507,10 +2507,10 @@ PRBool test_026(void)
826          {
827              if( (char *)0 != rv )
828              {
829 -                printf("FAIL %d: %s,%s/%lu -> %.32s, not null\n", i,
830 +                printf("FAIL %d: %s,%s/%u -> %.32s, not null\n", i,
831                         array[i].str ? array[i].str : "(null)",
832                         array[i].sub ? array[i].sub : "(null)",
833 -                       array[i].max, rv);
834 +                       (unsigned)array[i].max, rv);
835                  return PR_FALSE;
836              }
837          }
838 @@ -2518,19 +2518,19 @@ PRBool test_026(void)
839          {
840              if( (char *)0 == rv )
841              {
842 -                printf("FAIL %d: %s,%s/%lu -> null, not 0x%x+%lu\n", i,
843 +                printf("FAIL %d: %s,%s/%u -> null, not %p+%u\n", i,
844                         array[i].str ? array[i].str : "(null)",
845                         array[i].sub ? array[i].sub : "(null)",
846 -                       array[i].max, array[i].str, array[i].off);
847 +                       (unsigned)array[i].max, array[i].str, (unsigned)array[i].off);
848                  return PR_FALSE;
849              }
850  
851              if( &array[i].str[ array[i].off ] != rv )
852              {
853 -                printf("FAIL %d: %s,%s/%lu -> 0x%x, not 0x%x+%lu\n", i,
854 +                printf("FAIL %d: %s,%s/%u -> %p, not %p+%u\n", i,
855                         array[i].str ? array[i].str : "(null)",
856                         array[i].sub ? array[i].sub : "(null)",
857 -                       array[i].max, rv, array[i].str, array[i].off);
858 +                       (unsigned)array[i].max, rv, array[i].str, (unsigned)array[i].off);
859                  return PR_FALSE;
860              }
861          }
862 @@ -2626,19 +2626,19 @@ PRBool test_027(void)
863          {
864              if( (char *)0 == rv )
865              {
866 -                printf("FAIL %d: %s,%s -> null, not 0x%x+%lu\n", i,
867 +                printf("FAIL %d: %s,%s -> null, not %p+%u\n", i,
868                         array[i].str ? array[i].str : "(null)",
869                         array[i].sub ? array[i].sub : "(null)",
870 -                       array[i].str, array[i].off);
871 +                       array[i].str, (unsigned)array[i].off);
872                  return PR_FALSE;
873              }
874  
875              if( &array[i].str[ array[i].off ] != rv )
876              {
877 -                printf("FAIL %d: %s,%s -> 0x%x, not 0x%x+%lu\n", i,
878 +                printf("FAIL %d: %s,%s -> %p, not %p+%u\n", i,
879                         array[i].str ? array[i].str : "(null)",
880                         array[i].sub ? array[i].sub : "(null)",
881 -                       rv, array[i].str, array[i].off);
882 +                       rv, array[i].str, (unsigned)array[i].off);
883                  return PR_FALSE;
884              }
885          }
886 @@ -2734,19 +2734,19 @@ PRBool test_028(void)
887          {
888              if( (char *)0 == rv )
889              {
890 -                printf("FAIL %d: %s,%s -> null, not 0x%x+%lu\n", i,
891 +                printf("FAIL %d: %s,%s -> null, not %p+%u\n", i,
892                         array[i].str ? array[i].str : "(null)",
893                         array[i].sub ? array[i].sub : "(null)",
894 -                       array[i].str, array[i].off);
895 +                       array[i].str, (unsigned)array[i].off);
896                  return PR_FALSE;
897              }
898  
899              if( &array[i].str[ array[i].off ] != rv )
900              {
901 -                printf("FAIL %d: %s,%s -> 0x%x, not 0x%x+%lu\n", i,
902 +                printf("FAIL %d: %s,%s -> %p, not %p+%u\n", i,
903                         array[i].str ? array[i].str : "(null)",
904                         array[i].sub ? array[i].sub : "(null)",
905 -                       rv, array[i].str, array[i].off);
906 +                       rv, array[i].str, (unsigned)array[i].off);
907                  return PR_FALSE;
908              }
909          }
910 @@ -2853,10 +2853,10 @@ PRBool test_029(void)
911          {
912              if( (char *)0 != rv )
913              {
914 -                printf("FAIL %d: %s,%s/%lu -> %.32s, not null\n", i,
915 +                printf("FAIL %d: %s,%s/%u -> %.32s, not null\n", i,
916                         array[i].str ? array[i].str : "(null)",
917                         array[i].sub ? array[i].sub : "(null)",
918 -                       array[i].max, rv);
919 +                       (unsigned)array[i].max, rv);
920                  return PR_FALSE;
921              }
922          }
923 @@ -2864,19 +2864,19 @@ PRBool test_029(void)
924          {
925              if( (char *)0 == rv )
926              {
927 -                printf("FAIL %d: %s,%s/%lu -> null, not 0x%x+%lu\n", i,
928 +                printf("FAIL %d: %s,%s/%u -> null, not %p+%u\n", i,
929                         array[i].str ? array[i].str : "(null)",
930                         array[i].sub ? array[i].sub : "(null)",
931 -                       array[i].max, array[i].str, array[i].off);
932 +                       (unsigned)array[i].max, array[i].str, (unsigned)array[i].off);
933                  return PR_FALSE;
934              }
935  
936              if( &array[i].str[ array[i].off ] != rv )
937              {
938 -                printf("FAIL %d: %s,%s/%lu -> 0x%x, not 0x%x+%lu\n", i,
939 +                printf("FAIL %d: %s,%s/%u -> %p, not %p+%u\n", i,
940                         array[i].str ? array[i].str : "(null)",
941                         array[i].sub ? array[i].sub : "(null)",
942 -                       array[i].max, rv, array[i].str, array[i].off);
943 +                       (unsigned)array[i].max, rv, array[i].str, (unsigned)array[i].off);
944                  return PR_FALSE;
945              }
946          }
947 @@ -2985,10 +2985,10 @@ PRBool test_030(void)
948          {
949              if( (char *)0 != rv )
950              {
951 -                printf("FAIL %d: %s,%s/%lu -> %.32s, not null\n", i,
952 +                printf("FAIL %d: %s,%s/%u -> %.32s, not null\n", i,
953                         array[i].str ? array[i].str : "(null)",
954                         array[i].sub ? array[i].sub : "(null)",
955 -                       array[i].max, rv);
956 +                       (unsigned)array[i].max, rv);
957                  return PR_FALSE;
958              }
959          }
960 @@ -2996,19 +2996,19 @@ PRBool test_030(void)
961          {
962              if( (char *)0 == rv )
963              {
964 -                printf("FAIL %d: %s,%s/%lu -> null, not 0x%x+%lu\n", i,
965 +                printf("FAIL %d: %s,%s/%u -> null, not %p+%u\n", i,
966                         array[i].str ? array[i].str : "(null)",
967                         array[i].sub ? array[i].sub : "(null)",
968 -                       array[i].max, array[i].str, array[i].off);
969 +                       (unsigned)array[i].max, array[i].str, (unsigned)array[i].off);
970                  return PR_FALSE;
971              }
972  
973              if( &array[i].str[ array[i].off ] != rv )
974              {
975 -                printf("FAIL %d: %s,%s/%lu -> 0x%x, not 0x%x+%lu\n", i,
976 +                printf("FAIL %d: %s,%s/%u -> %p, not %p+%u\n", i,
977                         array[i].str ? array[i].str : "(null)",
978                         array[i].sub ? array[i].sub : "(null)",
979 -                       array[i].max, rv, array[i].str, array[i].off);
980 +                       (unsigned)array[i].max, rv, array[i].str, (unsigned)array[i].off);
981                  return PR_FALSE;
982              }
983          }
984
985
986 [FILE:6203:patches/patch-pr_include_md___dragonfly.cfg]
987 --- /dev/null   2020-09-20 11:06:55 UTC
988 +++ pr/include/md/_dragonfly.cfg
989 @@ -0,0 +1,208 @@
990 +/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
991 +/* This Source Code Form is subject to the terms of the Mozilla Public
992 + * License, v. 2.0. If a copy of the MPL was not distributed with this
993 + * file, You can obtain one at http://mozilla.org/MPL/2.0/. */
994 +
995 +#ifndef nspr_cpucfg___
996 +#define nspr_cpucfg___
997 +
998 +#ifndef XP_UNIX
999 +#define XP_UNIX
1000 +#endif
1001 +
1002 +#define PR_AF_INET6 28  /* same as AF_INET6 */
1003 +
1004 +#ifndef HAVE_LONG_LONG
1005 +#define HAVE_LONG_LONG
1006 +#endif
1007 +
1008 +#if defined(__i386__)
1009 +
1010 +#define IS_LITTLE_ENDIAN 1
1011 +#undef  IS_BIG_ENDIAN
1012 +#undef HAVE_ALIGNED_DOUBLES
1013 +#undef HAVE_ALIGNED_LONGLONGS
1014 +
1015 +#define PR_BYTES_PER_BYTE   1
1016 +#define PR_BYTES_PER_SHORT  2
1017 +#define PR_BYTES_PER_INT    4
1018 +#define PR_BYTES_PER_INT64  8
1019 +#define PR_BYTES_PER_LONG   4
1020 +#define PR_BYTES_PER_FLOAT  4
1021 +#define PR_BYTES_PER_DOUBLE 8
1022 +#define PR_BYTES_PER_WORD   4
1023 +#define PR_BYTES_PER_DWORD  8
1024 +#define PR_BYTES_PER_WORD_LOG2   2
1025 +#define PR_BYTES_PER_DWORD_LOG2  3
1026 +
1027 +#define PR_BITS_PER_BYTE    8
1028 +#define PR_BITS_PER_SHORT   16
1029 +#define PR_BITS_PER_INT     32
1030 +#define PR_BITS_PER_INT64   64
1031 +#define PR_BITS_PER_LONG    32
1032 +#define PR_BITS_PER_FLOAT   32
1033 +#define PR_BITS_PER_DOUBLE  64
1034 +#define PR_BITS_PER_WORD    32
1035 +
1036 +#define PR_BITS_PER_BYTE_LOG2   3
1037 +#define PR_BITS_PER_SHORT_LOG2  4
1038 +#define PR_BITS_PER_INT_LOG2    5
1039 +#define PR_BITS_PER_INT64_LOG2  6
1040 +#define PR_BITS_PER_LONG_LOG2   5
1041 +#define PR_BITS_PER_FLOAT_LOG2  5
1042 +#define PR_BITS_PER_DOUBLE_LOG2 6
1043 +#define PR_BITS_PER_WORD_LOG2   5
1044 +
1045 +#define PR_ALIGN_OF_SHORT   2
1046 +#define PR_ALIGN_OF_INT     4
1047 +#define PR_ALIGN_OF_LONG    4
1048 +#define PR_ALIGN_OF_INT64   4
1049 +#define PR_ALIGN_OF_FLOAT   4
1050 +#define PR_ALIGN_OF_DOUBLE  4
1051 +#define PR_ALIGN_OF_POINTER 4
1052 +
1053 +#elif defined(__alpha__)
1054 +
1055 +#define IS_LITTLE_ENDIAN 1
1056 +#undef  IS_BIG_ENDIAN
1057 +#define        HAVE_ALIGNED_DOUBLES
1058 +#define        HAVE_ALIGNED_LONGLONGS
1059 +#define IS_64
1060 +
1061 +#define PR_BYTES_PER_BYTE   1
1062 +#define PR_BYTES_PER_SHORT  2
1063 +#define PR_BYTES_PER_INT    4
1064 +#define PR_BYTES_PER_INT64  8
1065 +#define PR_BYTES_PER_LONG   8
1066 +#define PR_BYTES_PER_FLOAT  4
1067 +#define PR_BYTES_PER_DOUBLE 8
1068 +#define PR_BYTES_PER_WORD   8
1069 +#define PR_BYTES_PER_DWORD  8
1070 +#define PR_BYTES_PER_WORD_LOG2   3
1071 +#define PR_BYTES_PER_DWORD_LOG2  3
1072 +
1073 +#define PR_BITS_PER_BYTE    8
1074 +#define PR_BITS_PER_SHORT   16
1075 +#define PR_BITS_PER_INT     32
1076 +#define PR_BITS_PER_INT64   64
1077 +#define PR_BITS_PER_LONG    64
1078 +#define PR_BITS_PER_FLOAT   32
1079 +#define PR_BITS_PER_DOUBLE  64
1080 +#define PR_BITS_PER_WORD    64
1081 +
1082 +#define PR_BITS_PER_BYTE_LOG2   3
1083 +#define PR_BITS_PER_SHORT_LOG2  4
1084 +#define PR_BITS_PER_INT_LOG2    5
1085 +#define PR_BITS_PER_INT64_LOG2  6
1086 +#define PR_BITS_PER_LONG_LOG2   6
1087 +#define PR_BITS_PER_FLOAT_LOG2  5
1088 +#define PR_BITS_PER_DOUBLE_LOG2 6
1089 +#define PR_BITS_PER_WORD_LOG2   6
1090 +
1091 +#define PR_ALIGN_OF_SHORT   2
1092 +#define PR_ALIGN_OF_INT     4
1093 +#define PR_ALIGN_OF_LONG    8
1094 +#define PR_ALIGN_OF_INT64   8
1095 +#define PR_ALIGN_OF_FLOAT   4
1096 +#define PR_ALIGN_OF_DOUBLE  8
1097 +#define PR_ALIGN_OF_POINTER 8
1098 +
1099 +#elif defined(__amd64__)
1100 +
1101 +#define IS_LITTLE_ENDIAN 1
1102 +#undef  IS_BIG_ENDIAN
1103 +#define        HAVE_ALIGNED_DOUBLES
1104 +#define        HAVE_ALIGNED_LONGLONGS
1105 +#define IS_64
1106 +
1107 +#define PR_BYTES_PER_BYTE   1
1108 +#define PR_BYTES_PER_SHORT  2
1109 +#define PR_BYTES_PER_INT    4
1110 +#define PR_BYTES_PER_INT64  8
1111 +#define PR_BYTES_PER_LONG   8
1112 +#define PR_BYTES_PER_FLOAT  4
1113 +#define PR_BYTES_PER_DOUBLE 8
1114 +#define PR_BYTES_PER_WORD   8
1115 +#define PR_BYTES_PER_DWORD  8
1116 +#define PR_BYTES_PER_WORD_LOG2   3
1117 +#define PR_BYTES_PER_DWORD_LOG2  3
1118 +
1119 +#define PR_BITS_PER_BYTE    8
1120 +#define PR_BITS_PER_SHORT   16
1121 +#define PR_BITS_PER_INT     32
1122 +#define PR_BITS_PER_INT64   64
1123 +#define PR_BITS_PER_LONG    64
1124 +#define PR_BITS_PER_FLOAT   32
1125 +#define PR_BITS_PER_DOUBLE  64
1126 +#define PR_BITS_PER_WORD    64
1127 +
1128 +#define PR_BITS_PER_BYTE_LOG2   3
1129 +#define PR_BITS_PER_SHORT_LOG2  4
1130 +#define PR_BITS_PER_INT_LOG2    5
1131 +#define PR_BITS_PER_INT64_LOG2  6
1132 +#define PR_BITS_PER_LONG_LOG2   6
1133 +#define PR_BITS_PER_FLOAT_LOG2  5
1134 +#define PR_BITS_PER_DOUBLE_LOG2 6
1135 +#define PR_BITS_PER_WORD_LOG2   6
1136 +
1137 +#define PR_ALIGN_OF_SHORT   2
1138 +#define PR_ALIGN_OF_INT     4
1139 +#define PR_ALIGN_OF_LONG    8
1140 +#define PR_ALIGN_OF_INT64   8
1141 +#define PR_ALIGN_OF_FLOAT   4
1142 +#define PR_ALIGN_OF_DOUBLE  8
1143 +#define PR_ALIGN_OF_POINTER 8
1144 +#define PR_ALIGN_OF_WORD    8
1145 +
1146 +#else
1147 +
1148 +#error "Unknown CPU architecture"
1149 +
1150 +#endif
1151 +
1152 +#ifndef NO_NSPR_10_SUPPORT
1153 +
1154 +#define BYTES_PER_BYTE         PR_BYTES_PER_BYTE
1155 +#define BYTES_PER_SHORT        PR_BYTES_PER_SHORT
1156 +#define BYTES_PER_INT          PR_BYTES_PER_INT
1157 +#define BYTES_PER_INT64                PR_BYTES_PER_INT64
1158 +#define BYTES_PER_LONG         PR_BYTES_PER_LONG
1159 +#define BYTES_PER_FLOAT                PR_BYTES_PER_FLOAT
1160 +#define BYTES_PER_DOUBLE       PR_BYTES_PER_DOUBLE
1161 +#define BYTES_PER_WORD         PR_BYTES_PER_WORD
1162 +#define BYTES_PER_DWORD                PR_BYTES_PER_DWORD
1163 +
1164 +#define BITS_PER_BYTE          PR_BITS_PER_BYTE
1165 +#define BITS_PER_SHORT         PR_BITS_PER_SHORT
1166 +#define BITS_PER_INT           PR_BITS_PER_INT
1167 +#define BITS_PER_INT64         PR_BITS_PER_INT64
1168 +#define BITS_PER_LONG          PR_BITS_PER_LONG
1169 +#define BITS_PER_FLOAT         PR_BITS_PER_FLOAT
1170 +#define BITS_PER_DOUBLE                PR_BITS_PER_DOUBLE
1171 +#define BITS_PER_WORD          PR_BITS_PER_WORD
1172 +
1173 +#define BITS_PER_BYTE_LOG2     PR_BITS_PER_BYTE_LOG2
1174 +#define BITS_PER_SHORT_LOG2    PR_BITS_PER_SHORT_LOG2
1175 +#define BITS_PER_INT_LOG2      PR_BITS_PER_INT_LOG2
1176 +#define BITS_PER_INT64_LOG2    PR_BITS_PER_INT64_LOG2
1177 +#define BITS_PER_LONG_LOG2     PR_BITS_PER_LONG_LOG2
1178 +#define BITS_PER_FLOAT_LOG2    PR_BITS_PER_FLOAT_LOG2
1179 +#define BITS_PER_DOUBLE_LOG2   PR_BITS_PER_DOUBLE_LOG2
1180 +#define BITS_PER_WORD_LOG2     PR_BITS_PER_WORD_LOG2
1181 +
1182 +#define ALIGN_OF_SHORT         PR_ALIGN_OF_SHORT
1183 +#define ALIGN_OF_INT           PR_ALIGN_OF_INT
1184 +#define ALIGN_OF_LONG          PR_ALIGN_OF_LONG
1185 +#define ALIGN_OF_INT64         PR_ALIGN_OF_INT64
1186 +#define ALIGN_OF_FLOAT         PR_ALIGN_OF_FLOAT
1187 +#define ALIGN_OF_DOUBLE                PR_ALIGN_OF_DOUBLE
1188 +#define ALIGN_OF_POINTER       PR_ALIGN_OF_POINTER
1189 +#define ALIGN_OF_WORD          PR_ALIGN_OF_WORD
1190 +
1191 +#define BYTES_PER_WORD_LOG2    PR_BYTES_PER_WORD_LOG2
1192 +#define BYTES_PER_DWORD_LOG2   PR_BYTES_PER_DWORD_LOG2
1193 +#define WORDS_PER_DWORD_LOG2   PR_WORDS_PER_DWORD_LOG2
1194 +
1195 +#endif /* NO_NSPR_10_SUPPORT */
1196 +
1197 +#endif /* nspr_cpucfg___ */
1198
1199
1200 [FILE:6201:patches/patch-pr_include_md___dragonfly.h]
1201 --- /dev/null   2020-09-20 11:06:55 UTC
1202 +++ pr/include/md/_dragonfly.h
1203 @@ -0,0 +1,225 @@
1204 +/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
1205 +/* This Source Code Form is subject to the terms of the Mozilla Public
1206 + * License, v. 2.0. If a copy of the MPL was not distributed with this
1207 + * file, You can obtain one at http://mozilla.org/MPL/2.0/. */
1208 +
1209 +#ifndef nspr_dragonfly_defs_h___
1210 +#define nspr_dragonfly_defs_h___
1211 +
1212 +#include "prthread.h"
1213 +
1214 +#if 0
1215 +#if __FreeBSD__ >= 2
1216 +#include <osreldate.h>  /* for __FreeBSD_version */
1217 +#endif
1218 +#include <sys/syscall.h>
1219 +#endif
1220 +
1221 +#define PR_LINKER_ARCH "dragonfly"
1222 +#define _PR_SI_SYSNAME  "DRAGONFLY"
1223 +#if defined(__i386__)
1224 +#define _PR_SI_ARCHITECTURE "x86"
1225 +#elif defined(__amd64__)
1226 +#define _PR_SI_ARCHITECTURE "amd64"
1227 +#else
1228 +#error "Unknown CPU architecture"
1229 +#endif
1230 +
1231 +#define PR_DLL_SUFFIX          ".so"
1232 +
1233 +#define _PR_VMBASE              0x30000000
1234 +#define _PR_STACK_VMBASE       0x50000000
1235 +#define _MD_DEFAULT_STACK_SIZE 65536L
1236 +#define _MD_MMAP_FLAGS          MAP_PRIVATE
1237 +
1238 +#undef  HAVE_STACK_GROWING_UP
1239 +#define HAVE_DLL
1240 +#define USE_DLFCN
1241 +#define _PR_HAVE_SOCKADDR_LEN
1242 +#define _PR_STAT_HAS_ST_ATIMESPEC
1243 +#define _PR_HAVE_LARGE_OFF_T
1244 +
1245 +#define _PR_HAVE_GETPROTO_R
1246 +#define _PR_HAVE_5_ARG_GETPROTO_R
1247 +#define _PR_HAVE_GETHOST_R
1248 +#define _PR_HAVE_GETHOST_R_INT
1249 +
1250 +#define _PR_POLL_AVAILABLE
1251 +
1252 +#define _PR_HAVE_SYSV_SEMAPHORES
1253 +#define PR_HAVE_SYSV_NAMED_SHARED_MEMORY
1254 +
1255 +#define _PR_INET6
1256 +#define _PR_HAVE_INET_NTOP
1257 +#define _PR_HAVE_GETHOSTBYNAME2
1258 +#define _PR_HAVE_GETADDRINFO
1259 +#define _PR_INET6_PROBE
1260 +#define _PR_IPV6_V6ONLY_PROBE
1261 +
1262 +#define USE_SETJMP
1263 +
1264 +#ifndef _PR_PTHREADS
1265 +#include <setjmp.h>
1266 +
1267 +#define PR_CONTEXT_TYPE        sigjmp_buf
1268 +
1269 +#define CONTEXT(_th) ((_th)->md.context)
1270 +
1271 +#define _MD_GET_SP(_th)    (_th)->md.context[0]._sjb[2]
1272 +#define PR_NUM_GCREGS  _JBLEN
1273 +
1274 +/*
1275 +** Initialize a thread context to run "_main()" when started
1276 +*/
1277 +#define _MD_INIT_CONTEXT(_thread, _sp, _main, status)  \
1278 +{  \
1279 +    *status = PR_TRUE;  \
1280 +    if (sigsetjmp(CONTEXT(_thread), 1)) {  \
1281 +        _main();  \
1282 +    }  \
1283 +    _MD_GET_SP(_thread) = (unsigned char*) ((_sp) - 64); \
1284 +}
1285 +
1286 +#define _MD_SWITCH_CONTEXT(_thread)  \
1287 +    if (!sigsetjmp(CONTEXT(_thread), 1)) {  \
1288 +       (_thread)->md.errcode = errno;  \
1289 +       _PR_Schedule();  \
1290 +    }
1291 +
1292 +/*
1293 +** Restore a thread context, saved by _MD_SWITCH_CONTEXT
1294 +*/
1295 +#define _MD_RESTORE_CONTEXT(_thread) \
1296 +{   \
1297 +    errno = (_thread)->md.errcode;  \
1298 +    _MD_SET_CURRENT_THREAD(_thread);  \
1299 +    siglongjmp(CONTEXT(_thread), 1);  \
1300 +}
1301 +
1302 +/* Machine-dependent (MD) data structures */
1303 +
1304 +struct _MDThread {
1305 +    PR_CONTEXT_TYPE context;
1306 +    int id;
1307 +    int errcode;
1308 +};
1309 +
1310 +struct _MDThreadStack {
1311 +    PRInt8 notused;
1312 +};
1313 +
1314 +struct _MDLock {
1315 +    PRInt8 notused;
1316 +};
1317 +
1318 +struct _MDSemaphore {
1319 +    PRInt8 notused;
1320 +};
1321 +
1322 +struct _MDCVar {
1323 +    PRInt8 notused;
1324 +};
1325 +
1326 +struct _MDSegment {
1327 +    PRInt8 notused;
1328 +};
1329 +
1330 +/*
1331 + * md-specific cpu structure field
1332 + */
1333 +#define _PR_MD_MAX_OSFD FD_SETSIZE
1334 +
1335 +struct _MDCPU_Unix {
1336 +    PRCList ioQ;
1337 +    PRUint32 ioq_timeout;
1338 +    PRInt32 ioq_max_osfd;
1339 +    PRInt32 ioq_osfd_cnt;
1340 +#ifndef _PR_USE_POLL
1341 +    fd_set fd_read_set, fd_write_set, fd_exception_set;
1342 +    PRInt16 fd_read_cnt[_PR_MD_MAX_OSFD],fd_write_cnt[_PR_MD_MAX_OSFD],
1343 +                               fd_exception_cnt[_PR_MD_MAX_OSFD];
1344 +#else
1345 +       struct pollfd *ioq_pollfds;
1346 +       int ioq_pollfds_size;
1347 +#endif /* _PR_USE_POLL */
1348 +};
1349 +
1350 +#define _PR_IOQ(_cpu)                  ((_cpu)->md.md_unix.ioQ)
1351 +#define _PR_ADD_TO_IOQ(_pq, _cpu) PR_APPEND_LINK(&_pq.links, &_PR_IOQ(_cpu))
1352 +#define _PR_FD_READ_SET(_cpu)          ((_cpu)->md.md_unix.fd_read_set)
1353 +#define _PR_FD_READ_CNT(_cpu)          ((_cpu)->md.md_unix.fd_read_cnt)
1354 +#define _PR_FD_WRITE_SET(_cpu)         ((_cpu)->md.md_unix.fd_write_set)
1355 +#define _PR_FD_WRITE_CNT(_cpu)         ((_cpu)->md.md_unix.fd_write_cnt)
1356 +#define _PR_FD_EXCEPTION_SET(_cpu)     ((_cpu)->md.md_unix.fd_exception_set)
1357 +#define _PR_FD_EXCEPTION_CNT(_cpu)     ((_cpu)->md.md_unix.fd_exception_cnt)
1358 +#define _PR_IOQ_TIMEOUT(_cpu)          ((_cpu)->md.md_unix.ioq_timeout)
1359 +#define _PR_IOQ_MAX_OSFD(_cpu)         ((_cpu)->md.md_unix.ioq_max_osfd)
1360 +#define _PR_IOQ_OSFD_CNT(_cpu)         ((_cpu)->md.md_unix.ioq_osfd_cnt)
1361 +#define _PR_IOQ_POLLFDS(_cpu)          ((_cpu)->md.md_unix.ioq_pollfds)
1362 +#define _PR_IOQ_POLLFDS_SIZE(_cpu)     ((_cpu)->md.md_unix.ioq_pollfds_size)
1363 +
1364 +#define _PR_IOQ_MIN_POLLFDS_SIZE(_cpu) 32
1365 +
1366 +struct _MDCPU {
1367 +       struct _MDCPU_Unix md_unix;
1368 +};
1369 +
1370 +#define _MD_INIT_LOCKS()
1371 +#define _MD_NEW_LOCK(lock) PR_SUCCESS
1372 +#define _MD_FREE_LOCK(lock)
1373 +#define _MD_LOCK(lock)
1374 +#define _MD_UNLOCK(lock)
1375 +#define _MD_INIT_IO()
1376 +#define _MD_IOQ_LOCK()
1377 +#define _MD_IOQ_UNLOCK()
1378 +
1379 +extern PRStatus _MD_InitializeThread(PRThread *thread);
1380 +
1381 +#define _MD_INIT_RUNNING_CPU(cpu)       _MD_unix_init_running_cpu(cpu)
1382 +#define _MD_INIT_THREAD                 _MD_InitializeThread
1383 +#define _MD_EXIT_THREAD(thread)
1384 +#define _MD_SUSPEND_THREAD(thread)      _MD_suspend_thread
1385 +#define _MD_RESUME_THREAD(thread)       _MD_resume_thread
1386 +#define _MD_CLEAN_THREAD(_thread)
1387 +
1388 +extern PRStatus _MD_CREATE_THREAD(
1389 +    PRThread *thread,
1390 +    void (*start) (void *),
1391 +    PRThreadPriority priority,
1392 +    PRThreadScope scope,
1393 +    PRThreadState state,
1394 +    PRUint32 stackSize);
1395 +extern void _MD_SET_PRIORITY(struct _MDThread *thread, PRUintn newPri);
1396 +extern PRStatus _MD_WAIT(PRThread *, PRIntervalTime timeout);
1397 +extern PRStatus _MD_WAKEUP_WAITER(PRThread *);
1398 +extern void _MD_YIELD(void);
1399 +
1400 +#endif /* ! _PR_PTHREADS */
1401 +
1402 +extern void _MD_EarlyInit(void);
1403 +
1404 +#define _MD_EARLY_INIT                  _MD_EarlyInit
1405 +#define _MD_FINAL_INIT                 _PR_UnixInit
1406 +#define _MD_INTERVAL_USE_GTOD
1407 +
1408 +/*
1409 + * We wrapped the select() call.  _MD_SELECT refers to the built-in,
1410 + * unwrapped version.
1411 + */
1412 +#define _MD_SELECT(nfds,r,w,e,tv) syscall(SYS_select,nfds,r,w,e,tv)
1413 +
1414 +#if defined(_PR_POLL_AVAILABLE)
1415 +#include <poll.h>
1416 +#define _MD_POLL(fds,nfds,timeout) syscall(SYS_poll,fds,nfds,timeout)
1417 +#endif
1418 +
1419 +/* freebsd has INADDR_LOOPBACK defined, but in /usr/include/rpc/types.h, and I didn't
1420 +   want to be including that.. */
1421 +#ifndef INADDR_LOOPBACK
1422 +#define INADDR_LOOPBACK         (u_long)0x7F000001
1423 +#endif
1424 +
1425 +/* For writev() */
1426 +#include <sys/uio.h>
1427 +
1428 +#endif /* nspr_freebsd_defs_h___ */
1429
1430
1431 [FILE:1099:patches/patch-pr_include_md___freebsd.h]
1432 --- pr/include/md/_freebsd.h.orig       2020-08-20 23:04:43 UTC
1433 +++ pr/include/md/_freebsd.h
1434 @@ -59,7 +59,15 @@
1435  #define _PR_HAVE_LARGE_OFF_T
1436  
1437  #if defined(_PR_PTHREADS)
1438 -#if __FreeBSD_version >= 400008
1439 +#if defined(__DragonFly__) || __FreeBSD_version >= 602000
1440 +#define _PR_HAVE_GETPROTO_R
1441 +#define _PR_HAVE_5_ARG_GETPROTO_R
1442 +#endif
1443 +#if __FreeBSD_version >= 700016
1444 +#define _PR_HAVE_GETHOST_R
1445 +#define _PR_HAVE_GETHOST_R_INT
1446 +#endif
1447 +#if defined(__DragonFly__) || __FreeBSD_version >= 400008
1448  /*
1449   * libc_r before this version of FreeBSD doesn't have poll().
1450   * Although libc has poll(), it is not thread-safe so we can't
1451 @@ -68,7 +76,7 @@
1452  #define _PR_POLL_AVAILABLE
1453  #endif
1454  #else
1455 -#if __FreeBSD_version >= 300000
1456 +#if defined(__DragonFly__) || __FreeBSD_version >= 300000
1457  #define _PR_POLL_AVAILABLE
1458  #define _PR_USE_POLL
1459  #endif
1460 @@ -77,7 +85,7 @@
1461  #define _PR_HAVE_SYSV_SEMAPHORES
1462  #define PR_HAVE_SYSV_NAMED_SHARED_MEMORY
1463  
1464 -#if __FreeBSD_version >= 400014
1465 +#if defined(__DragonFly__) || __FreeBSD_version >= 400014
1466  #define _PR_INET6
1467  #define _PR_HAVE_INET_NTOP
1468  #define _PR_HAVE_GETHOSTBYNAME2
1469
1470
1471 [FILE:1235:patches/patch-pr_include_md___pth.h]
1472 --- pr/include/md/_pth.h.orig   2020-08-20 23:04:43 UTC
1473 +++ pr/include/md/_pth.h
1474 @@ -86,6 +86,7 @@
1475   */
1476  #if defined(AIX) || defined(SOLARIS) \
1477      || defined(LINUX) || defined(__GNU__) || defined(__GLIBC__) \
1478 +    || defined(__DragonFly__) \
1479      || defined(HPUX) || defined(FREEBSD) \
1480      || defined(NETBSD) || defined(OPENBSD) || defined(BSDI) \
1481      || defined(NTO) || defined(DARWIN) \
1482 @@ -133,6 +134,7 @@
1483  #define PT_PRIO_MIN            sched_get_priority_min(SCHED_OTHER)
1484  #define PT_PRIO_MAX            sched_get_priority_max(SCHED_OTHER)
1485  #elif defined(LINUX) || defined(__GNU__) || defined(__GLIBC__) \
1486 +    || defined(__DragonFly__) \
1487      || defined(FREEBSD)
1488  #define PT_PRIO_MIN            sched_get_priority_min(SCHED_OTHER)
1489  #define PT_PRIO_MAX            sched_get_priority_max(SCHED_OTHER)
1490 @@ -175,6 +177,7 @@ extern int (*_PT_aix_yield_fcn)();
1491  #define _PT_PTHREAD_YIELD()         (*_PT_aix_yield_fcn)()
1492  #elif defined(HPUX) || defined(SOLARIS) \
1493      || defined(LINUX) || defined(__GNU__) || defined(__GLIBC__) \
1494 +    || defined(__DragonFly__) \
1495      || defined(FREEBSD) || defined(NETBSD) || defined(OPENBSD) \
1496      || defined(BSDI) || defined(NTO) || defined(DARWIN) \
1497      || defined(UNIXWARE) || defined(RISCOS)
1498
1499
1500 [FILE:279:patches/patch-pr_include_md_prosdep.h]
1501 --- pr/include/md/prosdep.h.orig        2020-08-20 23:04:43 UTC
1502 +++ pr/include/md/prosdep.h
1503 @@ -43,6 +43,9 @@ PR_BEGIN_EXTERN_C
1504  #elif defined(OPENBSD)
1505  #include "md/_openbsd.h"
1506  
1507 +#elif defined(__DragonFly__)
1508 +#include "md/_dragonfly.h"
1509 +
1510  #elif defined(BSDI)
1511  #include "md/_bsdi.h"
1512  
1513
1514
1515 [FILE:403:patches/patch-pr_src_md_unix_uxrng.c]
1516 --- pr/src/md/unix/uxrng.c.orig 2020-08-20 23:04:43 UTC
1517 +++ pr/src/md/unix/uxrng.c
1518 @@ -64,6 +64,7 @@ GetHighResClock(void *buf, size_t maxbyt
1519  \f
1520  #elif (defined(LINUX) || defined(FREEBSD) || defined(__FreeBSD_kernel__) \
1521      || defined(NETBSD) || defined(__NetBSD_kernel__) || defined(OPENBSD) \
1522 +    || defined(__DragonFly__) \
1523      || defined(__GNU__))
1524  #include <sys/types.h>
1525  #include <sys/stat.h>
1526
1527
1528 [FILE:699:patches/patch-pr_src_misc_prnetdb.c]
1529 --- pr/src/misc/prnetdb.c.orig  2020-08-20 23:04:43 UTC
1530 +++ pr/src/misc/prnetdb.c
1531 @@ -73,11 +73,6 @@ PRLock *_pr_dnsLock = NULL;
1532  #define _PR_HAVE_GETPROTO_R_INT
1533  #endif
1534  
1535 -#if __FreeBSD_version >= 602000
1536 -#define _PR_HAVE_GETPROTO_R
1537 -#define _PR_HAVE_5_ARG_GETPROTO_R
1538 -#endif
1539 -
1540  /* BeOS has glibc but not the glibc-style getprotobyxxx_r functions. */
1541  #if (defined(__GLIBC__) && __GLIBC__ >= 2)
1542  #define _PR_HAVE_GETPROTO_R
1543 @@ -304,7 +299,7 @@ _pr_QueryNetIfs(void)
1544  }
1545  
1546  #elif (defined(DARWIN) && defined(HAVE_GETIFADDRS)) || defined(FREEBSD) \
1547 -    || defined(NETBSD) || defined(OPENBSD)
1548 +    || defined(NETBSD) || defined(OPENBSD) || defined(DRAGONFLY)
1549  
1550  /*
1551   * Use the BSD getifaddrs function.
1552
1553
1554 [FILE:1246:patches/patch-pr_src_pthreads_ptio.c]
1555 --- pr/src/pthreads/ptio.c.orig 2020-08-20 23:04:43 UTC
1556 +++ pr/src/pthreads/ptio.c
1557 @@ -182,6 +182,7 @@ static PRBool _pr_ipv6_v6only_on_by_defa
1558      || defined(HPUX10_30) || defined(HPUX11) \
1559      || defined(LINUX) || defined(__GNU__) || defined(__GLIBC__) \
1560      || defined(FREEBSD) || defined(NETBSD) || defined(OPENBSD) \
1561 +    || defined(__DragonFly__) \
1562      || defined(BSDI) || defined(NTO) || defined(DARWIN) \
1563      || defined(UNIXWARE) || defined(RISCOS)
1564  #define _PRSelectFdSetArg_t fd_set *
1565 @@ -3476,6 +3477,7 @@ static PRIOMethods _pr_socketpollfd_meth
1566  #if defined(HPUX) || defined(SOLARIS) \
1567      || defined(LINUX) || defined(__GNU__) || defined(__GLIBC__) \
1568      || defined(AIX) || defined(FREEBSD) || defined(NETBSD) \
1569 +    || defined(__DragonFly__) \
1570      || defined(OPENBSD) || defined(BSDI) || defined(NTO) \
1571      || defined(DARWIN) || defined(UNIXWARE) || defined(RISCOS)
1572  #define _PR_FCNTL_FLAGS O_NONBLOCK
1573 @@ -5262,6 +5264,7 @@ PR_IMPLEMENT(PRInt32) PR_Select(
1574  
1575      if (timeout == PR_INTERVAL_NO_TIMEOUT) {
1576          tvp = NULL;
1577 +        start = 0; /* Not needed, but shuts down a warning */
1578      } else {
1579          tv.tv_sec = (PRInt32)PR_IntervalToSeconds(timeout);
1580          tv.tv_usec = (PRInt32)PR_IntervalToMicroseconds(
1581
1582
1583 [FILE:836:patches/patch-pr_src_pthreads_ptsynch.c]
1584 --- pr/src/pthreads/ptsynch.c.orig      2020-08-20 23:04:43 UTC
1585 +++ pr/src/pthreads/ptsynch.c
1586 @@ -25,7 +25,7 @@ static pthread_condattr_t _pt_cvar_attr;
1587  extern PTDebug pt_debug;  /* this is shared between several modules */
1588  #endif  /* defined(DEBUG) */
1589  
1590 -#if defined(FREEBSD)
1591 +#if defined(FREEBSD) && (defined(DEBUG) || defined(FORCE_PR_ASSERT))
1592  /*
1593   * On older versions of FreeBSD, pthread_mutex_trylock returns EDEADLK.
1594   * Newer versions return EBUSY.  We still need to support both.
1595 @@ -952,6 +952,7 @@ PR_IMPLEMENT(PRStatus) PR_DeleteSemaphor
1596   */
1597  #if (defined(__GNU_LIBRARY__) && !defined(_SEM_SEMUN_UNDEFINED)) \
1598      || (defined(FREEBSD) && __FreeBSD_version < 1200059) \
1599 +    || defined(__DragonFly__) \
1600      || defined(OPENBSD) || defined(BSDI) \
1601      || defined(DARWIN)
1602  /* union semun is defined by including <sys/sem.h> */
1603
1604
1605 [FILE:83888:patches/patch-tests]
1606 --- lib/tests/Makefile.in.orig  2020-08-20 23:04:43 UTC
1607 +++ lib/tests/Makefile.in
1608 @@ -159,7 +159,7 @@ else
1609  ifeq ($(OS_ARCH),OS2)
1610         $(LINK) $(EXEFLAGS) $(LDOPTS) $< $(LIBPLC)  $(LIBPLDS) $(LIBPR) $(OS_LIBS) $(EXTRA_LIBS)
1611  else
1612 -       $(CC) $(XCFLAGS) $< $(LDOPTS) $(LIBPLC) $(LIBPLDS) $(LIBPR) $(EXTRA_LIBS) -o $@
1613 +       $(CC) $(XCFLAGS) $< $(LDOPTS) $(LIBPLC) $(LIBPLDS) $(LIBPR) $(OS_LIBS) $(EXTRA_LIBS) -o $@
1614  endif
1615  endif
1616  endif
1617 --- pr/tests/cleanup.c.orig     2020-08-20 23:04:43 UTC
1618 +++ pr/tests/cleanup.c
1619 @@ -15,7 +15,7 @@
1620  
1621  static void PR_CALLBACK Thread(void *sleep)
1622  {
1623 -    PR_Sleep(PR_SecondsToInterval((PRUint32)sleep));
1624 +    PR_Sleep(PR_SecondsToInterval((intptr_t)sleep));
1625      printf("Thread exiting\n");
1626  }
1627  
1628 @@ -39,7 +39,8 @@ int main(int argc, char **argv)
1629      PRThreadScope type = PR_LOCAL_THREAD;
1630      PRFileDesc *err = PR_GetSpecialFD(PR_StandardError);
1631      PLOptState *opt = PL_CreateOptState(argc, argv, "Ghs:S:t:cC:");
1632 -    PRIntn concurrency = 1, child_sleep = 10, main_sleep = 5, threads = 1;
1633 +    PRIntn concurrency = 1, main_sleep = 5, threads = 1;
1634 +    intptr_t child_sleep = 10;
1635  
1636      PR_STDIO_INIT();
1637      while (PL_OPT_EOL != (os = PL_GetNextOpt(opt)))
1638 @@ -82,7 +83,7 @@ int main(int argc, char **argv)
1639                 (PR_LOCAL_THREAD == type) ? "LOCAL" : "GLOBAL");
1640      PR_fprintf(err, "\tConcurrency: %d\n", concurrency);
1641      PR_fprintf(err, "\tNumber of threads: %d\n", threads);
1642 -    PR_fprintf(err, "\tThread sleep: %d\n", child_sleep);
1643 +    PR_fprintf(err, "\tThread sleep: %d\n", (int)child_sleep);
1644      PR_fprintf(err, "\tMain sleep: %d\n", main_sleep);
1645      PR_fprintf(err, "\tCleanup will %sbe called\n\n", (cleanup) ? "" : "NOT ");
1646  
1647 --- pr/tests/cltsrv.c.orig      2020-08-20 23:04:43 UTC
1648 +++ pr/tests/cltsrv.c
1649 @@ -949,7 +949,7 @@ int main(int argc, char** argv)
1650  {
1651      PRUintn index;
1652      PRBool boolean;
1653 -    CSClient_t *client;
1654 +    CSClient_t *client = NULL;
1655      PRStatus rv, joinStatus;
1656      CSServer_t *server = NULL;
1657  
1658 --- pr/tests/cvar.c.orig        2020-08-20 23:04:43 UTC
1659 +++ pr/tests/cvar.c
1660 @@ -138,15 +138,15 @@ static int alive;
1661  static void PR_CALLBACK CXReader(void *arg)
1662  {
1663      CircBuf *cbp = (CircBuf *)arg;
1664 -    PRInt32 i, n;
1665 +    intptr_t i, n;
1666      void *data;
1667  
1668      n = count / 2;
1669      for (i = 0; i < n; i++) {
1670          data = GetCBData(cbp);
1671 -        if ((int)data != i)
1672 +        if ((intptr_t)data != i)
1673              if (debug_mode) {
1674 -                printf("data mismatch at for i = %d usec\n", i);
1675 +                printf("data mismatch at for i = %ld usec\n", (long)i);
1676              }
1677      }
1678  
1679 @@ -159,7 +159,7 @@ static void PR_CALLBACK CXReader(void *a
1680  static void PR_CALLBACK CXWriter(void *arg)
1681  {
1682      CircBuf *cbp = (CircBuf *)arg;
1683 -    PRInt32 i, n;
1684 +    intptr_t i, n;
1685  
1686      n = count / 2;
1687      for (i = 0; i < n; i++) {
1688 --- pr/tests/cvar2.c.orig       2020-08-20 23:04:43 UTC
1689 +++ pr/tests/cvar2.c
1690 @@ -96,7 +96,7 @@ PrivateCondVarThread(void *_info)
1691      for (index=0; index<info->loops; index++) {
1692          PR_Lock(info->lock);
1693          if (*info->tcount == 0) {
1694 -            DPRINTF(("PrivateCondVarThread: thread 0x%lx waiting on cvar = 0x%lx\n",
1695 +            DPRINTF(("PrivateCondVarThread: thread %p waiting on cvar = %p\n",
1696                       PR_GetCurrentThread(), info->cvar));
1697              PR_WaitCondVar(info->cvar, info->timeout);
1698          }
1699 @@ -109,8 +109,8 @@ PrivateCondVarThread(void *_info)
1700          PR_Lock(info->exitlock);
1701          (*info->exitcount)++;
1702          PR_NotifyCondVar(info->exitcvar);
1703 -        DPRINTF(("PrivateCondVarThread: thread 0x%lx notified exitcvar = 0x%lx cnt = %ld\n",
1704 -                 PR_GetCurrentThread(), info->exitcvar,(*info->exitcount)));
1705 +        DPRINTF(("PrivateCondVarThread: thread %p notified exitcvar = %p cnt = %d\n",
1706 +                 PR_GetCurrentThread(), info->exitcvar,(int)(*info->exitcount)));
1707          PR_Unlock(info->exitlock);
1708      }
1709  #if 0
1710 @@ -159,7 +159,7 @@ CreateTestThread(threadinfo *info,
1711  void
1712  CondVarTestSUU(void *_arg)
1713  {
1714 -    PRInt32 arg = (PRInt32)_arg;
1715 +    PRInt32 arg = (PRInt32)(intptr_t)_arg;
1716      PRInt32 index, loops;
1717      threadinfo *list;
1718      PRLock *sharedlock;
1719 @@ -191,7 +191,7 @@ CondVarTestSUU(void *_arg)
1720                           PR_TRUE,
1721                           PR_LOCAL_THREAD);
1722          index++;
1723 -        DPRINTF(("CondVarTestSUU: created thread 0x%lx\n",list[index].thread));
1724 +        DPRINTF(("CondVarTestSUU: created thread %p\n",list[index].thread));
1725      }
1726  
1727      for (loops = 0; loops < count; loops++) {
1728 @@ -201,7 +201,7 @@ CondVarTestSUU(void *_arg)
1729              (*list[index].tcount)++;
1730              PR_NotifyCondVar(list[index].cvar);
1731              PR_Unlock(list[index].lock);
1732 -            DPRINTF(("PrivateCondVarThread: thread 0x%lx notified cvar = 0x%lx\n",
1733 +            DPRINTF(("PrivateCondVarThread: thread %p notified cvar = %p\n",
1734                       PR_GetCurrentThread(), list[index].cvar));
1735          }
1736  
1737 @@ -231,7 +231,7 @@ CondVarTestSUU(void *_arg)
1738  void
1739  CondVarTestSUK(void *_arg)
1740  {
1741 -    PRInt32 arg = (PRInt32)_arg;
1742 +    PRInt32 arg = (PRInt32)(intptr_t)_arg;
1743      PRInt32 index, loops;
1744      threadinfo *list;
1745      PRLock *sharedlock;
1746 @@ -307,7 +307,7 @@ CondVarTestSUK(void *_arg)
1747  void
1748  CondVarTestPUU(void *_arg)
1749  {
1750 -    PRInt32 arg = (PRInt32)_arg;
1751 +    PRInt32 arg = (PRInt32)(intptr_t)_arg;
1752      PRInt32 index, loops;
1753      threadinfo *list;
1754      PRLock *sharedlock;
1755 @@ -342,7 +342,7 @@ CondVarTestPUU(void *_arg)
1756                           PR_FALSE,
1757                           PR_LOCAL_THREAD);
1758  
1759 -        DPRINTF(("CondVarTestPUU: created thread 0x%lx\n",list[index].thread));
1760 +        DPRINTF(("CondVarTestPUU: created thread %p\n",list[index].thread));
1761          index++;
1762          tcount++;
1763      }
1764 @@ -360,8 +360,8 @@ CondVarTestPUU(void *_arg)
1765          PR_Lock(exitlock);
1766          /* Wait for threads to finish */
1767          while(exitcount < arg) {
1768 -            DPRINTF(("CondVarTestPUU: thread 0x%lx waiting on exitcvar = 0x%lx cnt = %ld\n",
1769 -                     PR_GetCurrentThread(), exitcvar, exitcount));
1770 +            DPRINTF(("CondVarTestPUU: thread %p waiting on exitcvar = %p cnt = %d\n",
1771 +                     PR_GetCurrentThread(), exitcvar, (int)exitcount));
1772              PR_WaitCondVar(exitcvar, PR_SecondsToInterval(60));
1773          }
1774          PR_ASSERT(exitcount >= arg);
1775 @@ -371,7 +371,7 @@ CondVarTestPUU(void *_arg)
1776  
1777      /* Join all the threads */
1778      for(index=0; index<(arg); index++)  {
1779 -        DPRINTF(("CondVarTestPUU: joining thread 0x%lx\n",list[index].thread));
1780 +        DPRINTF(("CondVarTestPUU: joining thread %p\n",list[index].thread));
1781          PR_JoinThread(list[index].thread);
1782          if (list[index].internal) {
1783              PR_Lock(list[index].lock);
1784 @@ -393,7 +393,7 @@ CondVarTestPUU(void *_arg)
1785  void
1786  CondVarTestPUK(void *_arg)
1787  {
1788 -    PRInt32 arg = (PRInt32)_arg;
1789 +    PRInt32 arg = (PRInt32)(intptr_t)_arg;
1790      PRInt32 index, loops;
1791      threadinfo *list;
1792      PRLock *sharedlock;
1793 @@ -475,7 +475,7 @@ CondVarTestPUK(void *_arg)
1794  void
1795  CondVarTest(void *_arg)
1796  {
1797 -    PRInt32 arg = (PRInt32)_arg;
1798 +    PRInt32 arg = (PRInt32)(intptr_t)_arg;
1799      PRInt32 index, loops;
1800      threadinfo *list;
1801      PRLock *sharedlock;
1802 @@ -609,7 +609,7 @@ CondVarTest(void *_arg)
1803  void
1804  CondVarTimeoutTest(void *_arg)
1805  {
1806 -    PRInt32 arg = (PRInt32)_arg;
1807 +    PRInt32 arg = (PRInt32)(intptr_t)_arg;
1808      PRInt32 index, loops;
1809      threadinfo *list;
1810      PRLock *sharedlock;
1811 @@ -721,7 +721,7 @@ CondVarTimeoutTest(void *_arg)
1812  void
1813  CondVarMixedTest(void *_arg)
1814  {
1815 -    PRInt32 arg = (PRInt32)_arg;
1816 +    PRInt32 arg = (PRInt32)(intptr_t)_arg;
1817      PRInt32 index, loops;
1818      threadinfo *list;
1819      PRLock *sharedlock;
1820 @@ -811,7 +811,7 @@ CondVarMixedTest(void *_arg)
1821          for(index=0; index<(arg*4); index+=3) {
1822  
1823              PR_Lock(list[index].lock);
1824 -            *list[index].tcount++;
1825 +            list[index].tcount++;
1826              PR_NotifyCondVar(list[index].cvar);
1827              PR_Unlock(list[index].lock);
1828  
1829 @@ -883,7 +883,7 @@ static void Measure(void (*func)(void *)
1830      double d;
1831  
1832      start = PR_IntervalNow();
1833 -    (*func)((void *)arg);
1834 +    (*func)((void *)(intptr_t)arg);
1835      stop = PR_IntervalNow();
1836  
1837      d = (double)PR_IntervalToMicroseconds(stop - start);
1838 @@ -948,7 +948,7 @@ This test is run with %d, %d, %d, and %d
1839      PR_SetConcurrency(2);
1840  
1841      for (threads = default_threads; threads < default_threads*5; threads+=default_threads) {
1842 -        printf("\n%ld Thread tests\n", threads);
1843 +        printf("\n%d Thread tests\n", (int)threads);
1844          Measure(CondVarTestSUU, threads, "Condvar simple test shared UU");
1845          Measure(CondVarTestSUK, threads, "Condvar simple test shared UK");
1846          Measure(CondVarTestPUU, threads, "Condvar simple test priv UU");
1847 --- pr/tests/foreign.c.orig     2020-08-20 23:04:43 UTC
1848 +++ pr/tests/foreign.c
1849 @@ -175,7 +175,7 @@ static void OneShot(void *arg)
1850      PRFileDesc *fd;
1851      PRDir *dir;
1852      PRFileDesc *pair[2];
1853 -    PRIntn test = (PRIntn)arg;
1854 +    intptr_t test = (intptr_t)arg;
1855  
1856      for (test = 0; test < 12; ++test) {
1857  
1858 @@ -272,7 +272,7 @@ static void OneShot(void *arg)
1859  int main(int argc, char **argv)
1860  {
1861      PRStatus rv;
1862 -    PRInt32 thread_cnt = DEFAULT_THREAD_COUNT;
1863 +    intptr_t    thread_cnt = DEFAULT_THREAD_COUNT;
1864      PLOptStatus os;
1865      PLOptState *opt = PL_CreateOptState(argc, argv, "dt:");
1866  
1867 --- pr/tests/forktest.c.orig    2020-08-20 23:04:43 UTC
1868 +++ pr/tests/forktest.c
1869 @@ -47,7 +47,7 @@ ClientThreadFunc(void *arg)
1870  {
1871      PRNetAddr addr;
1872      PRFileDesc *sock = NULL;
1873 -    PRInt32 tmp = (PRInt32)arg;
1874 +    intptr_t tmp = (intptr_t)arg;
1875  
1876      /*
1877       * Make sure the PR_Accept call will block
1878 @@ -143,7 +143,7 @@ DoIO(void)
1879          goto finish;
1880      }
1881      clientThread = PR_CreateThread( PR_USER_THREAD, ClientThreadFunc,
1882 -                                    (void *) PR_ntohs(addr.inet.port), PR_PRIORITY_NORMAL, PR_LOCAL_THREAD,
1883 +                                    (void *)(intptr_t)PR_ntohs(addr.inet.port), PR_PRIORITY_NORMAL, PR_LOCAL_THREAD,
1884                                      PR_JOINABLE_THREAD, 0);
1885      if (clientThread == NULL) {
1886          fprintf(stderr, "Cannot create client thread: (%d, %d)\n",
1887 @@ -151,6 +151,9 @@ DoIO(void)
1888          failed_already = 1;
1889          goto finish;
1890      }
1891 +    printf("Wait one second before accept\n");
1892 +    fflush(stdout);
1893 +    PR_Sleep(PR_SecondsToInterval(1));
1894      printf("Accepting connection at port %hu\n", PR_ntohs(addr.inet.port));
1895      fflush(stdout);
1896      sock = PR_Accept(listenSock, &addr, PR_SecondsToInterval(5));
1897 --- pr/tests/getai.c.orig       2020-08-20 23:04:43 UTC
1898 +++ pr/tests/getai.c
1899 @@ -13,8 +13,15 @@ int main(int argc, char **argv)
1900      PRAddrInfo *ai;
1901      void *iter;
1902      PRNetAddr addr;
1903 +    const char *host;
1904  
1905 -    ai = PR_GetAddrInfoByName(argv[1], PR_AF_UNSPEC, PR_AI_ADDRCONFIG);
1906 +    if (argc > 1) {
1907 +        host = argv[1];
1908 +    }
1909 +    else {
1910 +        host = "www.FreeBSD.org";
1911 +    }
1912 +    ai = PR_GetAddrInfoByName(host, PR_AF_UNSPEC, PR_AI_ADDRCONFIG);
1913      if (ai == NULL) {
1914          fprintf(stderr, "PR_GetAddrInfoByName failed: (%d, %d)\n",
1915                  PR_GetError(), PR_GetOSError());
1916 --- pr/tests/instrumt.c.orig    2020-08-20 23:04:43 UTC
1917 +++ pr/tests/instrumt.c
1918 @@ -36,6 +36,7 @@
1919  */
1920  
1921  #include <stdio.h>
1922 +#define DEBUG
1923  #include <plstr.h>
1924  #include <prclist.h>
1925  #include <prmem.h>
1926 @@ -50,7 +51,6 @@
1927  #define COUNT_LIMIT  (10 * ( 1024))
1928  
1929  #define SMALL_TRACE_BUFSIZE  ( 60 * 1024 )
1930 -
1931  typedef enum
1932  {
1933      CountLoop = 1,
1934 @@ -78,10 +78,10 @@ static void Help(void)
1935  
1936  static void ListCounters(void)
1937  {
1938 +#if defined(DEBUG) || defined(FORCE_NSPR_COUNTERS)
1939      PR_DEFINE_COUNTER( qh );
1940      PR_DEFINE_COUNTER( rh );
1941      const char *qn, *rn, *dn;
1942 -    const char **qname = &qn, **rname = &rn, **desc = &dn;
1943      PRUint32    tCtr;
1944  
1945      PR_INIT_COUNTER_HANDLE( qh, NULL );
1946 @@ -92,7 +92,7 @@ static void ListCounters(void)
1947          PR_FIND_NEXT_COUNTER_RNAME(rh, rh, qh );
1948          while ( rh != NULL )
1949          {
1950 -            PR_GET_COUNTER_NAME_FROM_HANDLE( rh, qname, rname, desc );
1951 +            PR_GET_COUNTER_NAME_FROM_HANDLE( rh, &qn, &rn, &dn );
1952              PR_GET_COUNTER(tCtr, rh);
1953              PR_LOG( lm, msgLevel,
1954                      ( "QName: %s  RName: %s  Desc: %s  Value: %ld\n",
1955 @@ -101,15 +101,15 @@ static void ListCounters(void)
1956          }
1957          PR_FIND_NEXT_COUNTER_QNAME(qh, qh);
1958      }
1959 -    return;
1960 +#endif
1961  } /* end ListCounters() */
1962  
1963  static void ListTraces(void)
1964  {
1965 +#if defined(DEBUG) || defined(FORCE_NSPR_TRACE)
1966      PR_DEFINE_TRACE( qh );
1967      PR_DEFINE_TRACE( rh );
1968      const char *qn, *rn, *dn;
1969 -    const char **qname = &qn, **rname = &rn, **desc = &dn;
1970  
1971      PR_INIT_TRACE_HANDLE( qh, NULL );
1972      PR_FIND_NEXT_TRACE_QNAME(qh, qh );
1973 @@ -119,7 +119,7 @@ static void ListTraces(void)
1974          PR_FIND_NEXT_TRACE_RNAME(rh, rh, qh );
1975          while ( rh != NULL )
1976          {
1977 -            PR_GET_TRACE_NAME_FROM_HANDLE( rh, qname, rname, desc );
1978 +            PR_GET_TRACE_NAME_FROM_HANDLE( rh, &qn, &rn, &dn );
1979              PR_LOG( lm, msgLevel,
1980                      ( "QName: %s  RName: %s  Desc: %s",
1981                        qn, rn, dn ));
1982 @@ -127,7 +127,7 @@ static void ListTraces(void)
1983          }
1984          PR_FIND_NEXT_TRACE_QNAME(qh, qh);
1985      }
1986 -    return;
1987 +#endif
1988  } /* end ListCounters() */
1989  
1990  
1991 @@ -326,7 +326,7 @@ static void PR_CALLBACK SampleTrace( voi
1992  */
1993  static void TraceTest( void )
1994  {
1995 -    PRInt32 i;
1996 +    PRIntn i = 0;
1997      PRInt32 size;
1998      PR_DEFINE_TRACE( th );
1999      PRThread *t1, *t2;
2000 --- pr/tests/io_timeout.c.orig  2020-08-20 23:04:43 UTC
2001 +++ pr/tests/io_timeout.c
2002 @@ -22,11 +22,13 @@
2003  /* Used to get the command line option */
2004  #include "plgetopt.h"
2005  
2006 +#include <errno.h>
2007  #include <stdio.h>
2008 +#include <string.h>
2009  #include "nspr.h"
2010  
2011  #define NUM_THREADS 1
2012 -#define BASE_PORT   8000
2013 +#define BASE_PORT   38011
2014  #define DEFAULT_ACCEPT_TIMEOUT 2
2015  
2016  typedef struct threadInfo {
2017 @@ -38,7 +40,7 @@ typedef struct threadInfo {
2018  } threadInfo;
2019  
2020  PRIntn failed_already = 0;
2021 -PRIntn debug_mode = 0;
2022 +PRIntn debug_mode = 1;
2023  
2024  #define LOCAL_SCOPE_STRING          "LOCAL scope"
2025  #define GLOBAL_SCOPE_STRING         "GLOBAL scope"
2026 @@ -54,7 +56,7 @@ thread_main(void *_info)
2027      PRFileDesc *clientSock;
2028      PRStatus rv;
2029      PRThreadScope tscope;
2030 -    char *scope_str;
2031 +    const char *scope_str;
2032  
2033  
2034      if (debug_mode) {
2035 @@ -74,6 +76,7 @@ thread_main(void *_info)
2036              break;
2037          default:
2038              PR_NOT_REACHED("Invalid thread scope");
2039 +            scope_str = NULL;
2040              break;
2041      }
2042      printf("thread id %d, scope %s\n", info->id, scope_str);
2043 @@ -92,8 +95,12 @@ thread_main(void *_info)
2044      listenAddr.inet.ip = PR_htonl(PR_INADDR_ANY);
2045      rv = PR_Bind(listenSock, &listenAddr);
2046      if (rv == PR_FAILURE) {
2047 -        if (debug_mode) {
2048 -            printf("unable to bind\n");
2049 +        if (debug_mode)
2050 +            printf("unable to bind to %d: %s\n",
2051 +                   BASE_PORT + info->id, strerror(PR_GetOSError()));
2052 +        if (PR_GetOSError() == EADDRINUSE) {
2053 +            printf("can not proceed with this test\n");
2054 +            exit(0);
2055          }
2056          failed_already=1;
2057          goto dead;
2058 @@ -117,8 +124,9 @@ thread_main(void *_info)
2059      if (clientSock == NULL) {
2060          if (PR_GetError() == PR_IO_TIMEOUT_ERROR) {
2061              if (debug_mode) {
2062 -                printf("PR_Accept() timeout worked!\n");
2063 -                printf("TEST PASSED! PR_Accept() returned error %d\n",
2064 +                printf("PR_Accept() timeout worked!\n"
2065 +                       "TEST PASSED! PR_Accept() returned error "
2066 +                       "PR_IO_TIMEOUT_ERROR (%ld)\n",
2067                         PR_IO_TIMEOUT_ERROR);
2068              }
2069          } else {
2070 --- pr/tests/layer.c.orig       2020-08-20 23:04:43 UTC
2071 +++ pr/tests/layer.c
2072 @@ -57,7 +57,10 @@ static PRUint16 default_port = 12273 POR
2073  static PRFileDesc *PushLayer(PRFileDesc *stack)
2074  {
2075      PRFileDesc *layer = PR_CreateIOLayerStub(identity, &myMethods);
2076 -    PRStatus rv = PR_PushIOLayer(stack, PR_GetLayersIdentity(stack), layer);
2077 +#if defined(DEBUG) || defined(FORCE_PR_ASSERT)
2078 +    PRStatus rv = /* we only need rv for PR_ASSERT() */
2079 +#endif
2080 +        PR_PushIOLayer(stack, PR_GetLayersIdentity(stack), layer);
2081      if (verbosity > quiet) {
2082          PR_fprintf(logFile, "Pushed layer(0x%x) onto stack(0x%x)\n", layer, stack);
2083      }
2084 --- pr/tests/lazyinit.c.orig    2020-08-20 23:04:43 UTC
2085 +++ pr/tests/lazyinit.c
2086 @@ -43,7 +43,6 @@ int main(int argc, char **argv)
2087      char *path = NULL;
2088      PRDir *dir = NULL;
2089      PRLock *ml = NULL;
2090 -    PRCondVar *cv = NULL;
2091      PRThread *thread = NULL;
2092      PRIntervalTime interval = 0;
2093      PRFileDesc *file, *udp, *tcp, *pair[2];
2094 --- pr/tests/lltest.c.orig      2020-08-20 23:04:43 UTC
2095 +++ pr/tests/lltest.c
2096 @@ -651,6 +651,7 @@ TestConversion( void )
2097      return;
2098  }
2099  
2100 +#if 0
2101  static void ShiftCompileOnly()
2102  {
2103      /*
2104 @@ -667,6 +668,7 @@ static void ShiftCompileOnly()
2105      LL_ISHL(ia, 49, 32);
2106  
2107  }  /* ShiftCompileOnly */
2108 +#endif
2109  
2110  
2111  /*
2112 @@ -751,7 +753,6 @@ TestArithmetic( void )
2113      PRInt64 largeValPlusOne   = LL_INIT( 0x00000002, 0x00000000 );
2114      PRInt64 largeValTimesTwo  = LL_INIT( 0x00000003, 0xfffffffe );
2115      PRInt64 largeMultCand     = LL_INIT( 0x00000000, 0x7fffffff );
2116 -    PRInt64 largeMinusMultCand = LL_INIT( 0xffffffff, 0x10000001 );
2117      PRInt64 largeMultCandx64K = LL_INIT( 0x00007fff, 0xffff0000 );
2118      PRInt64 largeNumSHL5      = LL_INIT( 0x0000001f, 0xffffffe0 );
2119      PRInt64 result, result2;
2120 --- pr/tests/mbcs.c.orig        2020-08-20 23:04:43 UTC
2121 +++ pr/tests/mbcs.c
2122 @@ -54,13 +54,12 @@ char *dirName =  NULL;  /* directory nam
2123  /*
2124  ** Traverse directory
2125  */
2126 -static void TraverseDirectory( unsigned char *dir )
2127 +static void TraverseDirectory(const char *dir)
2128  {
2129      PRDir *cwd;
2130      PRDirEntry *dirEntry;
2131      PRFileInfo info;
2132      PRStatus rc;
2133 -    PRInt32 err;
2134      PRFileDesc *fd;
2135      char    nextDir[256];
2136      char    file[256];
2137 @@ -81,16 +80,16 @@ static void TraverseDirectory( unsigned
2138              exit(1);
2139          }
2140          if ( PR_FILE_FILE == info.type )  {
2141 -            printf("File: %s \tsize: %ld\n", dirEntry->name, info.size );
2142 +            printf("File: %s \tsize: %ld\n", dirEntry->name, (long)info.size );
2143              fd = PR_Open( file, PR_RDONLY, 0 );
2144              if ( NULL == fd )  {
2145                  printf("PR_Open() failed. Error: %ld, OSError: %ld\n",
2146 -                       PR_GetError(), PR_GetOSError());
2147 +                       (long)PR_GetError(), (long)PR_GetOSError());
2148              }
2149              rc = PR_Close( fd );
2150              if ( PR_FAILURE == rc )  {
2151                  printf("PR_Close() failed. Error: %ld, OSError: %ld\n",
2152 -                       PR_GetError(), PR_GetOSError());
2153 +                       (long)PR_GetError(), (long)PR_GetOSError());
2154              }
2155          } else if ( PR_FILE_DIRECTORY == info.type ) {
2156              sprintf( nextDir, "%s/%s", dir, dirEntry->name );
2157 --- pr/tests/nbconn.c.orig      2020-08-20 23:04:43 UTC
2158 +++ pr/tests/nbconn.c
2159 @@ -54,8 +54,7 @@ int main(int argc, char **argv)
2160      PRStatus rv;
2161      PRSocketOptionData optData;
2162      const char *hostname = NULL;
2163 -    PRIntn default_case, n, bytes_read, bytes_sent;
2164 -    PRInt32 failed_already = 0;
2165 +    PRIntn default_case, n;
2166  
2167      /*
2168       * -d           debug mode
2169 @@ -169,7 +168,7 @@ int main(int argc, char **argv)
2170                  exit(1);
2171              }
2172              printf( "PR_GetConnectStatus: connect failed: (%ld, %ld)\n",
2173 -                    PR_GetError(), PR_GetOSError());
2174 +                    (long)PR_GetError(), (long)PR_GetOSError());
2175          }
2176          PR_Close(sock);
2177          printf( "PASS\n");
2178 @@ -240,7 +239,7 @@ connection_success_test()
2179      PRThread *thr = NULL;
2180      Server_Param sp;
2181      char send_buf[DATA_BUF_SIZE], recv_buf[DATA_BUF_SIZE];
2182 -    PRIntn default_case, n, bytes_read, bytes_sent;
2183 +    PRIntn n, bytes_read, bytes_sent;
2184      PRIntn failed_already = 0;
2185  
2186      /*
2187 @@ -317,7 +316,7 @@ connection_success_test()
2188          failed_already=1;
2189          goto def_exit;
2190      }
2191 -    DPRINTF(("Created TCP_Server thread [0x%x]\n",thr));
2192 +    DPRINTF(("Created TCP_Server thread [%p]\n", thr));
2193      pd.fd = conn_fd;
2194      pd.in_flags = PR_POLL_WRITE | PR_POLL_EXCEPT;
2195      n = PR_Poll(&pd, 1, PR_INTERVAL_NO_TIMEOUT);
2196 @@ -396,7 +395,7 @@ connection_success_test()
2197          DPRINTF(("Data integrity verified\n"));
2198      } else {
2199          fprintf(stderr,"PR_GetConnectStatus: connect failed: (%ld, %ld)\n",
2200 -                PR_GetError(), PR_GetOSError());
2201 +                (long)PR_GetError(), (long)PR_GetOSError());
2202          failed_already = 1;
2203          goto def_exit;
2204      }
2205 @@ -505,7 +504,6 @@ connection_failure_test()
2206          goto def_exit;
2207      }
2208      if (PR_GetConnectStatus(&pd) == PR_SUCCESS) {
2209 -        PRInt32 rv;
2210          fprintf(stderr,"PR_GetConnectStatus succeeded, expected to fail\n");
2211          failed_already = 1;
2212          goto def_exit;
2213 --- pr/tests/nblayer.c.orig     2020-08-20 23:04:43 UTC
2214 +++ pr/tests/nblayer.c
2215 @@ -360,7 +360,7 @@ static PRStatus PR_CALLBACK MyClose(PRFi
2216  static PRInt16 PR_CALLBACK MyPoll(
2217      PRFileDesc *fd, PRInt16 in_flags, PRInt16 *out_flags)
2218  {
2219 -    PRInt16 my_flags, new_flags;
2220 +    PRInt16 my_flags = -1, new_flags;
2221      PRFilePrivate *mine = (PRFilePrivate*)fd->secret;
2222      if (0 != (PR_POLL_READ & in_flags))
2223      {
2224 @@ -405,7 +405,7 @@ static PRFileDesc * PR_CALLBACK MyAccept
2225      PRFileDesc *fd, PRNetAddr *addr, PRIntervalTime timeout)
2226  {
2227      PRStatus rv;
2228 -    PRFileDesc *newfd, *layer = fd;
2229 +    PRFileDesc *newfd;
2230      PRFileDesc *newstack;
2231      PRFilePrivate *newsecret;
2232  
2233 @@ -507,6 +507,8 @@ static PRInt32 PR_CALLBACK MyRecv(
2234                  mine->rcvinprogress = 0;
2235                  return mine->rcvreq;  /* << -- that's it! */
2236              default:
2237 +                PR_ASSERT(!"How did I get this mine->rcvstate?");
2238 +                rv = -1;
2239                  break;
2240          }
2241      } while (-1 != rv);
2242 @@ -575,6 +577,8 @@ static PRInt32 PR_CALLBACK MySend(
2243                  mine->xmtinprogress = 0;
2244                  return mine->xmtreq;  /* <<-- That's the one! */
2245              default:
2246 +                PR_ASSERT(!"How did I get this mine->xmtstate?");
2247 +                rv = -1;
2248                  break;
2249          }
2250      } while (-1 != rv);
2251 --- pr/tests/nonblock.c.orig    2020-08-20 23:04:43 UTC
2252 +++ pr/tests/nonblock.c
2253 @@ -37,7 +37,7 @@
2254  static void PR_CALLBACK
2255  clientThreadFunc(void *arg)
2256  {
2257 -    PRUintn port = (PRUintn)arg;
2258 +    intptr_t port = (intptr_t)arg;
2259      PRFileDesc *sock;
2260      PRNetAddr addr;
2261      char buf[CHUNK_SIZE];
2262 @@ -145,7 +145,7 @@ static PRIntn PR_CALLBACK RealMain( PRIn
2263      printf("%s", buf);
2264  
2265      clientThread = PR_CreateThread(PR_USER_THREAD,
2266 -                                   clientThreadFunc, (void *) listenPort,
2267 +                                   clientThreadFunc, (void *) (intptr_t)listenPort,
2268                                     PR_PRIORITY_NORMAL, PR_LOCAL_THREAD,
2269                                     PR_UNJOINABLE_THREAD, 0);
2270      if (clientThread == NULL) {
2271 @@ -189,7 +189,7 @@ static PRIntn PR_CALLBACK RealMain( PRIn
2272          if (retVal != -1 || PR_GetError() != PR_WOULD_BLOCK_ERROR) {
2273              PL_PrintError("First Receive:\n");
2274              fprintf(stderr, "First PR_Recv: retVal: %ld, Error: %ld\n",
2275 -                    retVal, PR_GetError());
2276 +                    (long)retVal, (long)PR_GetError());
2277              exit(1);
2278          }
2279          printf("read: EWOULDBLOCK, good\n");
2280 @@ -199,7 +199,7 @@ static PRIntn PR_CALLBACK RealMain( PRIn
2281          if (retVal != CHUNK_SIZE) {
2282              PL_PrintError("Second Receive:\n");
2283              fprintf(stderr, "Second PR_Recv: retVal: %ld, Error: %ld\n",
2284 -                    retVal, PR_GetError());
2285 +                    (long)retVal, (long)PR_GetError());
2286              exit(1);
2287          }
2288          printf("read: %d bytes, good\n", retVal);
2289 --- pr/tests/obsints.c.orig     2020-08-20 23:04:43 UTC
2290 +++ pr/tests/obsints.c
2291 @@ -25,6 +25,9 @@ int main(int argc, char **argv)
2292  #else /* NO_NSPR_10_SUPPORT */
2293  
2294  #include "prtypes.h"  /* which includes protypes.h */
2295 +#if !defined(__GNUC__)
2296 +#   define __unused
2297 +#endif
2298  
2299  int main(int argc, char **argv)
2300  {
2301 @@ -32,17 +35,17 @@ int main(int argc, char **argv)
2302       * Compilation fails if any of these integer types are not
2303       * defined by protypes.h.
2304       */
2305 -    intn in;
2306 -    uintn uin;
2307 -    uint ui;
2308 -    int8 i8;
2309 -    uint8 ui8;
2310 -    int16 i16;
2311 -    uint16 ui16;
2312 -    int32 i32;
2313 -    uint32 ui32;
2314 -    int64 i64;
2315 -    uint64 ui64;
2316 +    intn in __unused;
2317 +    uintn uin __unused;
2318 +    uint ui __unused;
2319 +    int8 i8 __unused;
2320 +    uint8 ui8 __unused;
2321 +    int16 i16 __unused;
2322 +    uint16 ui16 __unused;
2323 +    int32 i32 __unused;
2324 +    uint32 ui32 __unused;
2325 +    int64 i64 __unused;
2326 +    uint64 ui64 __unused;
2327  
2328      printf("PASS\n");
2329      return 0;
2330 --- pr/tests/parsetm.c.orig     2020-08-20 23:04:43 UTC
2331 +++ pr/tests/parsetm.c
2332 @@ -32,8 +32,8 @@ static void PrintExplodedTime(const PREx
2333  
2334      /* Print day of the week, month, day, hour, minute, and second */
2335      if (debug_mode) printf("%s %s %ld %02ld:%02ld:%02ld ",
2336 -                               dayOfWeek[et->tm_wday], month[et->tm_month], et->tm_mday,
2337 -                               et->tm_hour, et->tm_min, et->tm_sec);
2338 +                               dayOfWeek[et->tm_wday], month[et->tm_month], (long)et->tm_mday,
2339 +                               (long)et->tm_hour, (long)et->tm_min, (long)et->tm_sec);
2340  
2341      /* Print time zone */
2342      totalOffset = et->tm_params.tp_gmt_offset + et->tm_params.tp_dst_offset;
2343 @@ -50,7 +50,7 @@ static void PrintExplodedTime(const PREx
2344          hourOffset = totalOffset / 3600;
2345          minOffset = (totalOffset % 3600) / 60;
2346          if (debug_mode) {
2347 -            printf("%s%02ld%02ld ", sign, hourOffset, minOffset);
2348 +            printf("%s%02ld%02ld ", sign, (long)hourOffset, (long)minOffset);
2349          }
2350      }
2351  
2352 --- pr/tests/peek.c.orig        2020-08-20 23:04:43 UTC
2353 +++ pr/tests/peek.c
2354 @@ -137,7 +137,7 @@ static void ClientNB(void *arg)
2355  {
2356      PRFileDesc *sock;
2357      PRSocketOptionData opt;
2358 -    PRUint16 port = (PRUint16) arg;
2359 +    PRUint16 port = (intptr_t) arg;
2360      PRNetAddr addr;
2361      char buf[BUFFER_SIZE];
2362      PRPollDesc pd;
2363 @@ -301,7 +301,7 @@ RunTest(PRThreadScope scope, PRFileDesc
2364          exit(1);
2365      }
2366      client = PR_CreateThread(
2367 -                 PR_USER_THREAD, ClientNB, (void *) port,
2368 +                 PR_USER_THREAD, ClientNB, (void *)(intptr_t) port,
2369                   PR_PRIORITY_NORMAL, scope, PR_JOINABLE_THREAD, 0);
2370      if (NULL == client) {
2371          fprintf(stderr, "PR_CreateThread failed\n");
2372 --- pr/tests/perf.c.orig        2020-08-20 23:04:43 UTC
2373 +++ pr/tests/perf.c
2374 @@ -142,7 +142,7 @@ static void PR_CALLBACK CXReader(void *a
2375      n = count / 2;
2376      for (i = 0; i < n; i++) {
2377          while (cxq == 0) {
2378 -            DPRINTF(("CXReader: thread = 0x%lx waiting\n",
2379 +            DPRINTF(("CXReader: thread = %p waiting\n",
2380                       PR_GetCurrentThread()));
2381              PR_Wait(mon, PR_INTERVAL_NO_TIMEOUT);
2382          }
2383 @@ -155,7 +155,7 @@ static void PR_CALLBACK CXReader(void *a
2384      --alive;
2385      PR_Notify(mon2);
2386      PR_ExitMonitor(mon2);
2387 -    DPRINTF(("CXReader: thread = 0x%lx exiting\n", PR_GetCurrentThread()));
2388 +    DPRINTF(("CXReader: thread = %p exiting\n", PR_GetCurrentThread()));
2389  }
2390  
2391  static void PR_CALLBACK CXWriter(void *arg)
2392 @@ -166,7 +166,7 @@ static void PR_CALLBACK CXWriter(void *a
2393      n = count / 2;
2394      for (i = 0; i < n; i++) {
2395          while (cxq == 1) {
2396 -            DPRINTF(("CXWriter: thread = 0x%lx waiting\n",
2397 +            DPRINTF(("CXWriter: thread = %p waiting\n",
2398                       PR_GetCurrentThread()));
2399              PR_Wait(mon, PR_INTERVAL_NO_TIMEOUT);
2400          }
2401 @@ -179,7 +179,7 @@ static void PR_CALLBACK CXWriter(void *a
2402      --alive;
2403      PR_Notify(mon2);
2404      PR_ExitMonitor(mon2);
2405 -    DPRINTF(("CXWriter: thread = 0x%lx exiting\n", PR_GetCurrentThread()));
2406 +    DPRINTF(("CXWriter: thread = %p exiting\n", PR_GetCurrentThread()));
2407  }
2408  
2409  static void ContextSwitch(PRThreadScope scope1, PRThreadScope scope2)
2410 @@ -199,7 +199,7 @@ static void ContextSwitch(PRThreadScope
2411      if (NULL == t1) {
2412          fprintf(stderr, "ContextSwitch: cannot create thread\n");
2413      } else {
2414 -        DPRINTF(("ContextSwitch: created %s thread = 0x%lx\n",
2415 +        DPRINTF(("ContextSwitch: created %s thread = %p\n",
2416                   (scope1 == PR_GLOBAL_THREAD ?
2417                    "PR_GLOBAL_THREAD" : "PR_LOCAL_THREAD"),
2418                   t1));
2419 @@ -213,7 +213,7 @@ static void ContextSwitch(PRThreadScope
2420      if (NULL == t2) {
2421          fprintf(stderr, "ContextSwitch: cannot create thread\n");
2422      } else {
2423 -        DPRINTF(("ContextSwitch: created %s thread = 0x%lx\n",
2424 +        DPRINTF(("ContextSwitch: created %s thread = %p\n",
2425                   (scope2 == PR_GLOBAL_THREAD ?
2426                    "PR_GLOBAL_THREAD" : "PR_LOCAL_THREAD"),
2427                   t2));
2428 @@ -255,10 +255,10 @@ static void PR_CALLBACK SemaThread(void
2429  
2430      n = count / 2;
2431      for (i = 0; i < n; i++) {
2432 -        DPRINTF(("SemaThread: thread = 0x%lx waiting on sem = 0x%lx\n",
2433 +        DPRINTF(("SemaThread: thread = %p waiting on sem = %p\n",
2434                   PR_GetCurrentThread(), sem[0]));
2435          PR_WaitSem(sem[0]);
2436 -        DPRINTF(("SemaThread: thread = 0x%lx posting on sem = 0x%lx\n",
2437 +        DPRINTF(("SemaThread: thread = %p posting on sem = %p\n",
2438                   PR_GetCurrentThread(), sem[1]));
2439          PR_PostSem(sem[1]);
2440      }
2441 @@ -267,7 +267,7 @@ static void PR_CALLBACK SemaThread(void
2442      --alive;
2443      PR_Notify(mon2);
2444      PR_ExitMonitor(mon2);
2445 -    DPRINTF(("SemaThread: thread = 0x%lx exiting\n", PR_GetCurrentThread()));
2446 +    DPRINTF(("SemaThread: thread = %p exiting\n", PR_GetCurrentThread()));
2447  }
2448  
2449  static  PRSemaphore *sem_set1[2];
2450 @@ -295,7 +295,7 @@ static void SemaContextSwitch(PRThreadSc
2451      if (NULL == t1) {
2452          fprintf(stderr, "SemaContextSwitch: cannot create thread\n");
2453      } else {
2454 -        DPRINTF(("SemaContextSwitch: created %s thread = 0x%lx\n",
2455 +        DPRINTF(("SemaContextSwitch: created %s thread = %p\n",
2456                   (scope1 == PR_GLOBAL_THREAD ?
2457                    "PR_GLOBAL_THREAD" : "PR_LOCAL_THREAD"),
2458                   t1));
2459 @@ -310,7 +310,7 @@ static void SemaContextSwitch(PRThreadSc
2460      if (NULL == t2) {
2461          fprintf(stderr, "SemaContextSwitch: cannot create thread\n");
2462      } else {
2463 -        DPRINTF(("SemaContextSwitch: created %s thread = 0x%lx\n",
2464 +        DPRINTF(("SemaContextSwitch: created %s thread = %p\n",
2465                   (scope2 == PR_GLOBAL_THREAD ?
2466                    "PR_GLOBAL_THREAD" : "PR_LOCAL_THREAD"),
2467                   t2));
2468 --- pr/tests/pipepong.c.orig    2020-08-20 23:04:43 UTC
2469 +++ pr/tests/pipepong.c
2470 @@ -36,7 +36,7 @@ int main(int argc, char **argv)
2471          nBytes = fread(buf, 1, 5, stdin);
2472          fprintf(stderr, "pong process: received \"%s\"\n", buf);
2473          if (nBytes != 5) {
2474 -            fprintf(stderr, "pong process: expected 5 bytes but got %d bytes\n",
2475 +            fprintf(stderr, "pong process: expected 5 bytes but got %zd bytes\n",
2476                      nBytes);
2477              exit(1);
2478          }
2479 --- pr/tests/poll_nm.c.orig     2020-08-20 23:04:43 UTC
2480 +++ pr/tests/poll_nm.c
2481 @@ -47,7 +47,7 @@ PRIntn debug_mode;
2482  static void PR_CALLBACK
2483  clientThreadFunc(void *arg)
2484  {
2485 -    PRUintn port = (PRUintn) arg;
2486 +    PRUintn port = (intptr_t) arg;
2487      PRFileDesc *sock;
2488      PRNetAddr addr;
2489      char buf[128];
2490 @@ -200,7 +200,7 @@ int main(int argc, char **argv)
2491      npds = 5;
2492  
2493      clientThread = PR_CreateThread(PR_USER_THREAD,
2494 -                                   clientThreadFunc, (void *) listenPort1,
2495 +                                   clientThreadFunc, (void *)(intptr_t)listenPort1,
2496                                     PR_PRIORITY_NORMAL, PR_LOCAL_THREAD,
2497                                     PR_UNJOINABLE_THREAD, 0);
2498      if (clientThread == NULL) {
2499 @@ -210,7 +210,7 @@ int main(int argc, char **argv)
2500      }
2501  
2502      clientThread = PR_CreateThread(PR_USER_THREAD,
2503 -                                   clientThreadFunc, (void *) listenPort2,
2504 +                                   clientThreadFunc, (void *)(intptr_t)listenPort2,
2505                                     PR_PRIORITY_NORMAL, PR_LOCAL_THREAD,
2506                                     PR_UNJOINABLE_THREAD, 0);
2507      if (clientThread == NULL) {
2508 --- pr/tests/prfz.c.orig        2020-08-20 23:04:43 UTC
2509 +++ pr/tests/prfz.c
2510 @@ -7,7 +7,7 @@
2511   */
2512  
2513  #include "prprf.h"
2514 -#include <sys/types.h>
2515 +#include <stdint.h>
2516  #include <limits.h>
2517  #include <string.h>
2518  #include <stdint.h>
2519 --- pr/tests/provider.c.orig    2020-08-20 23:04:43 UTC
2520 +++ pr/tests/provider.c
2521 @@ -1078,7 +1078,7 @@ int main(int argc, char **argv)
2522  {
2523      PRUintn index;
2524      PRBool boolean;
2525 -    CSClient_t *client;
2526 +    CSClient_t *client = NULL;
2527      PRStatus rv, joinStatus;
2528      CSServer_t *server = NULL;
2529      char *thread_type;
2530 --- pr/tests/prpoll.c.orig      2020-08-20 23:04:43 UTC
2531 +++ pr/tests/prpoll.c
2532 @@ -39,7 +39,7 @@ int main(int argc, char **argv)
2533  static void
2534  clientThreadFunc(void *arg)
2535  {
2536 -    PRUint16 port = (PRUint16) arg;
2537 +    PRUint16 port = (PRUint16)(uintptr_t)arg;
2538      PRFileDesc *sock;
2539      PRNetAddr addr;
2540      char buf[BUF_SIZE];
2541 @@ -73,7 +73,7 @@ int main(int argc, char **argv)
2542      PRInt32 rv;
2543      PROsfd sd;
2544      struct sockaddr_in saddr;
2545 -    PRIntn saddr_len;
2546 +    socklen_t saddr_len;
2547      PRUint16 listenPort3;
2548      PRFileDesc *socket_poll_fd;
2549      PRIntn i, j;
2550 @@ -199,7 +199,7 @@ int main(int argc, char **argv)
2551      npds--;
2552  
2553      clientThread = PR_CreateThread(PR_USER_THREAD,
2554 -                                   clientThreadFunc, (void *) listenPort1,
2555 +                                   clientThreadFunc, (void *)(uintptr_t)listenPort1,
2556                                     PR_PRIORITY_NORMAL, PR_LOCAL_THREAD,
2557                                     PR_UNJOINABLE_THREAD, 0);
2558      if (clientThread == NULL) {
2559 @@ -208,7 +208,7 @@ int main(int argc, char **argv)
2560      }
2561  
2562      clientThread = PR_CreateThread(PR_USER_THREAD,
2563 -                                   clientThreadFunc, (void *) listenPort2,
2564 +                                   clientThreadFunc, (void *)(uintptr_t)listenPort2,
2565                                     PR_PRIORITY_NORMAL, PR_GLOBAL_THREAD,
2566                                     PR_UNJOINABLE_THREAD, 0);
2567      if (clientThread == NULL) {
2568 @@ -217,7 +217,7 @@ int main(int argc, char **argv)
2569      }
2570  
2571      clientThread = PR_CreateThread(PR_USER_THREAD,
2572 -                                   clientThreadFunc, (void *) listenPort3,
2573 +                                   clientThreadFunc, (void *)(uintptr_t)listenPort3,
2574                                     PR_PRIORITY_NORMAL, PR_GLOBAL_BOUND_THREAD,
2575                                     PR_UNJOINABLE_THREAD, 0);
2576      if (clientThread == NULL) {
2577 --- pr/tests/randseed.c.orig    2020-08-20 23:04:43 UTC
2578 +++ pr/tests/randseed.c
2579 @@ -48,7 +48,6 @@ static void Help( void )
2580  static void PrintRand( void *buf, PRIntn size )
2581  {
2582      PRUint32 *rp = buf;
2583 -    PRIntn   i;
2584  
2585      printf("%4.4d--\n", size );
2586      while (size > 0 ) {
2587 --- pr/tests/ranfile.c.orig     2020-08-20 23:04:43 UTC
2588 +++ pr/tests/ranfile.c
2589 @@ -130,7 +130,7 @@ static void PR_CALLBACK Thread(void *arg
2590      PRStatus rv = PR_SUCCESS;
2591      Hammer_t *cd = (Hammer_t*)arg;
2592  
2593 -    (void)sprintf(filename, "%ssg%04ld.dat", baseName, cd->id);
2594 +    (void)sprintf(filename, "%ssg%04d.dat", baseName, (int)cd->id);
2595  
2596      if (debug_mode) {
2597          printf("Starting work on %s\n", filename);
2598 @@ -405,8 +405,8 @@ int main(int argc, char **argv)
2599                      durationTot += duration;
2600                  }
2601                  else if (debug_mode) printf(
2602 -                        "%s: test failed %s after %ld seconds\n",
2603 -                        programName, where[hammer[poll].problem], duration);
2604 +                        "%s: test failed %s after %d seconds\n",
2605 +                        programName, where[hammer[poll].problem], (int)duration);
2606                  else {
2607                      failed_already=1;
2608                  }
2609 @@ -414,7 +414,7 @@ int main(int argc, char **argv)
2610          }
2611      }
2612      if (debug_mode) printf(
2613 -            "%s: [%ld [%ld] %ld] writes/sec average\n",
2614 +            "%s: [%d [%d] %d] writes/sec average\n",
2615              programName, writesMin, writesTot * 1000 / durationTot, writesMax);
2616  
2617      PR_DestroyCondVar(cv);
2618 --- pr/tests/runtests.sh.orig   2020-08-20 23:04:43 UTC
2619 +++ pr/tests/runtests.sh
2620 @@ -226,7 +226,7 @@ OBJDIR=`basename $PWD`
2621  printf "\nNSPR Test Results - $OBJDIR\n\n"
2622  printf "BEGIN\t\t\t`date`\n"
2623  printf "NSPR_TEST_LOGFILE\t${LOGFILE}\n\n"
2624 -printf "Test\t\t\tResult\n\n"
2625 +printf "            Test\t\t\tResult\n\n"
2626  if [ $OS_PLATFORM = "Windows_95" ] || [ $OS_PLATFORM = "Windows_98" ] || [ $OS_PLATFORM = "Windows_NT" ] || [ $OS_PLATFORM = "OS/2" ] ; then
2627         for prog in $TESTS
2628         do
2629 @@ -244,10 +244,8 @@ if [ $OS_PLATFORM = "Windows_95" ] || [
2630  else
2631         for prog in $TESTS
2632         do
2633 -               printf "$prog (`date +%T`)"
2634 -               printf "\nBEGIN TEST: $prog\n\n" >> ${LOGFILE} 2>&1
2635 -               export test_rval
2636 -               ./$prog >> ${LOGFILE} 2>&1 &
2637 +               printf %16s $prog
2638 +               ./$prog >> $prog.output 2>&1 &
2639                 test_pid=$!
2640                 sleep_pid=0
2641                 if test -n "$TEST_TIMEOUT" && test "$TEST_TIMEOUT" -gt 0
2642 @@ -262,9 +260,9 @@ else
2643                         printf "\t\t\tPassed\n";
2644                 else
2645                         printf "\t\t\tFAILED\n";
2646 +                       sed "s,^,       $prog:  ," < $prog.output
2647                         rval=1
2648                 fi;
2649 -               printf "\nEND TEST: $prog\n\n" >> ${LOGFILE} 2>&1
2650         done
2651  fi;
2652  
2653 --- pr/tests/sel_spd.c.orig     2020-08-20 23:04:43 UTC
2654 +++ pr/tests/sel_spd.c
2655 @@ -15,6 +15,9 @@
2656  #include <stdio.h>
2657  #include <errno.h>
2658  #include <string.h>
2659 +#if defined(XP_UNIX) || defined(XP_OS2_EMX)
2660 +#   include <unistd.h>  /* getopt(3) */
2661 +#endif
2662  
2663  #ifdef DEBUG
2664  #define PORT_INC_DO +100
2665 @@ -30,19 +33,19 @@
2666  #define PORT_BASE 19000 PORT_INC_DO PORT_INC_3264
2667  
2668  typedef struct timer_slot_t {
2669 -    unsigned long d_connect;
2670 -    unsigned long d_cl_data;
2671 -    unsigned long d_sv_data;
2672 -    unsigned long d_close;
2673 -    unsigned long d_total;
2674 -    unsigned long requests;
2675 +    unsigned int d_connect;
2676 +    unsigned int d_cl_data;
2677 +    unsigned int d_sv_data;
2678 +    unsigned int d_close;
2679 +    unsigned int d_total;
2680 +    unsigned int requests;
2681  } timer_slot_t;
2682  
2683 -static long _iterations = 5;
2684 -static long _client_data = 8192;
2685 +static int _iterations = 5;
2686 +static int _client_data = 8192;
2687  
2688 -static long _server_data = (128*1024);
2689 -static long _threads_max = 10, _threads = 10;
2690 +static int _server_data = (128*1024);
2691 +static int _threads_max = 10, _threads = 10;
2692  
2693  static int verbose=0;
2694  static PRMonitor *exit_cv;
2695 @@ -98,7 +101,7 @@ _server_thread(void *arg_id)
2696  {
2697      void _client_thread(void *);
2698      int *id =  (int *)arg_id;
2699 -    PRFileDesc *sock;
2700 +    PRFileDesc *sock = NULL;
2701      PRSocketOptionData sockopt;
2702      PRNetAddr sa;
2703      PRFileDesc * newsock;
2704 @@ -476,12 +479,12 @@ void
2705  tally_results(int verbose)
2706  {
2707      int index;
2708 -    unsigned long tot_connect = 0;
2709 -    unsigned long tot_cl_data = 0;
2710 -    unsigned long tot_sv_data = 0;
2711 -    unsigned long tot_close = 0;
2712 -    unsigned long tot_all = 0;
2713 -    unsigned long tot_requests = 0;
2714 +    unsigned int tot_connect = 0;
2715 +    unsigned int tot_cl_data = 0;
2716 +    unsigned int tot_sv_data = 0;
2717 +    unsigned int tot_close = 0;
2718 +    unsigned int tot_all = 0;
2719 +    unsigned int tot_requests = 0;
2720  
2721      fprintf(stdout, "Server results:\n\n");
2722      for (index=0; index<_threads_max*2; index+=2) {
2723 --- pr/tests/selct_nm.c.orig    2020-08-20 23:04:43 UTC
2724 +++ pr/tests/selct_nm.c
2725 @@ -45,7 +45,7 @@ PRIntn debug_mode;
2726  static void
2727  clientThreadFunc(void *arg)
2728  {
2729 -    PRUintn port = (PRUintn) arg;
2730 +    PRUintn port = (PRUintn)(uintptr_t)arg;
2731      PRFileDesc *sock;
2732      PRNetAddr addr;
2733      char buf[128];
2734 @@ -169,7 +169,7 @@ int main(int argc, char **argv)
2735      }
2736  
2737      clientThread = PR_CreateThread(PR_USER_THREAD,
2738 -                                   clientThreadFunc, (void *) listenPort1,
2739 +                                   clientThreadFunc, (void *)(uintptr_t)listenPort1,
2740                                     PR_PRIORITY_NORMAL, PR_LOCAL_THREAD,
2741                                     PR_UNJOINABLE_THREAD, 0);
2742      if (clientThread == NULL) {
2743 @@ -179,7 +179,7 @@ int main(int argc, char **argv)
2744      }
2745  
2746      clientThread = PR_CreateThread(PR_USER_THREAD,
2747 -                                   clientThreadFunc, (void *) listenPort2,
2748 +                                   clientThreadFunc, (void *)(uintptr_t)listenPort2,
2749                                     PR_PRIORITY_NORMAL, PR_LOCAL_THREAD,
2750                                     PR_UNJOINABLE_THREAD, 0);
2751      if (clientThread == NULL) {
2752 --- pr/tests/select2.c.orig     2020-08-20 23:04:43 UTC
2753 +++ pr/tests/select2.c
2754 @@ -53,6 +53,7 @@ PRInt32 count;
2755  **
2756  ***********************************************************************/
2757  
2758 +static int exitcode = 2;
2759  
2760  static void Test_Result (int result)
2761  {
2762 @@ -60,9 +61,13 @@ static void Test_Result (int result)
2763      {
2764          case PASS:
2765              printf ("PASS\n");
2766 +            if (exitcode == 2) {
2767 +                exitcode = 0;
2768 +            }
2769              break;
2770          case FAIL:
2771              printf ("FAIL\n");
2772 +            exitcode = 1;
2773              break;
2774          default:
2775              printf ("NOSTATUS\n");
2776 @@ -382,4 +387,5 @@ int main(int argc, char **argv)
2777      PR_Cleanup();
2778  
2779  
2780 +    return exitcode;
2781  }
2782 --- pr/tests/semaerr.c.orig     2020-08-20 23:04:43 UTC
2783 +++ pr/tests/semaerr.c
2784 @@ -72,7 +72,7 @@ int main(int argc, char **argv)
2785          exit(1);
2786      }
2787      if (PR_GetError() != PR_FILE_NOT_FOUND_ERROR) {
2788 -        fprintf(stderr, "Expected error is %d but got (%d, %d)\n",
2789 +        fprintf(stderr, "Expected error is %ld (PR_FILE_NOT_FOUND_ERROR) but got (%d, %d)\n",
2790                  PR_FILE_NOT_FOUND_ERROR, PR_GetError(), PR_GetOSError());
2791          exit(1);
2792      }
2793 --- pr/tests/semaerr1.c.orig    2020-08-20 23:04:43 UTC
2794 +++ pr/tests/semaerr1.c
2795 @@ -83,7 +83,7 @@ int main(int argc, char **argv)
2796          exit(1);
2797      }
2798      if (PR_GetError() != PR_FILE_EXISTS_ERROR) {
2799 -        fprintf(stderr, "Expect %d but got %d\n", PR_FILE_EXISTS_ERROR,
2800 +        fprintf(stderr, "Expected %ld (PR_FILE_EXISTS_ERROR) but got %d\n", PR_FILE_EXISTS_ERROR,
2801                  PR_GetError());
2802          exit(1);
2803      }
2804 --- pr/tests/sendzlf.c.orig     2020-08-20 23:04:43 UTC
2805 +++ pr/tests/sendzlf.c
2806 @@ -26,7 +26,7 @@ static void ClientThread(void *arg)
2807  {
2808      PRFileDesc *sock;
2809      PRNetAddr addr;
2810 -    PRUint16 port = (PRUint16) arg;
2811 +    PRUint16 port = (PRUint16)(uintptr_t)arg;
2812      char buf[1024];
2813      char *bufPtr;
2814      PRInt32 nbytes;
2815 @@ -184,7 +184,7 @@ int main(int argc, char **argv)
2816      }
2817  
2818      clientThread = PR_CreateThread(PR_USER_THREAD,
2819 -                                   ClientThread, (void *) PR_ntohs(PR_NetAddrInetPort(&addr)),
2820 +                                   ClientThread, (void *)(uintptr_t)PR_ntohs(PR_NetAddrInetPort(&addr)),
2821                                     PR_PRIORITY_NORMAL, scope, PR_JOINABLE_THREAD, 0);
2822      if (NULL == clientThread) {
2823          fprintf(stderr, "PR_CreateThread failed\n");
2824 --- pr/tests/server_test.c.orig 2020-08-20 23:04:43 UTC
2825 +++ pr/tests/server_test.c
2826 @@ -61,7 +61,7 @@ PRCondVar *ServerStateCV;
2827  #ifdef DEBUGPRINTS
2828  #define DPRINTF printf
2829  #else
2830 -#define DPRINTF
2831 +#define DPRINTF(...)
2832  #endif
2833  
2834  
2835 @@ -582,6 +582,7 @@ static void do_workUU(void)
2836      do_work();
2837  }
2838  
2839 +#if 0
2840  static void do_workUK(void)
2841  {
2842      ServerScope = PR_LOCAL_THREAD;
2843 @@ -602,6 +603,7 @@ static void do_workKK(void)
2844      ClientScope = PR_GLOBAL_THREAD;
2845      do_work();
2846  }
2847 +#endif
2848  
2849  
2850  static void Measure(void (*func)(void), const char *msg)
2851 --- pr/tests/servr_kk.c.orig    2020-08-20 23:04:43 UTC
2852 +++ pr/tests/servr_kk.c
2853 @@ -57,7 +57,7 @@ PRCondVar *ServerStateCV;
2854  #ifdef DEBUGPRINTS
2855  #define DPRINTF printf
2856  #else
2857 -#define DPRINTF
2858 +#define DPRINTF(...)
2859  #endif
2860  
2861  PRIntn failed_already=0;
2862 @@ -539,6 +539,7 @@ void do_work()
2863      PR_JoinThread(ServerThread);
2864  }
2865  
2866 +#if 0
2867  static void do_workUU(void)
2868  {
2869      ServerScope = PR_LOCAL_THREAD;
2870 @@ -559,6 +560,7 @@ static void do_workKU(void)
2871      ClientScope = PR_LOCAL_THREAD;
2872      do_work();
2873  }
2874 +#endif
2875  
2876  static void do_workKK(void)
2877  {
2878 --- pr/tests/servr_ku.c.orig    2020-08-20 23:04:43 UTC
2879 +++ pr/tests/servr_ku.c
2880 @@ -57,7 +57,7 @@ PRCondVar *ServerStateCV;
2881  #ifdef DEBUGPRINTS
2882  #define DPRINTF printf
2883  #else
2884 -#define DPRINTF
2885 +#define DPRINTF(...)
2886  #endif
2887  
2888  PRIntn failed_already=0;
2889 --- pr/tests/servr_uk.c.orig    2020-08-20 23:04:43 UTC
2890 +++ pr/tests/servr_uk.c
2891 @@ -57,7 +57,7 @@ PRCondVar *ServerStateCV;
2892  #ifdef DEBUGPRINTS
2893  #define DPRINTF printf
2894  #else
2895 -#define DPRINTF
2896 +#define DPRINTF(...)
2897  #endif
2898  
2899  PRIntn failed_already=0;
2900 --- pr/tests/servr_uu.c.orig    2020-08-20 23:04:43 UTC
2901 +++ pr/tests/servr_uu.c
2902 @@ -57,7 +57,7 @@ PRCondVar *ServerStateCV;
2903  #ifdef DEBUGPRINTS
2904  #define DPRINTF printf
2905  #else
2906 -#define DPRINTF
2907 +#define DPRINTF(...)
2908  #endif
2909  
2910  PRIntn failed_already=0;
2911 --- pr/tests/short_thread.c.orig        2020-08-20 23:04:43 UTC
2912 +++ pr/tests/short_thread.c
2913 @@ -45,7 +45,7 @@ int main (int argc, char **argv)
2914                                 PR_PRIORITY_NORMAL, PR_GLOBAL_THREAD, PR_UNJOINABLE_THREAD, 0))
2915          == NULL ) {
2916          fprintf(stderr,
2917 -                "simple_test: Error - PR_CreateThread failed: (%ld, %ld)\n",
2918 +                "simple_test: Error - PR_CreateThread failed: (%d, %d)\n",
2919                  PR_GetError(), PR_GetOSError());
2920          exit( 1 );
2921      }
2922 --- pr/tests/socket.c.orig      2020-08-20 23:04:43 UTC
2923 +++ pr/tests/socket.c
2924 @@ -173,7 +173,9 @@ readn(PRFileDesc *sockfd, char *buf, int
2925      int rem;
2926      int bytes;
2927      int offset = 0;
2928 +#ifdef WINNT
2929      int err;
2930 +#endif
2931      PRIntervalTime timeout = PR_INTERVAL_NO_TIMEOUT;
2932  
2933      if (test_cancelio) {
2934 @@ -181,12 +183,14 @@ readn(PRFileDesc *sockfd, char *buf, int
2935      }
2936  
2937      for (rem=len; rem; offset += bytes, rem -= bytes) {
2938 -        DPRINTF(("thread = 0x%lx: calling PR_Recv, bytes = %d\n",
2939 +        DPRINTF(("thread = %p: calling PR_Recv, bytes = %d\n",
2940                   PR_GetCurrentThread(), rem));
2941 +#ifdef WINNT
2942  retry:
2943 +#endif
2944          bytes = PR_Recv(sockfd, buf + offset, rem, 0,
2945                          timeout);
2946 -        DPRINTF(("thread = 0x%lx: returning from PR_Recv, bytes = %d\n",
2947 +        DPRINTF(("thread = %p: returning from PR_Recv, bytes = %d\n",
2948                   PR_GetCurrentThread(), bytes));
2949          if (bytes < 0) {
2950  #ifdef WINNT
2951 @@ -218,11 +222,11 @@ writen(PRFileDesc *sockfd, char *buf, in
2952      int offset = 0;
2953  
2954      for (rem=len; rem; offset += bytes, rem -= bytes) {
2955 -        DPRINTF(("thread = 0x%lx: calling PR_Send, bytes = %d\n",
2956 +        DPRINTF(("thread = %p: calling PR_Send, bytes = %d\n",
2957                   PR_GetCurrentThread(), rem));
2958          bytes = PR_Send(sockfd, buf + offset, rem, 0,
2959                          PR_INTERVAL_NO_TIMEOUT);
2960 -        DPRINTF(("thread = 0x%lx: returning from PR_Send, bytes = %d\n",
2961 +        DPRINTF(("thread = %p: returning from PR_Send, bytes = %d\n",
2962                   PR_GetCurrentThread(), bytes));
2963          if (bytes <= 0) {
2964              return -1;
2965 @@ -272,7 +276,7 @@ Serve_Client(void *arg)
2966              if (PR_Shutdown(sockfd, PR_SHUTDOWN_RCV) < 0) {
2967                  fprintf(stderr,"prsocket_test: ERROR - PR_Shutdown\n");
2968              }
2969 -        DPRINTF(("Serve_Client [0x%lx]: inbuf[0] = 0x%lx\n",PR_GetCurrentThread(),
2970 +        DPRINTF(("Serve_Client [%p]: inbuf[0] = %d\n",PR_GetCurrentThread(),
2971                   (*((int *) in_buf->data))));
2972          if (writen(sockfd, in_buf->data, bytes) < bytes) {
2973              fprintf(stderr,"prsocket_test: ERROR - Serve_Client:writen\n");
2974 @@ -414,7 +418,7 @@ TCP_Server(void *arg)
2975          goto exit;
2976      }
2977  
2978 -    DPRINTF(("TCP_Server: PR_BIND netaddr.inet.ip = 0x%lx, netaddr.inet.port = %d\n",
2979 +    DPRINTF(("TCP_Server: PR_BIND netaddr.inet.ip = 0x%x, netaddr.inet.port = %d\n",
2980               netaddr.inet.ip, netaddr.inet.port));
2981      if (PR_SetNetAddr(PR_IpAddrLoopback, client_domain,
2982                        PR_ntohs(PR_NetAddrInetPort(&netaddr)),
2983 @@ -466,7 +470,7 @@ TCP_Server(void *arg)
2984              failed_already=1;
2985              goto exit;
2986          }
2987 -        DPRINTF(("TCP_Server: Created Serve_Client = 0x%lx\n", t));
2988 +        DPRINTF(("TCP_Server: Created Serve_Client = %p\n", t));
2989      }
2990  
2991  exit:
2992 @@ -482,7 +486,7 @@ exit:
2993      --(*sp->exit_counter);
2994      PR_Notify(sp->exit_mon);
2995      PR_ExitMonitor(sp->exit_mon);
2996 -    DPRINTF(("TCP_Server [0x%lx] exiting\n", PR_GetCurrentThread()));
2997 +    DPRINTF(("TCP_Server [%p] exiting\n", PR_GetCurrentThread()));
2998  }
2999  
3000  /*
3001 @@ -541,7 +545,7 @@ UDP_Server(void *arg)
3002          return;
3003      }
3004  
3005 -    DPRINTF(("PR_Bind: UDP Server netaddr.inet.ip = 0x%lx, netaddr.inet.port = %d\n",
3006 +    DPRINTF(("PR_Bind: UDP Server netaddr.inet.ip = 0x%x, netaddr.inet.port = %d\n",
3007               netaddr.inet.ip, netaddr.inet.port));
3008      /*
3009       * We can't use the IP address returned by PR_GetSockName in
3010 @@ -579,13 +583,13 @@ UDP_Server(void *arg)
3011       */
3012      memset(&netaddr, 0, sizeof(netaddr));
3013      for (i = 0; i < (num_udp_clients * num_udp_datagrams_per_client); i++) {
3014 -        DPRINTF(("UDP_Server: calling PR_RecvFrom client  - ip = 0x%lx, port = %d bytes = %d inbuf = 0x%lx, inbuf[0] = 0x%lx\n",
3015 +        DPRINTF(("UDP_Server: calling PR_RecvFrom client  - ip = 0x%x, port = %d bytes = %d inbuf = %p, inbuf[0] = 0x%x\n",
3016                   netaddr.inet.ip, netaddr.inet.port, bytes, in_buf->data,
3017                   in_buf->data[0]));
3018  
3019          rv = PR_RecvFrom(sockfd, in_buf->data, bytes, 0, &netaddr,
3020                           PR_INTERVAL_NO_TIMEOUT);
3021 -        DPRINTF(("UDP_Server: PR_RecvFrom client  - ip = 0x%lx, port = %d bytes = %d inbuf = 0x%lx, inbuf[0] = 0x%lx\n",
3022 +        DPRINTF(("UDP_Server: PR_RecvFrom client  - ip = 0x%x, port = %d bytes = %d inbuf = %p, inbuf[0] = 0x%x\n",
3023                   netaddr.inet.ip, netaddr.inet.port, rv, in_buf->data,
3024                   in_buf->data[0]));
3025          if (rv != bytes) {
3026 @@ -608,7 +612,7 @@ UDP_Server(void *arg)
3027      --(*sp->exit_counter);
3028      PR_Notify(sp->exit_mon);
3029      PR_ExitMonitor(sp->exit_mon);
3030 -    DPRINTF(("UDP_Server [0x%x] exiting\n", PR_GetCurrentThread()));
3031 +    DPRINTF(("UDP_Server [%p] exiting\n", PR_GetCurrentThread()));
3032  }
3033  
3034  /*
3035 @@ -652,7 +656,7 @@ TCP_Client(void *arg)
3036          }
3037          if (PR_Connect(sockfd, &netaddr,PR_INTERVAL_NO_TIMEOUT) < 0) {
3038              fprintf(stderr, "PR_Connect failed: (%ld, %ld)\n",
3039 -                    PR_GetError(), PR_GetOSError());
3040 +                    (long)PR_GetError(), (long)PR_GetOSError());
3041              failed_already=1;
3042              return;
3043          }
3044 @@ -660,7 +664,7 @@ TCP_Client(void *arg)
3045              /*
3046               * fill in random data
3047               */
3048 -            memset(out_buf->data, ((PRInt32) (&netaddr)) + i + j, bytes);
3049 +            memset(out_buf->data, ((intptr_t)(&netaddr)) + i + j, bytes);
3050              /*
3051               * write to server
3052               */
3053 @@ -674,7 +678,7 @@ TCP_Client(void *arg)
3054                  failed_already=1;
3055                  return;
3056              }
3057 -            DPRINTF(("TCP Client [0x%lx]: out_buf = 0x%lx out_buf[0] = 0x%lx\n",
3058 +            DPRINTF(("TCP Client [%p]: out_buf = %p out_buf[0] = 0x%x\n",
3059                       PR_GetCurrentThread(), out_buf, (*((int *) out_buf->data))));
3060              if (readn(sockfd, in_buf->data, bytes) < bytes) {
3061                  fprintf(stderr,"prsocket_test: ERROR - TCP_Client:readn\n");
3062 @@ -711,7 +715,7 @@ TCP_Client(void *arg)
3063      --(*cp->exit_counter);
3064      PR_Notify(cp->exit_mon);
3065      PR_ExitMonitor(cp->exit_mon);
3066 -    DPRINTF(("TCP_Client [0x%x] exiting\n", PR_GetCurrentThread()));
3067 +    DPRINTF(("TCP_Client [%p] exiting\n", PR_GetCurrentThread()));
3068  }
3069  
3070  /*
3071 @@ -775,7 +779,7 @@ UDP_Client(void *arg)
3072          return;
3073      }
3074  
3075 -    DPRINTF(("PR_Bind: UDP Client netaddr.inet.ip = 0x%lx, netaddr.inet.port = %d\n",
3076 +    DPRINTF(("PR_Bind: UDP Client netaddr.inet.ip = 0x%x, netaddr.inet.port = %d\n",
3077               netaddr.inet.ip, netaddr.inet.port));
3078  
3079      netaddr = cp->server_addr;
3080 @@ -792,9 +796,9 @@ UDP_Client(void *arg)
3081          /*
3082           * fill in random data
3083           */
3084 -        DPRINTF(("UDP_Client [0x%lx]: out_buf = 0x%lx bytes = 0x%lx\n",
3085 +        DPRINTF(("UDP_Client [%p]: out_buf = %p bytes = %d\n",
3086                   PR_GetCurrentThread(), out_buf->data, bytes));
3087 -        memset(out_buf->data, ((PRInt32) (&netaddr)) + i, bytes);
3088 +        memset(out_buf->data, ((intptr_t)(&netaddr)) + i, bytes);
3089          /*
3090           * write to server
3091           */
3092 @@ -807,7 +811,7 @@ UDP_Client(void *arg)
3093          if (rv != bytes) {
3094              return;
3095          }
3096 -        DPRINTF(("UDP_Client [0x%lx]: out_buf = 0x%lx out_buf[0] = 0x%lx\n",
3097 +        DPRINTF(("UDP_Client [%p]: out_buf = %p out_buf[0] = 0x%x\n",
3098                   PR_GetCurrentThread(), out_buf, (*((int *) out_buf->data))));
3099          if (cp->udp_connect)
3100              rv = PR_Recv(sockfd, in_buf->data, bytes, 0,
3101 @@ -818,7 +822,7 @@ UDP_Client(void *arg)
3102          if (rv != bytes) {
3103              return;
3104          }
3105 -        DPRINTF(("UDP_Client [0x%lx]: in_buf = 0x%lx in_buf[0] = 0x%lx\n",
3106 +        DPRINTF(("UDP_Client [%p]: in_buf = %p in_buf[0] = 0x%x\n",
3107                   PR_GetCurrentThread(), in_buf, (*((int *) in_buf->data))));
3108          /*
3109           * verify the data read
3110 @@ -843,7 +847,7 @@ UDP_Client(void *arg)
3111      PR_Notify(cp->exit_mon);
3112      PR_ExitMonitor(cp->exit_mon);
3113      PR_DELETE(cp);
3114 -    DPRINTF(("UDP_Client [0x%x] exiting\n", PR_GetCurrentThread()));
3115 +    DPRINTF(("UDP_Client [%p] exiting\n", PR_GetCurrentThread()));
3116  }
3117  
3118  /*
3119 @@ -910,7 +914,7 @@ TCP_Socket_Client_Server_Test(void)
3120          failed_already=1;
3121          return -1;
3122      }
3123 -    DPRINTF(("Created TCP server = 0x%lx\n", t));
3124 +    DPRINTF(("Created TCP server = %p\n", t));
3125      thread_count++;
3126  
3127      /*
3128 @@ -944,7 +948,7 @@ TCP_Socket_Client_Server_Test(void)
3129              failed_already=1;
3130              return -1;
3131          }
3132 -        DPRINTF(("Created TCP client = 0x%lx\n", t));
3133 +        DPRINTF(("Created TCP client = %p\n", t));
3134          thread_count++;
3135      }
3136      /* Wait for server and client threads to exit */
3137 @@ -954,9 +958,9 @@ TCP_Socket_Client_Server_Test(void)
3138      }
3139      PR_ExitMonitor(mon2);
3140      printf("%30s","TCP_Socket_Client_Server_Test:");
3141 -    printf("%2ld Server %2ld Clients %2ld connections_per_client\n",1l,
3142 +    printf(" 1 Server %2d Clients %2d connections_per_client\n",
3143             num_tcp_clients, num_tcp_connections_per_client);
3144 -    printf("%30s %2ld messages_per_connection %4ld bytes_per_message\n",":",
3145 +    printf("%30s %2d messages_per_connection %4d bytes_per_message\n",":",
3146             num_tcp_mesgs_per_connection, tcp_mesg_size);
3147  
3148      return 0;
3149 @@ -1081,8 +1085,8 @@ UDP_Socket_Client_Server_Test(void)
3150      }
3151      PR_ExitMonitor(mon2);
3152      printf("%30s","UDP_Socket_Client_Server_Test: ");
3153 -    printf("%2ld Server %2ld Clients\n",1l, num_udp_clients);
3154 -    printf("%30s %2ld datagrams_per_client %4ld bytes_per_datagram\n",":",
3155 +    printf(" 1 Server %2d Clients\n", num_udp_clients);
3156 +    printf("%30s %2d datagrams_per_client %4d bytes_per_datagram\n",":",
3157             num_udp_datagrams_per_client, udp_datagram_size);
3158  
3159      return 0;
3160 @@ -1438,7 +1442,7 @@ TransmitFile_Client(void *arg)
3161      --(*cp->exit_counter);
3162      PR_Notify(cp->exit_mon);
3163      PR_ExitMonitor(cp->exit_mon);
3164 -    DPRINTF(("TransmitFile_Client [0x%lx] exiting\n", PR_GetCurrentThread()));
3165 +    DPRINTF(("TransmitFile_Client [%p] exiting\n", PR_GetCurrentThread()));
3166  }
3167  
3168  /*
3169 @@ -1481,7 +1485,7 @@ Serve_TransmitFile_Client(void *arg)
3170      if (bytes != (SMALL_FILE_SIZE+ SMALL_FILE_HEADER_SIZE)) {
3171          fprintf(stderr,
3172                  "prsocet_test: PR_TransmitFile failed: (%ld, %ld)\n",
3173 -                PR_GetError(), PR_GetOSError());
3174 +                (long)PR_GetError(), (long)PR_GetOSError());
3175          failed_already=1;
3176      }
3177      bytes = PR_TransmitFile(sockfd, local_large_file_fd, NULL, 0,
3178 @@ -1489,7 +1493,7 @@ Serve_TransmitFile_Client(void *arg)
3179      if (bytes != LARGE_FILE_SIZE) {
3180          fprintf(stderr,
3181                  "prsocket_test: PR_TransmitFile failed: (%ld, %ld)\n",
3182 -                PR_GetError(), PR_GetOSError());
3183 +                (long)PR_GetError(), (long)PR_GetOSError());
3184          failed_already=1;
3185      }
3186  
3187 @@ -1517,7 +1521,7 @@ Serve_TransmitFile_Client(void *arg)
3188                  slen, bytes);
3189          fprintf(stderr,
3190                  "prsocket_test: PR_SendFile failed: (%ld, %ld)\n",
3191 -                PR_GetError(), PR_GetOSError());
3192 +                (long)PR_GetError(), (long)PR_GetOSError());
3193          failed_already=1;
3194      }
3195  
3196 @@ -1541,7 +1545,7 @@ Serve_TransmitFile_Client(void *arg)
3197                  slen, bytes);
3198          fprintf(stderr,
3199                  "prsocket_test: PR_SendFile failed: (%ld, %ld)\n",
3200 -                PR_GetError(), PR_GetOSError());
3201 +                (long)PR_GetError(), (long)PR_GetOSError());
3202          failed_already=1;
3203      }
3204      /*
3205 @@ -1563,7 +1567,7 @@ Serve_TransmitFile_Client(void *arg)
3206                  slen, bytes);
3207          fprintf(stderr,
3208                  "prsocket_test: PR_SendFile failed: (%ld, %ld)\n",
3209 -                PR_GetError(), PR_GetOSError());
3210 +                (long)PR_GetError(), (long)PR_GetOSError());
3211          failed_already=1;
3212      }
3213      /*
3214 @@ -1585,7 +1589,7 @@ Serve_TransmitFile_Client(void *arg)
3215                  slen, bytes);
3216          fprintf(stderr,
3217                  "prsocket_test: PR_SendFile failed: (%ld, %ld)\n",
3218 -                PR_GetError(), PR_GetOSError());
3219 +                (long)PR_GetError(), (long)PR_GetOSError());
3220          failed_already=1;
3221      }
3222      /*
3223 @@ -1607,7 +1611,7 @@ Serve_TransmitFile_Client(void *arg)
3224                  slen, bytes);
3225          fprintf(stderr,
3226                  "prsocket_test: PR_SendFile failed: (%ld, %ld)\n",
3227 -                PR_GetError(), PR_GetOSError());
3228 +                (long)PR_GetError(), (long)PR_GetOSError());
3229          failed_already=1;
3230      }
3231      /*
3232 @@ -1629,7 +1633,7 @@ Serve_TransmitFile_Client(void *arg)
3233                  slen, bytes);
3234          fprintf(stderr,
3235                  "prsocket_test: PR_SendFile failed: (%ld, %ld)\n",
3236 -                PR_GetError(), PR_GetOSError());
3237 +                (long)PR_GetError(), (long)PR_GetOSError());
3238          failed_already=1;
3239      }
3240      /*
3241 @@ -1651,7 +1655,7 @@ Serve_TransmitFile_Client(void *arg)
3242                  slen, bytes);
3243          fprintf(stderr,
3244                  "prsocket_test: PR_SendFile failed: (%ld, %ld)\n",
3245 -                PR_GetError(), PR_GetOSError());
3246 +                (long)PR_GetError(), (long)PR_GetOSError());
3247          failed_already=1;
3248      }
3249      /*
3250 @@ -1675,7 +1679,7 @@ Serve_TransmitFile_Client(void *arg)
3251                  slen, bytes);
3252          fprintf(stderr,
3253                  "prsocket_test: PR_SendFile failed: (%ld, %ld)\n",
3254 -                PR_GetError(), PR_GetOSError());
3255 +                (long)PR_GetError(), (long)PR_GetOSError());
3256          failed_already=1;
3257      }
3258  done:
3259 @@ -1752,7 +1756,7 @@ TransmitFile_Server(void *arg)
3260          goto exit;
3261      }
3262  
3263 -    DPRINTF(("TCP_Server: PR_BIND netaddr.inet.ip = 0x%lx, netaddr.inet.port = %d\n",
3264 +    DPRINTF(("TCP_Server: PR_BIND netaddr.inet.ip = 0x%x, netaddr.inet.port = %d\n",
3265               netaddr.inet.ip, netaddr.inet.port));
3266      tcp_server_addr.inet.family = netaddr.inet.family;
3267      tcp_server_addr.inet.port = netaddr.inet.port;
3268 @@ -1818,7 +1822,7 @@ TransmitFile_Server(void *arg)
3269              failed_already=1;
3270              goto exit;
3271          }
3272 -        DPRINTF(("TransmitFile_Server: Created Serve_TransmitFile_Client = 0x%lx\n", t));
3273 +        DPRINTF(("TransmitFile_Server: Created Serve_TransmitFile_Client = %p\n", t));
3274      }
3275  
3276      /*
3277 @@ -1846,7 +1850,7 @@ exit:
3278      --(*sp->exit_counter);
3279      PR_Notify(sp->exit_mon);
3280      PR_ExitMonitor(sp->exit_mon);
3281 -    DPRINTF(("TransmitFile_Server [0x%lx] exiting\n", PR_GetCurrentThread()));
3282 +    DPRINTF(("TransmitFile_Server [%p] exiting\n", PR_GetCurrentThread()));
3283  }
3284  
3285  /*
3286 @@ -1986,7 +1990,7 @@ Socket_Misc_Test(void)
3287              fprintf(stderr,
3288                      "prsocket_test failed to write to file %s: (%ld, %ld)\n",
3289                      LARGE_FILE_NAME,
3290 -                    PR_GetError(), PR_GetOSError());
3291 +                    (long)PR_GetError(), (long)PR_GetOSError());
3292              failed_already=1;
3293              rv = -1;
3294              goto done;
3295 @@ -2076,7 +2080,7 @@ Socket_Misc_Test(void)
3296          rv = -1;
3297          goto done;
3298      }
3299 -    DPRINTF(("Created TCP server = 0x%x\n", t));
3300 +    DPRINTF(("Created TCP server = %p\n", t));
3301      thread_count++;
3302  
3303      /*
3304 @@ -2113,7 +2117,7 @@ Socket_Misc_Test(void)
3305              failed_already=1;
3306              goto done;
3307          }
3308 -        DPRINTF(("Created TransmitFile client = 0x%lx\n", t));
3309 +        DPRINTF(("Created TransmitFile client = %p\n", t));
3310          thread_count++;
3311      }
3312      /* Wait for server and client threads to exit */
3313 @@ -2144,7 +2148,7 @@ done:
3314      }
3315      if ((PR_RmDir(TEST_DIR)) == PR_FAILURE) {
3316          fprintf(stderr,"prsocket_test failed to rmdir %s: (%ld, %ld)\n",
3317 -                TEST_DIR, PR_GetError(), PR_GetOSError());
3318 +                TEST_DIR, (long)PR_GetError(), (long)PR_GetOSError());
3319          failed_already=1;
3320      }
3321  
3322 --- pr/tests/sprintf.c.orig     2020-08-20 23:04:43 UTC
3323 +++ pr/tests/sprintf.c
3324 @@ -133,7 +133,7 @@ static void test_l(char *pattern, char *
3325          (strncmp(s, sbuf, sizeof(sbuf)) != 0)) {
3326          fprintf(stderr,
3327                  "pattern='%s' l=%ld\nPR_smprintf='%s'\nPR_snprintf='%s'\n    sprintf='%s'\n",
3328 -                pattern, l, s, buf, sbuf);
3329 +                pattern, (long)l, s, buf, sbuf);
3330          PR_smprintf_free(s);
3331          exit(-1);
3332      }
3333 --- pr/tests/stack.c.orig       2020-08-20 23:04:43 UTC
3334 +++ pr/tests/stack.c
3335 @@ -53,7 +53,7 @@ PRFileDesc  *errhandle;
3336  
3337  int main(int argc, char **argv)
3338  {
3339 -    PRInt32 rv, cnt, sum;
3340 +    PRInt32 cnt, sum;
3341      DataRecord  *Item;
3342      PRStack     *list1, *list2;
3343      PRStackElem *node;
3344 @@ -211,7 +211,7 @@ int main(int argc, char **argv)
3345  static void stackop(void *thread_arg)
3346  {
3347      PRInt32 val, cnt, index, loops;
3348 -    DataRecord  *Items, *Item;
3349 +    DataRecord  *Items;
3350      PRStack     *list1, *list2;
3351      PRStackElem *node;
3352      stack_data *arg = (stack_data *) thread_arg;
3353 --- pr/tests/suspend.c.orig     2020-08-20 23:04:43 UTC
3354 +++ pr/tests/suspend.c
3355 @@ -21,14 +21,14 @@ void PR_CALLBACK
3356  Level_2_Thread(void *arg)
3357  {
3358      PR_Sleep(PR_MillisecondsToInterval(4 * 1000));
3359 -    printf("Level_2_Thread[0x%lx] exiting\n",PR_GetCurrentThread());
3360 +    printf("Level_2_Thread[%p] exiting\n",PR_GetCurrentThread());
3361      return;
3362  }
3363  
3364  void PR_CALLBACK
3365  Level_1_Thread(void *arg)
3366  {
3367 -    PRUint32 tmp = (PRUint32)arg;
3368 +    PRUint32 tmp = (PRUint32)(uintptr_t)arg;
3369      PRThreadScope scope = (PRThreadScope) tmp;
3370      PRThread *thr;
3371  
3372 @@ -43,7 +43,7 @@ Level_1_Thread(void *arg)
3373      if (!thr) {
3374          printf("Could not create thread!\n");
3375      } else {
3376 -        printf("Level_1_Thread[0x%lx] created %15s thread 0x%lx\n",
3377 +        printf("Level_1_Thread[%p] created %15s thread %p\n",
3378                 PR_GetCurrentThread(),
3379                 (scope == PR_GLOBAL_THREAD) ?
3380                 "PR_GLOBAL_THREAD" : "PR_LOCAL_THREAD",
3381 @@ -54,7 +54,7 @@ Level_1_Thread(void *arg)
3382      alive--;
3383      PR_Notify(mon);
3384      PR_ExitMonitor(mon);
3385 -    printf("Thread[0x%lx] exiting\n",PR_GetCurrentThread());
3386 +    printf("Thread[%p] exiting\n",PR_GetCurrentThread());
3387  }
3388  
3389  static PRStatus PR_CALLBACK print_thread(PRThread *thread, int i, void *arg)
3390 @@ -63,14 +63,15 @@ static PRStatus PR_CALLBACK print_thread
3391      PRWord *registers;
3392  
3393      printf(
3394 -        "\nprint_thread[0x%lx]: %-20s - i = %ld\n",thread,
3395 +        "\nprint_thread[%p]: %-20s - i = %ld\n",thread,
3396          (PR_GLOBAL_THREAD == PR_GetThreadScope(thread)) ?
3397          "PR_GLOBAL_THREAD" : "PR_LOCAL_THREAD", i);
3398      registers = PR_GetGCRegisters(thread, 0, (int *)&words);
3399      if (registers)
3400 -        printf("Registers R0 = 0x%x R1 = 0x%x R2 = 0x%x R3 = 0x%x\n",
3401 -               registers[0],registers[1],registers[2],registers[3]);
3402 -    printf("Stack Pointer = 0x%lx\n", PR_GetSP(thread));
3403 +        printf("Regsters R0 = 0x%lx R1 = 0x%lx R2 = 0x%lx R3 = 0x%lx\n",
3404 +               (unsigned long)registers[0], (unsigned long)registers[1],
3405 +               (unsigned long)registers[2], (unsigned long)registers[3]);
3406 +    printf("Stack Pointer = %p\n", PR_GetSP(thread));
3407      return PR_SUCCESS;
3408  }
3409  
3410 @@ -98,7 +99,7 @@ static void Level_0_Thread(PRThreadScope
3411              printf("Could not create thread!\n");
3412              alive--;
3413          }
3414 -        printf("Level_0_Thread[0x%lx] created %15s thread 0x%lx\n",
3415 +        printf("Level_0_Thread[%p] created %15s thread %p\n",
3416                 PR_GetCurrentThread(),
3417                 (scope1 == PR_GLOBAL_THREAD) ?
3418                 "PR_GLOBAL_THREAD" : "PR_LOCAL_THREAD",
3419 @@ -110,9 +111,10 @@ static void Level_0_Thread(PRThreadScope
3420      PR_EnumerateThreads(print_thread, NULL);
3421      registers = PR_GetGCRegisters(me, 1, (int *)&words);
3422      if (registers)
3423 -        printf("My Registers: R0 = 0x%x R1 = 0x%x R2 = 0x%x R3 = 0x%x\n",
3424 -               registers[0],registers[1],registers[2],registers[3]);
3425 -    printf("My Stack Pointer = 0x%lx\n", PR_GetSP(me));
3426 +        printf("My Registers: R0 = 0x%lx R1 = 0x%lx R2 = 0x%lx R3 = 0x%lx\n",
3427 +               (unsigned long)registers[0], (unsigned long)registers[1],
3428 +               (unsigned long)registers[2], (unsigned long)registers[3]);
3429 +    printf("My Stack Pointer = %p\n", PR_GetSP(me));
3430      PR_ResumeAll();
3431  
3432      /* Wait for all threads to exit */
3433 --- pr/tests/switch.c.orig      2020-08-20 23:04:43 UTC
3434 +++ pr/tests/switch.c
3435 @@ -83,7 +83,7 @@ PRIntn PR_CALLBACK Switch(PRIntn argc, c
3436      PRStatus status;
3437      PRBool help = PR_FALSE;
3438      PRUintn concurrency = 1;
3439 -    Shared *shared, *link;
3440 +    Shared *shared = NULL, *link;
3441      PRIntervalTime timein, timeout;
3442      PRThreadScope thread_scope = PR_LOCAL_THREAD;
3443      PRUintn thread_count, inner_count, loop_count, average;
3444 --- pr/tests/testfile.c.orig    2020-08-20 23:04:43 UTC
3445 +++ pr/tests/testfile.c
3446 @@ -33,6 +33,9 @@ static int _debug_on = 0;
3447  #ifdef XP_WIN
3448  #define mode_t int
3449  #endif
3450 +#if defined(XP_UNIX) || defined(XP_OS2_EMX)
3451 +#   include <unistd.h>  /* getopt(3) */
3452 +#endif
3453  
3454  #define DPRINTF(arg) if (_debug_on) printf arg
3455  
3456 @@ -86,7 +89,7 @@ static PRInt32 PR_CALLBACK DirTest(void
3457  PRInt32 dirtest_failed = 0;
3458  
3459  PRThread* create_new_thread(PRThreadType type,
3460 -                            void (*start)(void *arg),
3461 +                            void *(*start)(void *arg),
3462                              void *arg,
3463                              PRThreadPriority priority,
3464                              PRThreadScope scope,
3465 @@ -151,7 +154,7 @@ PRThread* create_new_thread(PRThreadType
3466          return((PRThread *) thandle);
3467  #endif
3468      } else {
3469 -        return(PR_CreateThread(type,start,arg,priority,scope,state,stackSize));
3470 +        return(PR_CreateThread(type,(void (*)(void*))start,arg,priority,scope,state,stackSize));
3471      }
3472  #else
3473      return(PR_CreateThread(type,start,arg,priority,scope,state,stackSize));
3474 @@ -312,8 +315,8 @@ static PRInt32 Misc_File_Tests(char *pat
3475          printf(
3476              "testfile PR_GetFileInfo returned incorrect status-change time: %s\n",
3477              pathname);
3478 -        printf("ft = %lld, ft1 = %lld\n",file_info.creationTime,
3479 -               file_info1.creationTime);
3480 +        printf("ft = %lld, ft1 = %lld\n", (long long)file_info.creationTime,
3481 +               (long long)file_info1.creationTime);
3482          rv = -1;
3483          goto cleanup;
3484      }
3485 @@ -338,8 +341,8 @@ static PRInt32 Misc_File_Tests(char *pat
3486          printf(
3487              "testfile PR_GetFileInfo returned incorrect modify time: %s\n",
3488              pathname);
3489 -        printf("ft = %lld, ft1 = %lld\n",file_info.modifyTime,
3490 -               file_info1.modifyTime);
3491 +        printf("ft = %lld, ft1 = %lld\n", (long long)file_info.modifyTime,
3492 +               (long long)file_info1.modifyTime);
3493          rv = -1;
3494          goto cleanup;
3495      }
3496 @@ -465,7 +468,7 @@ static PRInt32 PR_CALLBACK FileTest(void
3497          memset(fparamp->buf, i, len);
3498  
3499          t = create_new_thread(PR_USER_THREAD,
3500 -                              File_Write, (void *)fparamp,
3501 +                              (void *(*)(void *))File_Write, (void *)fparamp,
3502                                PR_PRIORITY_NORMAL,
3503                                scope,
3504                                PR_UNJOINABLE_THREAD,
3505 @@ -500,7 +503,7 @@ static PRInt32 PR_CALLBACK FileTest(void
3506          fparamp->len = len;
3507  
3508          t = create_new_thread(PR_USER_THREAD,
3509 -                              File_Read, (void *)fparamp,
3510 +                              (void *(*)(void *))File_Read, (void *)fparamp,
3511                                PR_PRIORITY_NORMAL,
3512                                scope,
3513                                PR_UNJOINABLE_THREAD,
3514 @@ -569,7 +572,7 @@ static PRInt32 RunDirTest(void)
3515  
3516          thrarg.done= 0;
3517          t = create_new_thread(PR_USER_THREAD,
3518 -                              DirTest, &thrarg,
3519 +                              (void *(*)(void *))DirTest, &thrarg,
3520                                PR_PRIORITY_NORMAL,
3521                                PR_LOCAL_THREAD,
3522                                PR_UNJOINABLE_THREAD,
3523 @@ -893,8 +896,6 @@ int main(int argc, char **argv)
3524  #endif
3525  #if defined(XP_UNIX) || defined(XP_OS2)
3526      int opt;
3527 -    extern char *optarg;
3528 -    extern int optind;
3529  #endif
3530  #if defined(XP_UNIX) || defined(XP_OS2)
3531      while ((opt = getopt(argc, argv, "d")) != EOF) {
3532 --- pr/tests/threads.c.orig     2020-08-20 23:04:43 UTC
3533 +++ pr/tests/threads.c
3534 @@ -27,7 +27,7 @@ void
3535  PR_CALLBACK
3536  DumbThread(void *arg)
3537  {
3538 -    PRInt32 tmp = (PRInt32)arg;
3539 +    PRInt32 tmp = (PRInt32)(intptr_t)arg;
3540      PRThreadScope scope = (PRThreadScope)tmp;
3541      PRThread *thr;
3542  
3543 @@ -173,10 +173,10 @@ int main(int argc, char **argv)
3544  
3545      if (debug_mode)
3546      {
3547 -        printf("\
3548 -** Tests lots of thread creations.  \n\
3549 -** Create %ld native threads %ld times. \n\
3550 -** Create %ld user threads %ld times \n", iterations,count,iterations,count);
3551 +        printf("** Tests lots of thread creations.\n"
3552 +               "** Create %d native threads %d times.\n"
3553 +               "** Create %d user threads %d times.\n", iterations, count,
3554 +               iterations, count);
3555      }
3556  
3557      for (index=0; index<iterations; index++) {
3558 --- pr/tests/thrpool_client.c.orig      2020-08-20 23:04:43 UTC
3559 +++ pr/tests/thrpool_client.c
3560 @@ -82,11 +82,11 @@ readn(PRFileDesc *sockfd, char *buf, int
3561      PRIntervalTime timeout = PR_INTERVAL_NO_TIMEOUT;
3562  
3563      for (rem=len; rem; offset += bytes, rem -= bytes) {
3564 -        DPRINTF(("thread = 0x%lx: calling PR_Recv, bytes = %d\n",
3565 +        DPRINTF(("thread = %p: calling PR_Recv, bytes = %d\n",
3566                   PR_GetCurrentThread(), rem));
3567          bytes = PR_Recv(sockfd, buf + offset, rem, 0,
3568                          timeout);
3569 -        DPRINTF(("thread = 0x%lx: returning from PR_Recv, bytes = %d\n",
3570 +        DPRINTF(("thread = %p: returning from PR_Recv, bytes = %d\n",
3571                   PR_GetCurrentThread(), bytes));
3572          if (bytes < 0) {
3573              return -1;
3574 @@ -107,11 +107,11 @@ writen(PRFileDesc *sockfd, char *buf, in
3575      int offset = 0;
3576  
3577      for (rem=len; rem; offset += bytes, rem -= bytes) {
3578 -        DPRINTF(("thread = 0x%lx: calling PR_Send, bytes = %d\n",
3579 +        DPRINTF(("thread = %p: calling PR_Send, bytes = %d\n",
3580                   PR_GetCurrentThread(), rem));
3581          bytes = PR_Send(sockfd, buf + offset, rem, 0,
3582                          PR_INTERVAL_NO_TIMEOUT);
3583 -        DPRINTF(("thread = 0x%lx: returning from PR_Send, bytes = %d\n",
3584 +        DPRINTF(("thread = %p: returning from PR_Send, bytes = %d\n",
3585                   PR_GetCurrentThread(), bytes));
3586          if (bytes <= 0) {
3587              return -1;
3588 @@ -165,7 +165,7 @@ TCP_Client(void *arg)
3589  
3590          DPRINTF(("TCP client connecting to server:%d\n", server_port));
3591          if (PR_Connect(sockfd, &netaddr,PR_INTERVAL_NO_TIMEOUT) < 0) {
3592 -            fprintf(stderr, "PR_Connect failed: (%ld, %ld)\n",
3593 +            fprintf(stderr, "PR_Connect failed: (%d, %d)\n",
3594                      PR_GetError(), PR_GetOSError());
3595              failed_already=1;
3596              return;
3597 @@ -174,7 +174,7 @@ TCP_Client(void *arg)
3598              /*
3599               * fill in random data
3600               */
3601 -            memset(out_buf->data, ((PRInt32) (&netaddr)) + i + j, bytes);
3602 +            memset(out_buf->data, ((intptr_t)(&netaddr)) + i + j, bytes);
3603              /*
3604               * write to server
3605               */
3606 @@ -282,7 +282,7 @@ TCP_Socket_Client_Server_Test(void)
3607          PR_EnterMonitor(mon2);
3608          connections++;
3609          PR_ExitMonitor(mon2);
3610 -        DPRINTF(("Created TCP client = 0x%lx\n", thr));
3611 +        DPRINTF(("Created TCP client = %p\n", thr));
3612      }
3613      /* Wait for client jobs to exit */
3614      PR_EnterMonitor(mon2);
3615 @@ -292,9 +292,9 @@ TCP_Socket_Client_Server_Test(void)
3616      }
3617      PR_ExitMonitor(mon2);
3618      printf("%30s","TCP_Socket_Client_Server_Test:");
3619 -    printf("%2ld Server %2ld Clients %2ld connections_per_client\n",1l,
3620 +    printf(" 1 Server %2d Clients %2d connections_per_client\n",
3621             num_tcp_clients, num_tcp_connections_per_client);
3622 -    printf("%30s %2ld messages_per_connection %4ld bytes_per_message\n",":",
3623 +    printf("%30s %2d messages_per_connection %4d bytes_per_message\n",":",
3624             num_tcp_mesgs_per_connection, tcp_mesg_size);
3625  
3626      PR_DELETE(cparamp);
3627 --- pr/tests/thrpool_server.c.orig      2020-08-20 23:04:43 UTC
3628 +++ pr/tests/thrpool_server.c
3629 @@ -330,7 +330,7 @@ TCP_Server(void *arg)
3630      }
3631  
3632      DPRINTF((
3633 -                "TCP_Server: PR_BIND netaddr.inet.ip = 0x%lx, netaddr.inet.port = %d\n",
3634 +                "TCP_Server: PR_BIND netaddr.inet.ip = 0x%x, netaddr.inet.port = %d\n",
3635                  netaddr.inet.ip, netaddr.inet.port));
3636  
3637      sp = PR_NEW(Server_Param);
3638 @@ -342,7 +342,7 @@ TCP_Server(void *arg)
3639      sp->iod.socket = sockfd;
3640      sp->iod.timeout = PR_SecondsToInterval(60);
3641      sp->datalen = tcp_mesg_size;
3642 -    sp->exit_mon = sc_mon;
3643 +    sp->exit_mon = NULL;
3644      sp->job_counterp = &job_counter;
3645      sp->conn_counter = 0;
3646      sp->tp = tp;
3647 @@ -465,7 +465,7 @@ TCP_Server_Accept(void *arg)
3648                         PR_FALSE);
3649  
3650      PR_ASSERT(NULL != jobp);
3651 -    DPRINTF(("TCP_Server: Created Serve_Client = 0x%lx\n", jobp));
3652 +    DPRINTF(("TCP_Server: Created Serve_Client = %p\n", jobp));
3653  
3654      /*
3655       * single-threaded update; no lock needed
3656 @@ -482,7 +482,7 @@ TCP_Server_Accept(void *arg)
3657                               print_stats, sp, PR_FALSE);
3658  
3659      PR_ASSERT(NULL != jobp);
3660 -    DPRINTF(("TCP_Server: Created print_stats timer job = 0x%lx\n", jobp));
3661 +    DPRINTF(("TCP_Server: Created print_stats timer job = %p\n", jobp));
3662  
3663  exit:
3664      PR_EnterMonitor(sp->exit_mon);
3665 @@ -499,9 +499,9 @@ exit:
3666      }
3667      PR_DestroyMonitor(sp->exit_mon);
3668      printf("%30s","TCP_Socket_Client_Server_Test:");
3669 -    printf("%2ld Server %2ld Clients %2ld connections_per_client\n",1l,
3670 +    printf(" 1 Server %2d Clients %2d connections_per_client\n",
3671             num_tcp_clients, num_tcp_connections_per_client);
3672 -    printf("%30s %2ld messages_per_connection %4ld bytes_per_message\n",":",
3673 +    printf("%30s %2d messages_per_connection %4d bytes_per_message\n",":",
3674             num_tcp_mesgs_per_connection, tcp_mesg_size);
3675  
3676      DPRINTF(("%s: calling PR_ShutdownThreadPool\n", program_name));
3677 --- pr/tests/thruput.c.orig     2020-08-20 23:04:43 UTC
3678 +++ pr/tests/thruput.c
3679 @@ -82,7 +82,7 @@ static void PR_CALLBACK Clientel(void *a
3680  {
3681      PRStatus rv;
3682      PRFileDesc *xport;
3683 -    PRInt32 bytes, sampled;
3684 +    PRInt32 bytes, sampled = -1;
3685      PRIntervalTime now, interval;
3686      PRBool do_display = PR_FALSE;
3687      Shared *shared = (Shared*)arg;
3688 @@ -196,7 +196,7 @@ static void Client(const char *server_na
3689  
3690  static void PR_CALLBACK Servette(void *arg)
3691  {
3692 -    PRInt32 bytes, sampled;
3693 +    PRInt32 bytes, sampled = -1;
3694      PRIntervalTime now, interval;
3695      PRBool do_display = PR_FALSE;
3696      PRFileDesc *client = (PRFileDesc*)arg;
3697 @@ -408,6 +408,7 @@ int main(int argc, char **argv)
3698      }
3699  
3700      return 0;
3701 +    return 0;
3702  }  /* main */
3703  
3704  /* thruput.c */
3705 --- pr/tests/timemac.c.orig     2020-08-20 23:04:43 UTC
3706 +++ pr/tests/timemac.c
3707 @@ -25,7 +25,7 @@ static void printExplodedTime(const PREx
3708      const char *sign;
3709  
3710      /* Print day of the week, month, day, hour, minute, and second */
3711 -    printf( "%s %s %ld %02ld:%02ld:%02ld ",
3712 +    printf( "%s %s %d %02d:%02d:%02d ",
3713              dayOfWeek[et->tm_wday], month[et->tm_month], et->tm_mday,
3714              et->tm_hour, et->tm_min, et->tm_sec);
3715  
3716 @@ -41,7 +41,7 @@ static void printExplodedTime(const PREx
3717          }
3718          hourOffset = totalOffset / 3600;
3719          minOffset = (totalOffset % 3600) / 60;
3720 -        printf("%s%02ld%02ld ", sign, hourOffset, minOffset);
3721 +        printf("%s%02d%02d ", sign, hourOffset, minOffset);
3722      }
3723  
3724      /* Print year */
3725 @@ -98,7 +98,7 @@ int main(int argc, char** argv)
3726          printf("Current local time is ");
3727          printExplodedTime(&et);
3728          printf("\n");
3729 -        printf("GMT offset is %ld, DST offset is %ld\n",
3730 +        printf("GMT offset is %d, DST offset is %d\n",
3731                 et.tm_params.tp_gmt_offset, et.tm_params.tp_dst_offset);
3732          t2 = PR_ImplodeTime(&et);
3733          if (LL_NE(t1, t2)) {
3734 --- pr/tests/timetest.c.orig    2020-08-20 23:04:43 UTC
3735 +++ pr/tests/timetest.c
3736 @@ -37,7 +37,7 @@ static void PrintExplodedTime(const PREx
3737      const char *sign;
3738  
3739      /* Print day of the week, month, day, hour, minute, and second */
3740 -    if (debug_mode) printf("%s %s %ld %02ld:%02ld:%02ld ",
3741 +    if (debug_mode) printf("%s %s %d %02d:%02d:%02d ",
3742                                 dayOfWeek[et->tm_wday], month[et->tm_month], et->tm_mday,
3743                                 et->tm_hour, et->tm_min, et->tm_sec);
3744  
3745 @@ -56,7 +56,7 @@ static void PrintExplodedTime(const PREx
3746          hourOffset = totalOffset / 3600;
3747          minOffset = (totalOffset % 3600) / 60;
3748          if (debug_mode) {
3749 -            printf("%s%02ld%02ld ", sign, hourOffset, minOffset);
3750 +            printf("%s%02d%02d ", sign, hourOffset, minOffset);
3751          }
3752      }
3753  
3754 @@ -262,7 +262,7 @@ int main(int argc, char** argv)
3755          if (debug_mode) {
3756              printf("\n");
3757          }
3758 -        if (debug_mode) printf("GMT offset is %ld, DST offset is %ld\n",
3759 +        if (debug_mode) printf("GMT offset is %d, DST offset is %d\n",
3760                                     et.tm_params.tp_gmt_offset, et.tm_params.tp_dst_offset);
3761          t2 = PR_ImplodeTime(&et);
3762          if (LL_NE(t1, t2)) {
3763 --- pr/tests/y2k.c.orig 2020-08-20 23:04:43 UTC
3764 +++ pr/tests/y2k.c
3765 @@ -44,7 +44,7 @@ static void PrintExplodedTime(const PREx
3766      const char *sign;
3767  
3768      /* Print day of the week, month, day, hour, minute, and second */
3769 -    printf("%s %s %2ld %02ld:%02ld:%02ld ",
3770 +    printf("%s %s %2d %02d:%02d:%02d ",
3771             dayOfWeek[et->tm_wday], month[et->tm_month], et->tm_mday,
3772             et->tm_hour, et->tm_min, et->tm_sec);
3773  
3774 @@ -63,7 +63,7 @@ static void PrintExplodedTime(const PREx
3775          }
3776          hourOffset = totalOffset / 3600;
3777          minOffset = (totalOffset % 3600) / 60;
3778 -        printf("%s%02ld%02ld ", sign, hourOffset, minOffset);
3779 +        printf("%s%02d%02d ", sign, hourOffset, minOffset);
3780      }
3781  #ifdef PRINT_DETAILS
3782      printf("{%d, %d, %d, %d, %d, %d, %d, %d, %d, { %d, %d}}\n",et->tm_usec,
3783 --- pr/tests/y2ktmo.c.orig      2020-08-20 23:04:43 UTC
3784 +++ pr/tests/y2ktmo.c
3785 @@ -70,7 +70,7 @@ static struct _timeb start_time_tb;
3786  
3787  static void SleepThread(void *arg)
3788  {
3789 -    PRIntervalTime timeout = (PRIntervalTime) arg;
3790 +    PRIntervalTime timeout = (PRIntervalTime)(intptr_t)arg;
3791      PRIntervalTime elapsed;
3792  #if defined(XP_UNIX) || defined(WIN32)
3793      PRInt32 timeout_msecs = PR_IntervalToMilliseconds(timeout);
3794 @@ -121,7 +121,7 @@ static void SleepThread(void *arg)
3795  
3796  static void AcceptThread(void *arg)
3797  {
3798 -    PRIntervalTime timeout = (PRIntervalTime) arg;
3799 +    PRIntervalTime timeout = (PRIntervalTime)(intptr_t)arg;
3800      PRIntervalTime elapsed;
3801  #if defined(XP_UNIX) || defined(WIN32)
3802      PRInt32 timeout_msecs = PR_IntervalToMilliseconds(timeout);
3803 @@ -197,7 +197,7 @@ static void AcceptThread(void *arg)
3804  
3805  static void PollThread(void *arg)
3806  {
3807 -    PRIntervalTime timeout = (PRIntervalTime) arg;
3808 +    PRIntervalTime timeout = (PRIntervalTime)(intptr_t)arg;
3809      PRIntervalTime elapsed;
3810  #if defined(XP_UNIX) || defined(WIN32)
3811      PRInt32 timeout_msecs = PR_IntervalToMilliseconds(timeout);
3812 @@ -276,7 +276,7 @@ static void PollThread(void *arg)
3813  
3814  static void WaitCondVarThread(void *arg)
3815  {
3816 -    PRIntervalTime timeout = (PRIntervalTime) arg;
3817 +    PRIntervalTime timeout = (PRIntervalTime)(intptr_t)arg;
3818      PRIntervalTime elapsed;
3819  #if defined(XP_UNIX) || defined(WIN32)
3820      PRInt32 timeout_msecs = PR_IntervalToMilliseconds(timeout);
3821 @@ -340,7 +340,7 @@ static void WaitCondVarThread(void *arg)
3822  
3823  static void WaitMonitorThread(void *arg)
3824  {
3825 -    PRIntervalTime timeout = (PRIntervalTime) arg;
3826 +    PRIntervalTime timeout = (PRIntervalTime)(intptr_t)arg;
3827      PRIntervalTime elapsed;
3828  #if defined(XP_UNIX) || defined(WIN32)
3829      PRInt32 timeout_msecs = PR_IntervalToMilliseconds(timeout);
3830 @@ -397,7 +397,7 @@ static void WaitMonitorThread(void *arg)
3831  
3832  static void WaitCMonitorThread(void *arg)
3833  {
3834 -    PRIntervalTime timeout = (PRIntervalTime) arg;
3835 +    PRIntervalTime timeout = (PRIntervalTime)(intptr_t)arg;
3836      PRIntervalTime elapsed;
3837  #if defined(XP_UNIX) || defined(WIN32)
3838      PRInt32 timeout_msecs = PR_IntervalToMilliseconds(timeout);
3839 @@ -532,7 +532,7 @@ int main(int argc, char **argv)
3840      for (i = 0; i < num_thread_scopes; i++) {
3841          for (j = 0; j < num_thread_funcs; j++) {
3842              threads[idx] = PR_CreateThread(PR_USER_THREAD, threadFuncs[j],
3843 -                                           (void*)PR_SecondsToInterval(secs), PR_PRIORITY_NORMAL,
3844 +                                           (void*)(intptr_t)PR_SecondsToInterval(secs), PR_PRIORITY_NORMAL,
3845                                             threadScopes[i], PR_JOINABLE_THREAD, 0);
3846              if (threads[idx] == NULL) {
3847                  fprintf(stderr, "PR_CreateThread failed\n");
3848 --- pr/tests/zerolen.c.orig     2020-08-20 23:04:43 UTC
3849 +++ pr/tests/zerolen.c
3850 @@ -45,7 +45,7 @@ static void ClientThread(void *arg)
3851  {
3852      PRFileDesc *sock;
3853      PRNetAddr addr;
3854 -    PRUint16 port = (PRUint16) arg;
3855 +    PRUint16 port = (PRUint16)(uintptr_t)arg;
3856      char buf[1024];
3857      PRInt32 nbytes;
3858  
3859 @@ -124,7 +124,7 @@ int main()
3860       * First test PR_Writev.
3861       */
3862      clientThread = PR_CreateThread(PR_USER_THREAD,
3863 -                                   ClientThread, (void *) PR_ntohs(PR_NetAddrInetPort(&addr)),
3864 +                                   ClientThread, (void *)(uintptr_t)PR_ntohs(PR_NetAddrInetPort(&addr)),
3865                                     PR_PRIORITY_NORMAL, PR_GLOBAL_THREAD, PR_JOINABLE_THREAD, 0);
3866      if (NULL == clientThread) {
3867          fprintf(stderr, "PR_CreateThread failed\n");
3868 @@ -165,7 +165,7 @@ int main()
3869       * Then test PR_Write.
3870       */
3871      clientThread = PR_CreateThread(PR_USER_THREAD,
3872 -                                   ClientThread, (void *) PR_ntohs(PR_NetAddrInetPort(&addr)),
3873 +                                   ClientThread, (void *)(uintptr_t)PR_ntohs(PR_NetAddrInetPort(&addr)),
3874                                     PR_PRIORITY_NORMAL, PR_GLOBAL_THREAD, PR_JOINABLE_THREAD, 0);
3875      if (NULL == clientThread) {
3876          fprintf(stderr, "PR_CreateThread failed\n");
3877 @@ -204,7 +204,7 @@ int main()
3878       * Finally test PR_Send.
3879       */
3880      clientThread = PR_CreateThread(PR_USER_THREAD,
3881 -                                   ClientThread, (void *) PR_ntohs(PR_NetAddrInetPort(&addr)),
3882 +                                   ClientThread, (void *)(uintptr_t)PR_ntohs(PR_NetAddrInetPort(&addr)),
3883                                     PR_PRIORITY_NORMAL, PR_GLOBAL_THREAD, PR_JOINABLE_THREAD, 0);
3884      if (NULL == clientThread) {
3885          fprintf(stderr, "PR_CreateThread failed\n");
3886
3887
3888 [FILE:1546:patches/patch-warnings]
3889 --- pr/include/prcountr.h.orig  2020-08-20 23:04:43 UTC
3890 +++ pr/include/prcountr.h
3891 @@ -394,7 +394,7 @@ PR_SubtractFromCounter(
3892  #define PR_GET_COUNTER(counter,handle)\
3893      (counter) = PR_GetCounter((handle))
3894  #else
3895 -#define PR_GET_COUNTER(counter,handle) 0
3896 +#define PR_GET_COUNTER(counter,handle)
3897  #endif
3898  
3899  NSPR_API(PRUint32)
3900 @@ -468,7 +468,7 @@ PR_SetCounter(
3901  #define PR_FIND_NEXT_COUNTER_QNAME(next,handle)\
3902      (next) = PR_FindNextCounterQname((handle))
3903  #else
3904 -#define PR_FIND_NEXT_COUNTER_QNAME(next,handle) NULL
3905 +#define PR_FIND_NEXT_COUNTER_QNAME(next,handle)
3906  #endif
3907  
3908  NSPR_API(PRCounterHandle)
3909 --- pr/src/misc/pralarm.c.orig  2020-08-20 23:04:43 UTC
3910 +++ pr/src/misc/pralarm.c
3911 @@ -101,7 +101,7 @@ static void PR_CALLBACK pr_alarmNotifier
3912  
3913      while (why != abort)
3914      {
3915 -        PRIntervalTime pause;
3916 +        PRIntervalTime pause = 0;
3917  
3918          PR_Lock(alarm->lock);
3919          while (why == scan)
3920 --- pr/src/misc/prdtoa.c.orig   2020-08-20 23:04:43 UTC
3921 +++ pr/src/misc/prdtoa.c
3922 @@ -2896,9 +2896,9 @@ double dd; int mode, ndigits, *decpt, *s
3923         to hold the suppressed trailing zeros.
3924      */
3925  
3926 -    int bbits, b2, b5, be, dig, i, ieps, ilim, ilim0, ilim1,
3927 -        j, j1, k, k0, k_check, leftright, m2, m5, s2, s5,
3928 -        spec_case, try_quick;
3929 +    int bbits, b2, b5, be, dig, i, ieps, ilim = -1, ilim0, ilim1 = -1,
3930 +                                         j, j1, k, k0, k_check, leftright, m2, m5, s2, s5,
3931 +                                         spec_case, try_quick;
3932      Long L;
3933  #ifndef Sudden_Underflow
3934      int denorm;
3935