Commit Graph
14 Commits
Author SHA1 Message Date
Nathan Froyd fef98a6f6c Bug 1435916 - use a const array in nsTextFormatter::dosprintf; r=tromey
I don't know how this was not constant, but there you go.
2018-02-14 12:01:36 -05:00
Tom Tromey 3f91c32af3 Bug 1401821 - nsTextFormatter "*" width argument comes before the actual argument; r=froydnj
Bug 1388789 introduced a bug breaking formats like "%*.f".  The problem
was that the next "natural" argument was taken before the "*" width
argument.

MozReview-Commit-ID: BZack9faY7a
2017-09-21 09:43:28 -06:00
Tom Tromey bda71f4da8 Bug 1388789 - clean up \0 emission in nsTextFormatter; r=froydnj
nsTextFormatter unconditionally emitted a trailing \0, leading some code
elsewhere to have to work around this.  This changes the code to only
emit it in snprintf.

MozReview-Commit-ID: G3CBpAPp9Tn
2017-09-06 09:38:58 -06:00
Tom Tromey a5342bfa6b Bug 1388789 - normalize null string handling in nsTextFormatter; r=froydnj
The char* and char16_t* cases handled null strings differently;
normalize them to both emit "(null)".

MozReview-Commit-ID: IzRkc3pSSjl
2017-09-06 08:38:44 -06:00
Tom Tromey 9c9f19fe97 Bug 1388789 - make nsTextFormatter runtime type-safe; r=froydnj
Change nsTextFormatter functions to template functions, box their
arguments, and then make the formatter mostly impervious to type
mismatches.  Most formatting is done according to the type of the actual
argument.

MozReview-Commit-ID: H8WmyxFCb7s
2017-09-01 14:03:56 -06:00
Tom Tromey 9f5ef8223c Bug 1388789 - change return values of nsTextFormatter::vs{s,v}printf; r=froydnj
nsTextFormatter::vsnprintf is defined to return uint32_t(-1) on error.
However, it was not doing this.

nsTextFormatter::vssprintf is defined as infallible; enforce this by
having it return void.

MozReview-Commit-ID: LdOhIHzRvAT
2017-09-05 13:17:49 -06:00
Tom Tromey 1ab6214824 Bug 1388789 - handle unrecognized escapes in nsTextFormatter; r=froydnj
nsTextFormatter tried to pass unrecognized escapes in the format string
through to the output.  However, if the format held a width or
precision, that text was not output.  It seems better to me to try to
preserve the format text as-is.

MozReview-Commit-ID: HoBykpfzK7C
2017-09-01 08:31:49 -06:00
Tom Tromey 44fe6d4a47 Bug 1388789 - replace hex strings with static arrays; r=froydnj
nsTextFormatter used nsAutoString for arrays of hex digits; but this
didn't seem to provide any benefit.

MozReview-Commit-ID: EYHtnAzJL8h
2017-09-01 06:25:11 -06:00
Nicholas Nethercote 5fe06e280f Bug 1388253 - Remove nsTextFormatter:[v]smprintf(). r=erahm. 2017-08-09 10:41:21 +10:00
Nicholas Nethercote 8e0034b6c7 Bug 1381726 - Remove nsTextFormatter::smprintf_free(). r=erahm.
We can just use free() instead.
2017-07-25 09:09:27 +10:00
Nicholas Nethercote fcd4f4fa21 Bug 1376638 - Minimize uses of prmem.h. r=glandium.
It's silly to use prmem.h within Firefox code given that in our configuration
its functions are just wrappers for malloc() et al. (Indeed, in some places we
mix PR_Malloc() with free(), or malloc() with PR_Free().)

This patch removes all uses, except for the places where we need to use
PR_Free() to free something allocated by another NSPR function; in those cases
I've added a comment explaining which function did the allocation.
2017-06-30 19:05:41 -07:00
Eric Rahm 8644f2267b Bug 1353143 - Part 3: Switch PR_ASSERT usage to MOZ_ASSERT. r=froydnj 2017-04-04 14:36:17 -07:00
Tom Tromey c6913978fb Bug 1060419 - remove SprintfState typedef; r=froydnj
MozReview-Commit-ID: 9ygDxy8pBLT
2017-01-13 14:54:14 -07:00
Benjamin Smedberg 2ecc8bf217 Bug 1332631 part E - file moves from xpcom/glue to xpcom/string, r=froydnj
MozReview-Commit-ID: AGHVJ5uYOoI
2017-01-20 14:19:22 -05:00