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

@ -19,11 +19,11 @@ PR_BEGIN_EXTERN_C
* is zero, the source data is assumed to be null-terminated, and PL_strlen
* is used to determine the source length. If the "dest" parameter is not
* null, it is assumed to point to a buffer of sufficient size (which may be
* calculated: ((srclen + 2)/3)*4) into which the encoded data is placed
* calculated: ((srclen + 2)/3)*4) into which the encoded data is placed
* (without any termination). If the "dest" parameter is null, a buffer is
* allocated from the heap to hold the encoded data, and the result *will*
* be terminated with an extra null character. It is the caller's
* responsibility to free the result when it is allocated. A null is returned
* be terminated with an extra null character. It is the caller's
* responsibility to free the result when it is allocated. A null is returned
* if the allocation fails.
*
* NOTE: when calculating ((srclen + 2)/3)*4), first ensure that
@ -56,7 +56,7 @@ PL_Base64Encode
* caller's responsibility to free the result when it is allocated. A null
* is retuned if the allocation fails, or if the source is not well-coded.
*
* NOTE: when calculating (srclen * 3)/4, first ensure that
* NOTE: when calculating (srclen * 3)/4, first ensure that
* srclen <= PR_UINT32_MAX/3
* to avoid PRUint32 overflow. Alternatively, calculate
* (srclen/4) * 3 + ((srclen%4) * 3)/4

View file

@ -16,13 +16,13 @@
PR_BEGIN_EXTERN_C
typedef struct PLOptionInternal PLOptionInternal;
typedef struct PLOptionInternal PLOptionInternal;
typedef enum
{
PL_OPT_OK, /* all's well with the option */
PL_OPT_EOL, /* end of options list */
PL_OPT_BAD /* invalid option (and value) */
PL_OPT_OK, /* all's well with the option */
PL_OPT_EOL, /* end of options list */
PL_OPT_BAD /* invalid option (and value) */
} PLOptStatus;
typedef struct PLLongOpt
@ -30,7 +30,7 @@ typedef struct PLLongOpt
const char * longOptName; /* long option name string */
PRIntn longOption; /* value put in PLOptState for this option. */
PRBool valueRequired; /* If option name not followed by '=', */
/* value is the next argument from argv. */
/* value is the next argument from argv. */
} PLLongOpt;
typedef struct PLOptState
@ -47,27 +47,27 @@ typedef struct PLOptState
/*
* PL_CreateOptState
*
* The argument "options" points to a string of single-character option
* names. Option names that may have an option argument value must be
* followed immediately by a ':' character.
* The argument "options" points to a string of single-character option
* names. Option names that may have an option argument value must be
* followed immediately by a ':' character.
*/
PR_EXTERN(PLOptState*) PL_CreateOptState(
PRIntn argc, char **argv, const char *options);
PRIntn argc, char **argv, const char *options);
/*
/*
* PL_CreateLongOptState
*
* Alternative to PL_CreateOptState.
* Allows caller to specify BOTH a string of single-character option names,
* AND an array of structures describing "long" (keyword) option names.
* The array is terminated by a structure in which longOptName is NULL.
* Alternative to PL_CreateOptState.
* Allows caller to specify BOTH a string of single-character option names,
* AND an array of structures describing "long" (keyword) option names.
* The array is terminated by a structure in which longOptName is NULL.
* Long option values (arguments) may always be given as "--name=value".
* If PLLongOpt.valueRequired is not PR_FALSE, and the option name was not
* followed by '=' then the next argument from argv is taken as the value.
* If PLLongOpt.valueRequired is not PR_FALSE, and the option name was not
* followed by '=' then the next argument from argv is taken as the value.
*/
PR_EXTERN(PLOptState*) PL_CreateLongOptState(
PRIntn argc, char **argv, const char *options,
const PLLongOpt *longOpts);
PRIntn argc, char **argv, const char *options,
const PLLongOpt *longOpts);
/*
* PL_DestroyOptState
*
@ -79,39 +79,39 @@ PR_EXTERN(void) PL_DestroyOptState(PLOptState *opt);
/*
* PL_GetNextOpt
*
* When this function returns PL_OPT_OK,
* - opt->option will hold the single-character option name that was parsed,
* or zero.
* When opt->option is zero, the token parsed was either a "long" (keyword)
* option or a positional parameter.
* For a positional parameter,
* When this function returns PL_OPT_OK,
* - opt->option will hold the single-character option name that was parsed,
* or zero.
* When opt->option is zero, the token parsed was either a "long" (keyword)
* option or a positional parameter.
* For a positional parameter,
* - opt->longOptIndex will contain -1, and
* - opt->value will point to the positional parameter string.
* For a long option name,
* - opt->longOptIndex will contain the non-negative index of the
* PLLongOpt structure in the caller's array of PLLongOpt structures
* corresponding to the long option name, and
* For a single-character or long option,
* For a long option name,
* - opt->longOptIndex will contain the non-negative index of the
* PLLongOpt structure in the caller's array of PLLongOpt structures
* corresponding to the long option name, and
* For a single-character or long option,
* - opt->longOption will contain the value of the single-character option
* name, or the value of the longOption from the PLLongOpt structure
* for that long option. See notes below.
* - opt->value will point to the argument option string, or will
* be NULL if option does not require argument. If option requires
* argument but it is not provided, PL_OPT_BAD is returned.
* When opt->option is non-zero,
* When opt->option is non-zero,
* - opt->longOptIndex will be -1
* When this function returns PL_OPT_EOL, or PL_OPT_BAD, the contents of
* opt are undefined.
*
* Notes: It is possible to ignore opt->option, and always look at
* Notes: It is possible to ignore opt->option, and always look at
* opt->longOption instead. opt->longOption will contain the same value
* as opt->option for single-character option names, and will contain the
* value of longOption from the PLLongOpt structure for long option names.
* This means that it is possible to equivalence long option names to
* This means that it is possible to equivalence long option names to
* single character names by giving the longOption in the PLLongOpt struct
* the same value as the single-character option name.
* the same value as the single-character option name.
* For long options that are NOT intended to be equivalent to any single-
* character option, the longOption value should be chosen to not match
* character option, the longOption value should be chosen to not match
* any possible single character name. It might be advisable to choose
* longOption values greater than 0xff for such long options.
*/

View file

@ -10,13 +10,13 @@
* plstr.h
*
* This header file exports the API to the NSPR portable library or string-
* handling functions.
*
* This API was not designed as an "optimal" or "ideal" string library; it
* handling functions.
*
* This API was not designed as an "optimal" or "ideal" string library; it
* was based on the good ol' unix string.3 functions, and was written to
*
* 1) replace the libc functions, for cross-platform consistency,
* 2) complete the API on platforms lacking common functions (e.g.,
* 1) replace the libc functions, for cross-platform consistency,
* 2) complete the API on platforms lacking common functions (e.g.,
* strcase*), and
* 3) to implement some obvious "closure" functions that I've seen
* people hacking around in our code.
@ -76,13 +76,13 @@ PL_strncpy(char *dest, const char *src, PRUint32 max);
/*
* PL_strncpyz
*
* Copies the source string into the destination buffer, up to and including
* the trailing '\0' or up but not including the max'th character, whichever
* Copies the source string into the destination buffer, up to and including
* the trailing '\0' or up but not including the max'th character, whichever
* comes first. It does not (can not) verify that the destination buffer is
* large enough. The destination string is always terminated with a '\0',
* unlike the traditional libc implementation. It returns the "dest" argument.
*
* NOTE: If you call this with a source "abcdefg" and a max of 5, the
* NOTE: If you call this with a source "abcdefg" and a max of 5, the
* destination will end up with "abcd\0" (i.e., its strlen length will be 4)!
*
* This means you can do this:
@ -152,7 +152,7 @@ PL_strcat(char *dst, const char *src);
* Appends a copy of the string pointed to by the second argument, up to
* the maximum size specified, to the end of the string pointed to by the
* first. The destination buffer is not (can not be) checked for sufficient
* size. A null destination argument returns null; otherwise, the first
* size. A null destination argument returns null; otherwise, the first
* argument is returned. If the maximum size limits the copy, then the
* result will *not* be null-terminated (JLRU). A null destination
* returns null; otherwise, the destination argument is returned.
@ -189,10 +189,10 @@ PL_strcmp(const char *a, const char *b);
/*
* PL_strncmp
*
*
* Returns an integer, the sign of which -- positive, zero, or negative --
* reflects the lexical sorting order of the two strings indicated, up to
* the maximum specified. The result is positive if the first string comes
* the maximum specified. The result is positive if the first string comes
* after the second. The NSPR implementation is not i18n. If the maximum
* is zero, only the existance or non-existance (pointer is null) of the
* strings is compared.
@ -206,7 +206,7 @@ PL_strncmp(const char *a, const char *b, PRUint32 max);
*
* Returns an integer, the sign of which -- positive, zero or negative --
* reflects the case-insensitive lexical sorting order of the two strings
* indicated. The result is positive if the first string comes after the
* indicated. The result is positive if the first string comes after the
* second. The NSPR implementation is not i18n.
*/
@ -218,7 +218,7 @@ PL_strcasecmp(const char *a, const char *b);
*
* Returns an integer, the sign of which -- positive, zero or negative --
* reflects the case-insensitive lexical sorting order of the first n characters
* of the two strings indicated. The result is positive if the first string comes
* of the two strings indicated. The result is positive if the first string comes
* after the second. The NSPR implementation is not i18n.
*/
@ -249,7 +249,7 @@ PL_strrchr(const char *s, char c);
/*
* PL_strnchr
*
*
* Returns a pointer to the first instance of the specified character within the
* first n characters of the provided string. It returns null if the character
* is not found, or if the provided string is null. The character may be the
@ -386,7 +386,7 @@ PL_strcaserstr(const char *big, const char *little);
* PL_strncasestr
*
* Returns a pointer to the first instance of the little string within the first
* n characters of the big one, ignoring case. It returns null if either string is
* n characters of the big one, ignoring case. It returns null if either string is
* null. It returns null if the length of the little string is greater than n.
*/