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