Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(648)

Unified Diff: nspr/pr/src/io/prprf.c

Issue 1504923011: Update NSS to 3.21 RTM and NSPR to 4.11 RTM (Closed) Base URL: http://src.chromium.org/svn/trunk/deps/third_party/nss
Patch Set: Created 5 years ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
Index: nspr/pr/src/io/prprf.c
diff --git a/nspr/pr/src/io/prprf.c b/nspr/pr/src/io/prprf.c
index ea6e4086fcdb457e273f462748f42517da007b1c..1a89141548286b2ca37137ce100c922471593ce8 100644
--- a/nspr/pr/src/io/prprf.c
+++ b/nspr/pr/src/io/prprf.c
@@ -66,7 +66,11 @@ struct NumArg {
#define NAS_DEFAULT_NUM 20 /* default number of NumberedArgument array */
-
+/*
+** For numeric types, the signed versions must have even values,
+** and their corresponding unsigned versions must have the subsequent
+** odd value.
+*/
#define TYPE_INT16 0
#define TYPE_UINT16 1
#define TYPE_INTN 2
@@ -376,8 +380,8 @@ static int cvt_s(SprintfState *ss, const char *str, int width, int prec,
/*
** BuildArgArray stands for Numbered Argument list Sprintf
-** for example,
-** fmp = "%4$i, %2$d, %3s, %1d";
+** for example,
+** fmt = "%4$i, %2$d, %3s, %1d";
** the number must start from 1, and no gap among them
*/
@@ -515,6 +519,15 @@ static struct NumArg* BuildArgArray( const char *fmt, va_list ap, int* rv, struc
nas[cn].type = TYPE_INT64;
c = *p++;
}
+ } else if (c == 'z') {
+ if (sizeof(size_t) == sizeof(PRInt32)) {
+ nas[ cn ].type = TYPE_INT32;
+ } else if (sizeof(size_t) == sizeof(PRInt64)) {
+ nas[ cn ].type = TYPE_INT64;
+ } else {
+ nas[ cn ].type = TYPE_UNKNOWN;
+ }
+ c = *p++;
}
/* format */
@@ -809,6 +822,13 @@ static int dosprintf(SprintfState *ss, const char *fmt, va_list ap)
type = TYPE_INT64;
c = *fmt++;
}
+ } else if (c == 'z') {
+ if (sizeof(size_t) == sizeof(PRInt32)) {
+ type = TYPE_INT32;
+ } else if (sizeof(size_t) == sizeof(PRInt64)) {
+ type = TYPE_INT64;
+ }
+ c = *fmt++;
}
/* format */

Powered by Google App Engine
This is Rietveld 408576698