summaryrefslogtreecommitdiffstats
path: root/nsprpub/pr/src/io/prscanf.c
diff options
context:
space:
mode:
authorwolfbeast <mcwerewolf@wolfbeast.com>2020-01-02 21:01:38 +0100
committerwolfbeast <mcwerewolf@wolfbeast.com>2020-01-02 21:01:38 +0100
commitf7d30133221896638f7bf4f66c504255c4b14f48 (patch)
tree5f3e07a049f388a3a309a615b8884318f6668a98 /nsprpub/pr/src/io/prscanf.c
parent26b297510a11758727438df4669357a2a2bc42ce (diff)
downloadUXP-f7d30133221896638f7bf4f66c504255c4b14f48.tar
UXP-f7d30133221896638f7bf4f66c504255c4b14f48.tar.gz
UXP-f7d30133221896638f7bf4f66c504255c4b14f48.tar.lz
UXP-f7d30133221896638f7bf4f66c504255c4b14f48.tar.xz
UXP-f7d30133221896638f7bf4f66c504255c4b14f48.zip
Issue #1338 - Part 1: Update NSPR to 4.24
Diffstat (limited to 'nsprpub/pr/src/io/prscanf.c')
-rw-r--r--nsprpub/pr/src/io/prscanf.c82
1 files changed, 39 insertions, 43 deletions
diff --git a/nsprpub/pr/src/io/prscanf.c b/nsprpub/pr/src/io/prscanf.c
index 377a6e643..9923ea27c 100644
--- a/nsprpub/pr/src/io/prscanf.c
+++ b/nsprpub/pr/src/io/prscanf.c
@@ -30,7 +30,7 @@ typedef int (*_PRGetCharFN)(void *stream);
/*
* A function that pushes the character 'ch' back to 'stream'.
*/
-typedef void (*_PRUngetCharFN)(void *stream, int ch);
+typedef void (*_PRUngetCharFN)(void *stream, int ch);
/*
* The size specifier for the integer and floating point number
@@ -89,7 +89,7 @@ typedef struct {
* 'str' is assumed to be a representation of the integer in
* base 'base'.
*
- * Warning:
+ * Warning:
* - Only handle base 8, 10, and 16.
* - No overflow checking.
*/
@@ -139,7 +139,7 @@ _pr_strtoull(const char *str, char **endptr, int base)
cPtr += 2;
} else {
base = 8;
- }
+ }
}
PR_ASSERT(base != 0);
LL_I2L(base64, base);
@@ -230,8 +230,8 @@ GetInt(ScanfState *state, int code)
*p++ = ch;
GET_IF_WITHIN_WIDTH(state, ch);
if (WITHIN_WIDTH(state)
- && (ch == 'x' || ch == 'X')
- && (base == 0 || base == 16)) {
+ && (ch == 'x' || ch == 'X')
+ && (base == 0 || base == 16)) {
base = 16;
*p++ = ch;
GET_IF_WITHIN_WIDTH(state, ch);
@@ -365,11 +365,7 @@ GetFloat(ScanfState *state)
if (state->sizeSpec == _PR_size_l) {
*va_arg(state->ap, PRFloat64 *) = dval;
} else if (state->sizeSpec == _PR_size_L) {
-#if defined(OSF1) || defined(IRIX)
- *va_arg(state->ap, double *) = dval;
-#else
*va_arg(state->ap, long double *) = dval;
-#endif
} else {
*va_arg(state->ap, float *) = (float) dval;
}
@@ -482,45 +478,45 @@ Convert(ScanfState *state, const char *fmt)
}
break;
case '[':
- {
- PRBool complement = PR_FALSE;
- const char *closeBracket;
- size_t n;
+ {
+ PRBool complement = PR_FALSE;
+ const char *closeBracket;
+ size_t n;
- if (*++cPtr == '^') {
- complement = PR_TRUE;
- cPtr++;
- }
- closeBracket = strchr(*cPtr == ']' ? cPtr + 1 : cPtr, ']');
- if (closeBracket == NULL) {
- return NULL;
- }
- n = closeBracket - cPtr;
- if (state->width == 0) {
- state->width = INT_MAX;
- }
- if (state->assign) {
- cArg = va_arg(state->ap, char *);
- }
- for (; state->width > 0; state->width--) {
- ch = GET(state);
- if ((ch == EOF)
- || (!complement && !memchr(cPtr, ch, n))
- || (complement && memchr(cPtr, ch, n))) {
- UNGET(state, ch);
- break;
- }
- if (state->assign) {
- *cArg++ = ch;
- }
+ if (*++cPtr == '^') {
+ complement = PR_TRUE;
+ cPtr++;
+ }
+ closeBracket = strchr(*cPtr == ']' ? cPtr + 1 : cPtr, ']');
+ if (closeBracket == NULL) {
+ return NULL;
+ }
+ n = closeBracket - cPtr;
+ if (state->width == 0) {
+ state->width = INT_MAX;
+ }
+ if (state->assign) {
+ cArg = va_arg(state->ap, char *);
+ }
+ for (; state->width > 0; state->width--) {
+ ch = GET(state);
+ if ((ch == EOF)
+ || (!complement && !memchr(cPtr, ch, n))
+ || (complement && memchr(cPtr, ch, n))) {
+ UNGET(state, ch);
+ break;
}
if (state->assign) {
- *cArg = '\0';
- state->converted = PR_TRUE;
+ *cArg++ = ch;
}
- cPtr = closeBracket;
}
- break;
+ if (state->assign) {
+ *cArg = '\0';
+ state->converted = PR_TRUE;
+ }
+ cPtr = closeBracket;
+ }
+ break;
default:
return NULL;
}