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