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