Commit Graph

1348 Commits

Author SHA1 Message Date
Nathan Froyd
c65a72ac1e 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
Eric Rahm
68c77a919f Bug 1435924 - Part 2: Remove nsSubstring.h. r=dbaron
--HG--
extra : rebase_source : 1cbc6f4ab7fc72c11c7508fd8843e64138b47319
2018-02-05 14:51:18 -08:00
Eric Rahm
9ff126586e Bug 1435924 - Part 1: Switch from nsSubstring.h to nsAString.h. r=dbaron
--HG--
extra : rebase_source : 969727b07a7450e57c219766838a7266ff79484f
2018-02-05 17:36:32 -08:00
Eric Rahm
707e39aaa9 Bug 1434689 - Part 3: Annotate nsTSubstringTuple as MOZ_TEMPORARY_CLASS. r=froydnj
The documentation indicates nsTStringTuple is intended for internal use only
and is designed to be only be used as a temporary. This makes that fact
explicit by annotating the class for static analysis.

--HG--
extra : rebase_source : 737481fb39355c456cf1bbf17b887e35d692c4df
2018-01-31 15:45:04 -08:00
Eric Rahm
55733f8050 Bug 1434789 - Part 2: Remove nsSubstringTuple aliases. r=froydnj
This removes nsSubstringTuple.h and nsSubstringTuple.cpp in favor of
nsTSubstringTuple.

--HG--
extra : rebase_source : 4539b7cccd7a6837ca695782200a2e8d19b8436a
2018-01-31 16:45:34 -08:00
Noemi Erli
ed5a1a575c Merge mozilla-central to autoland. a=merge CLOSED TREE 2018-01-19 12:15:59 +02:00
Anthony Ramine
af2c4fdf74 Bug 1431449 - Move nsTString::ToInteger* methods to nsTSubstring; r=bz
MozReview-Commit-ID: 8hCDfF8rLRC

--HG--
extra : rebase_source : 651a1367cf5e1e974facc8809425efa1f3b406b5
2018-01-18 15:32:35 +01:00
Eric Rahm
5497e40f06 Bug 1431261 - Add nsTDependentString copy constructor. r=dbaron
This adds a copy constructor that uses Rebind to preserve the reference to
static data rather allocate a new shared buffer.

--HG--
extra : rebase_source : db04def1137a9be646b8e09dfee780c9163a585c
2018-01-18 14:16:19 -08:00
Makoto Kato
606547c9c7 Bug 586838 - Add NEON versions of LossyConvertEncoding. r=erahm 2018-01-12 15:46:11 +09:00
Masatoshi Kimura
a1d349bfab Bug 1426898 - Stop including Char16.h everywhere. r=Waldo
We had to force-include Char16.h to simulate char16_t on older MSVC versions.
But it is no longer the case. We should not rebuild the world whenever we
touch this file.

MozReview-Commit-ID: 1XY7tQD8LoK

--HG--
extra : rebase_source : a08ccfc9b6a4abf90f6f8b97a42079865724c9ec
2017-12-23 00:53:12 +09:00
Eric Rahm
a8271a5de1 Bug 1424120 - Part 9: Further cleanup of minor nits in ToInteger. r=njn
Final style cleanup:
  - Comment formatting
  - Move variable declarations to where they're used
  - Don't set NS_OK until we finish processing
  - Early exit for error conditions

--HG--
extra : rebase_source : 15e216df6b9a5ca113d2da029e999d8bccd6752b
2017-12-08 11:52:10 -08:00
Eric Rahm
79a173e55d Bug 1424120 - Part 8: clang-format ToInteger. r=njn
--HG--
extra : rebase_source : 4efc751e224141f33fcbcf9aba909956f82f5877
2017-12-08 11:43:15 -08:00
Eric Rahm
70d5608b99 Bug 1424120 - Part 7: Remove duplicated switch logic from ToInteger. r=njn
--HG--
extra : rebase_source : 039af2cc615cd3d3ad990c77e42847f1189e4625
2017-12-08 11:17:55 -08:00
Eric Rahm
1974312b7c Bug 1424120 - Part 6: Add early returns to ToInteger. r=njn
This reduces the indentation by removing the `if(cp)` and `if(done)` blocks
and just returning early. The `if(cp)` was unnecessary as `BeginReading` will
never return nullptr.

--HG--
extra : rebase_source : e0889e65bd5d371d54783087ae22e097c8dfe4db
2017-12-08 10:15:53 -08:00
Eric Rahm
b1c032672b Bug 1424120 - Part 5: Enforce support for only radix of 10 and 16. r=njn
In theory other radixes can be passed in but we don't actually handle them.
This asserts that the radix is supported and just switches over to using 10 and
16 directly.

--HG--
extra : rebase_source : 71891302d499bfd108a5bb41626d921b3be193ce
2017-12-07 18:54:13 -08:00
Eric Rahm
b1ed165c5e Bug 1424120 - Part 4: Remove haveValue logic from ToInteger. r=njn
The `haveValue` logic is no longer necessary. If we don't have a value the
result will always be 0.

--HG--
extra : rebase_source : df79cbe1dab86914873de72f0ef8fe72d3469e1a
2017-12-07 18:44:03 -08:00
Eric Rahm
8601b5e802 Bug 1424120 - Part 3: Update error handling in ToInteger. r=njn
--HG--
extra : rebase_source : 75bd93c43c0c2144fdddda4fb5f4ae2db087fcde
2017-12-07 17:51:26 -08:00
Eric Rahm
5f9cfc967c Bug 1424120 - Part 2: Remove kAutoDetect support from ToInteger. r=njn
kAutoDetect is never actually used in our codebase and makes ToInteger rather
convoluted. This removes the logic for it, the constant itself, and the
resulting dead code.

--HG--
extra : rebase_source : 0809b1d167a0c6ffcc7d45cc6f471c9d381ca303
2017-12-07 15:40:15 -08:00
Eric Rahm
a2ca9e1092 Bug 1424120 - Part 1: Combine logic for ToInteger impls. r=njn
Replaced the duplicated logic with a shared template implementation.

--HG--
extra : rebase_source : 00e62d8eddeff3ba38f9e17cd875cf1907bc4b31
2017-12-07 15:18:44 -08:00
Eric Rahm
6058ba50a3 Bug 1423798 - Remove headers included for backwards compat in nsString.h. r=njn on a CLOSED TREE
Remove the headers included for "backwards compatibility" and just include them
where required.

--HG--
extra : source : e2beba7e6875120ebbbcadf24bcbcb5b86411a94
extra : amend_source : 11f07a27431cd468511f0bd45afe36150c6e342c
2017-12-06 19:36:57 -08:00
Csoregi Natalia
f488657fbd Backed out changeset e2beba7e6875 (bug 1423798) for failing Browser Chrome tests browser_temporary_permissions_expiry.js on Windows 7 debug. r=backout on a CLOSED TREE 2017-12-09 07:23:35 +02:00
Gurzau Raul
0fcc1a37e6 Merge mozilla-central to mozilla-inbound. r=merge a=merge CLOSED TREE 2017-12-09 00:57:59 +02:00
Eric Rahm
74880b3483 Bug 1423798 - Remove headers included for backwards compat in nsString.h. r=njn
Remove the headers included for "backwards compatibility" and just include them
where required.

--HG--
extra : rebase_source : 03e703a81ed4b80f4f116ff36d8787464ce5acba
2017-12-06 19:36:57 -08:00
Eric Rahm
922fd574f8 Bug 1423781 - Remove nsVoidableString. r=njn
--HG--
extra : rebase_source : 25d33d7d8096cb888767d00dcda821275e9906db
2017-12-06 17:33:23 -08:00
Eric Rahm
07c97a5afe Bug 1423773 - Part 1: Remove usage of nsStringGlue.h. r=glandium
This removes an unnecessary level of indirection by replacing all
nsStringGlue.h instances with just nsString.h.

--HG--
extra : rebase_source : 340989240af4018f3ebfd92826ae11b0cb46d019
2017-12-06 16:52:51 -08:00
Sylvestre Ledru
5de63ef061 Bug 1394734 - Replace CONFIG['MSVC'] by CONFIG['CC_TYPE'] r=glandium
MozReview-Commit-ID: 5orfnoude7h

--HG--
extra : rebase_source : 1ed9a6b56e1d27221a07624767a7fb0e6147117f
2017-12-08 13:46:13 +01:00
Paul Bone
572d5164f3 Bug 1410276 - Add a canary field to nsStringBuffer r=bz
This version of the patch hopefully causes fewer performance regressions.
It might be good to apply this and catch some more assertions.

--HG--
extra : rebase_source : b8674308d581bed4baf6f64a9dd23f2cf995028b
2017-11-09 15:17:35 +11:00
Sebastian Hengst
6ad3193382 Backout a3785ec9a48c / bug 1410276 on request from pbone - Add a canary field to nsStringBuffer. r=backout 2017-11-08 01:45:38 +02:00
Chris Peterson
4a8bdd4ca5 Bug 1412048 - Replace some NS_RUNTIMEABORT(var) calls with MOZ_CRASH_UNSAFE_PRINTF. r=froydnj data-review=francois
MOZ_CRASH_UNSAFE_PRINTF causes data collection because crash strings are annotated to crash-stats and are publicly visible. Firefox data stewards must do data review on usages of this macro. However, all the crash strings this patch collects with MOZ_CRASH_UNSAFE_PRINTF are already collected with NS_RUNTIMEABORT.

MozReview-Commit-ID: 5ujXa9MHH5Z

--HG--
extra : rebase_source : 1367e6ac3c6085341e36cb0859d91417245ea472
extra : source : 3edeb64a40afd79d5c01ae0f0d3ab2777a2e744b
2017-10-26 00:49:00 -07:00
Andrew McCreight
989d6728ca Bug 1412119 - Re-fix mode lines in xpcom. r=erahm 2017-10-26 14:39:00 -04:00
Paul Bone
72289df407 Bug 1410276 - Add a canary field to nsStringBuffer. r=bz 2017-10-25 23:21:47 +11:00
Sylvestre Ledru
ae9444af4d Bug 1411034 - Remove the const to fix the -Wignored-qualifiers warning r=erahm
MozReview-Commit-ID: 8AvGwUQsdE8

--HG--
extra : rebase_source : 25b61a81b83ff3fa65ab15a23af92a56e3a6be12
2017-10-23 22:42:35 +02:00
Eric Rahm
e0bdf23b2e Bug 1403083 - Part 1: Properly disable string functions for invalid char types. r=froydnj
In order to properly disable template functions with `std::enable_if` we need
to use the resulting type. This only works if we use a dependent type in the
template params, hence the need to shadow the `T` param.

Proper usage is now of the form:

template<typename Q = T, typename EnableIfChar = CharOnlyT<Q>>
Foo();

--HG--
extra : rebase_source : da7855403d9e683d06d3858e26805e9d8e338208
2017-10-03 12:44:44 -07:00
Ryan VanderMeulen
cb612851ed Merge inbound to m-c. a=merge 2017-10-18 21:01:34 -04:00
Andrew McCreight
70333838d1 Bug 1403959, part 3 - Manually fix some xpcom/ eslint failures and enable it. r=froydnj
Renames are because another location also defined that
variable. Unused definitions are eliminated.

The .eslintrc.js file makes eslint expect XPCShell global variables.

MozReview-Commit-ID: Fafm5o45bme

--HG--
extra : rebase_source : ab71132a60e90bd30f34766bd828b18dd608f8b3
2017-09-28 16:12:52 -07:00
Andrew McCreight
4ae455cdc5 Bug 1403959, part 2 - Automatically generated eslint fixes. r=froydnj
These were generated with |./mach eslint --fix xpcom| with the
.eslintignore and xpcom/tests/unit/.eslintrc.js changes from the next
patch.

MozReview-Commit-ID: 8pKkICSK3JQ

--HG--
extra : rebase_source : bbc98050928f27160d8ca63d38aa0c383be95878
2017-09-28 15:49:04 -07:00
Nika Layzell
2e20b0d128 Bug 1377351 - Part 5: Add a workaround for gcc 4.9 compiler bug, r=froydnj
MozReview-Commit-ID: CHywpZ4fvXf
2017-10-18 13:00:22 -04:00
Nika Layzell
4146e6b110 Bug 1377351 - Part 3: Expose nsA[C]String::Assign(nsA[C]String&&) overload as take_from to rust, r=froydnj
MozReview-Commit-ID: 4YNPi3iRo78
2017-10-18 13:00:15 -04:00
Nika Layzell
2ff829eabc Bug 1377351 - Part 2: Add move overloads to nsA[C]String assignment and constructors, r=froydnj
MozReview-Commit-ID: 81U51pgshZI
2017-10-18 13:00:12 -04:00
Nika Layzell
1fe9edd088 Bug 1377351 - Part 1: Add move overload to nsA[C]String::Assign, r=froydnj
MozReview-Commit-ID: 5bloaYcvpgr
2017-10-18 13:00:09 -04:00
Nicholas Nethercote
9e0714dd26 Bug 1403506 - Remove nsTFixedString<T>. r=erahm.
(patch is actually r=erahm,mystor)

nsTFixedString<T> is only used as a base class for nsTAutoStringN<T, N>, so
this patch merges the former into the latter, cutting some code and simplifying
the string class hierarchy.

Because the "Fixed" name is now gone, the patch also renames
StringDataFlags::FIXED as INLINE and ClassDataFlags::FIXED as INLINE.

The patch also removes nsFixed[C]String and ns_auto_[c]string! from Rust code
because nsAutoString can't be implemented directly in Rust due to its move
semantics. There were only two uses of ns_auto_string! outside of tests so this
seems like a minor loss.

MozReview-Commit-ID: 8ntximghiut

--HG--
extra : rebase_source : f36edbae0553adcfee356fb8b311097ff7424786
2017-09-27 20:19:33 +10:00
Tom Ritter
a24cf9bf2e Bug 1402328 Use a Dummy template parameter to avoid fully specializing structs inside of template classes r=froydnj
Full specialization is allowed in MSVC, but not in gcc.

MozReview-Commit-ID: 9QI6YWc5Rvr

--HG--
extra : rebase_source : 7387899a6d76832afbe15e088b80a82adee59ca3
2017-09-22 10:26:26 -05:00
Nicholas Nethercote
e3c9cbb969 Bug 1401813 - Rename Null[C]String() as Void[C]String(). r=erahm.
XPCOM's string API doesn't have the notion of a "null string". But it does have
the notion of a "void string" (or "voided string"), and that's what these
functions are returning. So the names should reflect that.

--HG--
extra : rebase_source : 4e3f982e0873877174a08a25413595ff66f7d20e
2017-09-22 14:35:46 +10:00
Tom Tromey
f993bb28d0 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

--HG--
extra : rebase_source : a14485914ef9e29e38f29be6c1df1372ce5e722f
2017-09-21 09:43:28 -06:00
Tom Tromey
971dbd3853 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

--HG--
extra : rebase_source : 36666476a4f796e2553c9fa31daa54d245ae3b5f
2017-09-06 09:38:58 -06:00
Tom Tromey
2165753f7b 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

--HG--
extra : rebase_source : f43a1a852a2c8aa3d6607c7202f7cd42fdd5740a
2017-09-06 08:38:44 -06:00
Tom Tromey
f2a652249e 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

--HG--
extra : rebase_source : ad98ad6243825f1a892fc6a641d155e239b12a6b
2017-09-01 14:03:56 -06:00
Tom Tromey
0d7e17591f 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

--HG--
extra : rebase_source : 7164eb47a89ecebfa50d40684eea1325de0172ba
2017-09-05 13:17:49 -06:00
Tom Tromey
586209d1a8 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

--HG--
extra : rebase_source : 9b071db3800e3e75cabb4995a920818dfb35b03d
2017-09-01 08:31:49 -06:00
Tom Tromey
f6829c2b79 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

--HG--
extra : rebase_source : 6906075f06478b7c10229201de46e36d08d1f7f8
2017-09-01 06:25:11 -06:00