Issue #1338 - Part 1: Update NSPR to 4.24

This commit is contained in:
wolfbeast 2020-01-02 21:01:38 +01:00 • committed by Roy Tam
commit 1a92143e68
454 changed files with 42944 additions and 48647 deletions

View file

@ -42,27 +42,31 @@ int main(int argc, char **argv)
PLOptStatus os;
PLOptState *opt = PL_CreateOptState(argc, argv, "vd");
while (PL_OPT_EOL != (os = PL_GetNextOpt(opt)))
while (PL_OPT_EOL != (os = PL_GetNextOpt(opt)))
{
if (PL_OPT_BAD == os) continue;
if (PL_OPT_BAD == os) {
continue;
}
switch (opt->option)
{
case 'd': /* debug */
debug = 1;
break;
case 'v': /* verbose */
verbose = 1;
break;
default:
break;
case 'd': /* debug */
debug = 1;
break;
case 'v': /* verbose */
verbose = 1;
break;
default:
break;
}
}
PL_DestroyOptState(opt);
PL_DestroyOptState(opt);
} /* end block "Get command line options" */
/* ---------------------------------------------------------------------- */
/* ---------------------------------------------------------------------- */
fd = PR_Open( "/tmp/nsprAppend", (PR_APPEND | PR_CREATE_FILE | PR_TRUNCATE | PR_WRONLY), 0666 );
if ( NULL == fd ) {
if (debug) printf("PR_Open() failed for writing: %d\n", PR_GetError());
if (debug) {
printf("PR_Open() failed for writing: %d\n", PR_GetError());
}
failedAlready = PR_TRUE;
goto Finished;
}
@ -70,27 +74,35 @@ int main(int argc, char **argv)
for ( i = 0; i < addedBytes ; i++ ) {
rv = PR_Write( fd, &buf, sizeof(buf));
if ( sizeof(buf) != rv ) {
if (debug) printf("PR_Write() failed: %d\n", PR_GetError());
if (debug) {
printf("PR_Write() failed: %d\n", PR_GetError());
}
failedAlready = PR_TRUE;
goto Finished;
}
rv = PR_Seek( fd, 0 , PR_SEEK_SET );
rv = PR_Seek( fd, 0, PR_SEEK_SET );
if ( -1 == rv ) {
if (debug) printf("PR_Seek() failed: %d\n", PR_GetError());
if (debug) {
printf("PR_Seek() failed: %d\n", PR_GetError());
}
failedAlready = PR_TRUE;
goto Finished;
}
}
rc = PR_Close( fd );
if ( PR_FAILURE == rc ) {
if (debug) printf("PR_Close() failed after writing: %d\n", PR_GetError());
if (debug) {
printf("PR_Close() failed after writing: %d\n", PR_GetError());
}
failedAlready = PR_TRUE;
goto Finished;
}
/* ---------------------------------------------------------------------- */
/* ---------------------------------------------------------------------- */
fd = PR_Open( "/tmp/nsprAppend", PR_RDONLY, 0 );
if ( NULL == fd ) {
if (debug) printf("PR_Open() failed for reading: %d\n", PR_GetError());
if (debug) {
printf("PR_Open() failed for reading: %d\n", PR_GetError());
}
failedAlready = PR_TRUE;
goto Finished;
}
@ -98,7 +110,9 @@ int main(int argc, char **argv)
for ( i = 0; i < addedBytes ; i++ ) {
rv = PR_Read( fd, &inBuf, sizeof(inBuf));
if ( sizeof(inBuf) != rv) {
if (debug) printf("PR_Write() failed: %d\n", PR_GetError());
if (debug) {
printf("PR_Write() failed: %d\n", PR_GetError());
}
failedAlready = PR_TRUE;
goto Finished;
}
@ -107,19 +121,25 @@ int main(int argc, char **argv)
rc = PR_Close( fd );
if ( PR_FAILURE == rc ) {
if (debug) printf("PR_Close() failed after reading: %d\n", PR_GetError());
if (debug) {
printf("PR_Close() failed after reading: %d\n", PR_GetError());
}
failedAlready = PR_TRUE;
goto Finished;
}
if ( sum != addedBytes ) {
if (debug) printf("Uh Oh! addedBytes: %d. Sum: %d\n", addedBytes, sum);
if (debug) {
printf("Uh Oh! addedBytes: %d. Sum: %d\n", addedBytes, sum);
}
failedAlready = PR_TRUE;
goto Finished;
}
/* ---------------------------------------------------------------------- */
/* ---------------------------------------------------------------------- */
Finished:
if (debug || verbose) printf("%s\n", (failedAlready)? "FAILED" : "PASSED" );
if (debug || verbose) {
printf("%s\n", (failedAlready)? "FAILED" : "PASSED" );
}
return( (failedAlready)? 1 : 0 );
} /* main() */