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