Граф коммитов

1412 Коммитов

Автор SHA1 Сообщение Дата
Henri Sivonen a07d039783 Bug 1543693 - Add missing nsReadableUtils wrappers for conversions between UTF-8 and Latin1 XPCOM string. r=froydnj
Differential Revision: https://phabricator.services.mozilla.com/D27234

--HG--
extra : moz-landing-system : lando
2019-04-12 17:49:11 +00:00
Cameron McCormack ad0b101ef6 Bug 1543582 - Only include quotes around XPCOM strings in MOZ_DBG, not operator<<. r=froydnj
Differential Revision: https://phabricator.services.mozilla.com/D27031

--HG--
extra : moz-landing-system : lando
2019-04-11 23:44:57 +00:00
Sylvestre Ledru ef0bfc3822 Bug 1519636 - Reformat recent changes to the Google coding style r=Ehsan
# ignore-this-changeset

Differential Revision: https://phabricator.services.mozilla.com/D24168

--HG--
extra : moz-landing-system : lando
2019-03-31 15:12:55 +00:00
Cameron McCormack eedb6aebd4 Bug 1538081 - Part 3: Add operator<<(ostream&) definitions for a few common types. r=froydnj,gerald
Depends on D25023

Differential Revision: https://phabricator.services.mozilla.com/D25024

--HG--
extra : moz-landing-system : lando
2019-03-30 04:26:26 +00:00
Ciure Andrei 615006146b Backed out 4 changesets (bug 1538081) for causing BaseElf.cpp bustages CLOSED TREE
Backed out changeset ced61a86c74c (bug 1538081)
Backed out changeset d6d331abbf0e (bug 1538081)
Backed out changeset 26df801e44db (bug 1538081)
Backed out changeset 113ac188a69e (bug 1538081)
2019-03-30 03:02:15 +02:00
Cameron McCormack 91e3ec9952 Bug 1538081 - Part 3: Add operator<<(ostream&) definitions for a few common types. r=froydnj,gerald
Depends on D25023

Differential Revision: https://phabricator.services.mozilla.com/D25024

--HG--
extra : moz-landing-system : lando
2019-03-30 00:21:24 +00:00
Nathan Froyd dc25b5a9dc Bug 1539605 - add fast paths for integer formatting on nsTSubstring; r=erahm
This way we don't have to go through a bunch of printf nonsense, and we
ought to be able to arrive at optimized routines that take advantage of
constant radices, etc.

Differential Revision: https://phabricator.services.mozilla.com/D25141

--HG--
extra : moz-landing-system : lando
2019-03-29 19:38:53 +00:00
Emilio Cobos Álvarez bdf43f53c2 Bug 1536689 - Make AssertValidDependentString asserts more fatal. r=bholley
We should catch these issues ASAP. This NS_ASSERTION also bit me in the past.

Differential Revision: https://phabricator.services.mozilla.com/D24115

--HG--
extra : moz-landing-system : lando
2019-03-20 23:13:14 +00:00
Ehsan Akhgari e5e885ae31 Bug 1521000 - Part 2: Adjust our clang-format rules to include spaces after the hash for nested preprocessor directives r=sylvestre
# ignore-this-changeset

--HG--
extra : amend_source : 7221c8d15a765df71171099468e7c7faa648f37c
extra : histedit_source : a0cce6015636202bff09e35a13f72e03257a7695
2019-01-18 10:16:18 +01:00
Henri Sivonen 49e3dc22ba Bug 1519337 - Adjust bound checks in UTF8CharEnumerator. r=jfkthame
Differential Revision: https://phabricator.services.mozilla.com/D16290

--HG--
extra : moz-landing-system : lando
2019-01-16 17:09:32 +00:00
Henri Sivonen 2daf725240 Bug 1514664 - Implement TextEncoder.encodeInto(). r=emk. 2019-01-11 12:35:17 +02:00
Henri Sivonen b10e89785b Bug 1515351 - Update encoding_rs to 0.8.14. r=m_kato
Differential Revision: https://phabricator.services.mozilla.com/D15934

--HG--
extra : moz-landing-system : lando
2019-01-10 09:42:39 +00:00
Sylvestre Ledru 265e672179 Bug 1511181 - Reformat everything to the Google coding style r=ehsan a=clang-format
# ignore-this-changeset

--HG--
extra : amend_source : 4d301d3b0b8711c4692392aa76088ba7fd7d1022
2018-11-30 11:46:48 +01:00
Ehsan Akhgari 490e611801 Bug 1508472 - Part 5: Fifth batch of comment fix-ups in preparation for the tree reformat r=sylvestre
This is a best effort attempt at ensuring that the adverse impact of
reformatting the entire tree over the comments would be minimal. I've used a
combination of strategies including disabling of formatting, some manual
formatting and some changes to formatting to work around some clang-format
limitations.

Differential Revision: https://phabricator.services.mozilla.com/D13371

--HG--
extra : moz-landing-system : lando
2018-11-29 10:30:46 +00:00
Andrew McCreight 68a1d4dad7 Bug 1508818, part 3 - Shrink comments so they don't get poorly reflowed by clang-format. r=froydnj
Clang format does not always reflow comments correctly to get them
within 80 columns.

The major categories of failures I have noticed in xpcom/ are:

- Comments that are lists. I fixed these by manually getting them so
  they'll be within 80 columns after clang-format runs.

- Comments intermixed with lists of things like enums, initializers,
  or even fields in a class. It doesn't seem to associate the comment
  with the item in the list correctly. The worst cases of these happen
  when it changes initializer lists from having commas at the start of
  each item to having them at the end. In the initializer comma cases,
  I fixed them by making the commas at the end, so clang-format won't
  mix things up. For other cases, I often moved the comment for an
  item onto its own line, because it was not possible to have both the
  comment and the item on the same line and stay within 80 columns.

- One odd case is nsEnumeratorUtils.cpp, where the end of line comment
  after a NS_DECL macro confused clang-format and made it stop
  realizing that the NS_DECL thing was a complete statement. I also
  added a blank line to that file before a declaration because I think
  that is better.

Depends on D13183

Differential Revision: https://phabricator.services.mozilla.com/D13184

--HG--
extra : moz-landing-system : lando
2018-11-28 21:06:09 +00:00
Karl Tomlinson 97f2efff13 Bug 1499212 align Replace/Insert/AppendLiteral parameter restrictions with those of AssignLiteral r=dbaron
There is no advantage in making these methods more restrictive on their
parameters than AssignLiteral.

The current implementation of the AppendLiteral overloads for equivalent
char_types is more permissive than AssignLiteral, but comments in the
implementation mention the possible optimization used in AssignLiteral and so
are assuming a similar constant and static storage duration restriction on its
parameter.  The optimization may never be implemented, but clients that would
benefit from support for non-constant or non-static parameters are also
expected to be rare, so there is little value in ruling out the optimization
at this stage.

ReplaceLiteral currently uses the AssignLiteral optimization.

Differential Revision: https://phabricator.services.mozilla.com/D8777

--HG--
extra : moz-landing-system : lando
2018-10-19 01:07:41 +00:00
Karl Tomlinson 539768fc12 Bug 1499212 - document that Literal parameters must have a null terminator r=dbaron
A character array initialized with a list of character literals will not
necessarily have a trailing null-terminator required for AssignLiteral or
trimmed in EqualsLiteral.

Depends on D8775

Differential Revision: https://phabricator.services.mozilla.com/D8951

--HG--
extra : moz-landing-system : lando
2018-10-19 01:26:21 +00:00
Karl Tomlinson ba7a754a76 Bug 1499212 adjust Literal method doc so as not to imply that |this| must be a literal string r=dbaron
Depends on D8774

Differential Revision: https://phabricator.services.mozilla.com/D8775

--HG--
extra : moz-landing-system : lando
2018-10-19 01:07:10 +00:00
Karl Tomlinson aa77ee3384 Bug 1499212 - document reasons for restrictions on EqualsLiteral parameter r=dbaron
"Bound" is the term used in the C++ standard to describe the number of
elements in an array.

EqualsLiteral has no opportunity to optimize for constant and static storage
duration parameters.

Depends on D8773

Differential Revision: https://phabricator.services.mozilla.com/D8774

--HG--
extra : moz-landing-system : lando
2018-10-19 00:57:49 +00:00
Karl Tomlinson a53090cdff Bug 1499212 - suggest non-ASCII Assign for non-static-const same-char_type array parameters r=dbaron
There is no advantage in AssignASCII() for char, and AssignASCII() does not
exist for char16_t array and char_type.  Similarly for ReplaceASCII and
AppendASCII.  This AssignLiteral() overload already says it is not only for
ASCII.

Depends on D8771

Differential Revision: https://phabricator.services.mozilla.com/D8773

--HG--
extra : moz-landing-system : lando
2018-10-18 21:53:33 +00:00
Karl Tomlinson 70af2a5543 Bug 1499212 Document static storage requirement for same-char_type AssignLiteral overload r=dbaron
Depends on D8770

Differential Revision: https://phabricator.services.mozilla.com/D8771

--HG--
extra : moz-landing-system : lando
2018-10-16 21:09:27 +00:00
Karl Tomlinson 99c72e1028 Bug 1499212 remove mention of character pointers in docs for Literal methods r=dbaron
Since https://hg.mozilla.org/mozilla-central/rev/9db7cf4cc385#l13.44 the type
system always excludes calls with character pointers and so there is no need
to mention this in the comment.

The comment for the 8-bit to 16-bit AssignLiteral overload is modified a
little to use "char" instead of "character" so as not to imply that anything
other than 8-bit char parameters may be provided to that overload.

The ReplaceLiteral and InsertLiteral comments are adjusted to use "character"
instead of "char" so as not to imply that the method or comment is limited to
8-bit char parameters.

Differential Revision: https://phabricator.services.mozilla.com/D8770

--HG--
extra : moz-landing-system : lando
2018-10-16 21:07:20 +00:00
Henri Sivonen 33a649ee4c Bug 1484938 - Make XPCOM string appends and copying assignments write the terminator after writing content. r=froydnj
MozReview-Commit-ID: DOmAitH5YDh

Differential Revision: https://phabricator.services.mozilla.com/D4850

--HG--
extra : moz-landing-system : lando
2018-09-24 14:23:35 +00:00
Henri Sivonen 60d77138d5 Bug 1489979 - Avoid UB in IsDependentOn(). r=froydnj
MozReview-Commit-ID: C6ehO1TG5YO

Differential Revision: https://phabricator.services.mozilla.com/D6033

--HG--
extra : moz-landing-system : lando
2018-09-24 07:04:57 +00:00
Eric Rahm 513dbaad87 Bug 1492272 - Get rid of Begin/EndWriting(iterator&) string functions. r=froydnj
This removes the rarely used and somewhat odd
`iterator& BeginWriting/EndWriting(iterator&)` functions that take an iterator
as an in/out param and then return it.

--HG--
extra : rebase_source : 92066f996595e9b7df9642813c08592cee47c630
2018-09-18 13:35:09 -07:00
Eric Rahm 2fb6934934 Bug 1492204 - Part 3: Remove references to char_iterator. r=froydnj
We can just use 'iterator' now that nsWritingIterator is gone.

--HG--
extra : rebase_source : 3f6fbafc9b57ce89afba581b224b3dc2295fa614
2018-09-18 12:05:23 -07:00
Eric Rahm 518cca9a75 Bug 1492204 - Part 2: Remove nsWritingIterator. r=froydnj
It's deprecated and no longer used.

--HG--
extra : rebase_source : 3469b29b178a4b42b2e29dc6736484e3c38c787d
2018-09-18 09:46:08 -07:00
Henri Sivonen 13e736d609 Bug 1490972 - Limit the number of bytes poisoned to avoid quadratic behavior. r=froydnj
XPCOM strings mark logically unused parts of nsStringBuffer as uninitialized
in debug builds by writing a marker byte and if memory checking is active,
by telling the memory checking that the range of memory is uninitialized.

This patch limits such marking to up to 16 code units to avoid quadratic
behavior, which is especially bad when there's a large disparity between
length and capacity (after a call to SetCapacity()).

The assumption here is that even a small poisoned memory range is enough
to detect the bugs that the poisoning is intended to detect.

MozReview-Commit-ID: 178rp0ckztj

Differential Revision: https://phabricator.services.mozilla.com/D5838

--HG--
extra : moz-landing-system : lando
2018-09-14 18:58:15 +00:00
Henri Sivonen 89ca07c012 Bug 1487341 - Make Truncate(), SetLength() and Capacity() more efficient by keeping memcpying to the minimum. r=froydnj
MozReview-Commit-ID: 2LeRrWcN8vF

Differential Revision: https://phabricator.services.mozilla.com/D4661

--HG--
extra : moz-landing-system : lando
2018-09-17 09:45:02 +00:00
Henri Sivonen 1a38ec4710 Bug 1486711 - Fill logically uninitialized parts of an XPCOM string's buffer with a marker byte in debug builds. r=froydnj
MozReview-Commit-ID: IwLikJpacAW

Differential Revision: https://phabricator.services.mozilla.com/D4657

--HG--
extra : moz-landing-system : lando
2018-09-07 05:47:57 +00:00
Sylvestre Ledru aa37bde79b Bug 1489454 - Remove all trailing whitespaces (again) r=Ehsan
This also includes moving some files to the regular format.

Differential Revision: https://phabricator.services.mozilla.com/D5249

--HG--
extra : moz-landing-system : lando
2018-09-07 14:47:51 +00:00
Henri Sivonen f691976c87 Bug 1487051 - Remove EnsureStringLength(). r=froydnj
MozReview-Commit-ID: 4X4Rrs8xHTF

Differential Revision: https://phabricator.services.mozilla.com/D4930

--HG--
extra : moz-landing-system : lando
2018-09-04 18:25:11 +00:00
Henri Sivonen 818df08a5b Bug 1487050 - Remove CountCharInReadable() as dead code. r=froydnj
MozReview-Commit-ID: DpRxyOgO85X

Differential Revision: https://phabricator.services.mozilla.com/D4941

--HG--
extra : moz-landing-system : lando
2018-09-04 14:48:39 +00:00
Henri Sivonen 1a4db3c1d3 Bug 1487614 - Make the docs of SetCapacity() even more explicit. r=froydnj
MozReview-Commit-ID: KinrUtBG7Jd

Differential Revision: https://phabricator.services.mozilla.com/D4744

--HG--
extra : moz-landing-system : lando
2018-09-01 07:50:11 +00:00
Henri Sivonen c62a32ebf1 Bug 1487606 - Make AppendLiteral() not undo the effect of SetCapacity(). r=froydnj
MozReview-Commit-ID: I2QSXbQhOUH

Differential Revision: https://phabricator.services.mozilla.com/D4752

--HG--
extra : moz-landing-system : lando
2018-08-31 14:57:26 +00:00
Henri Sivonen 5a26b995cf Bug 1487309 - Improve AssignLiteral() and AppendLiteral() documentation to talk about u"" literals. r=froydnj
MozReview-Commit-ID: 60NCtRgKRcn

Differential Revision: https://phabricator.services.mozilla.com/D4641

--HG--
extra : moz-landing-system : lando
2018-08-30 14:37:09 +00:00
Margareta Eliza Balazs 2fe43133db Merge inbound to mozilla-central. a=merge 2018-08-29 12:43:37 +03:00
Henri Sivonen e1f43883a7 Bug 1484668 - Document that writing past mLength code units via BeginWriting() is not OK. r=froydnj
MozReview-Commit-ID: FdZN8PGLO9M

Differential Revision: https://phabricator.services.mozilla.com/D3860

--HG--
extra : moz-landing-system : lando
2018-08-24 12:50:06 +00:00
Henri Sivonen c3d01b0fe9 Bug 1484045 - Prohibit shrinking of the string's buffer in appends of Latin1 to UTF-16 and vice versa. r=froydnj
This restores the old allocation semantics for "append" operations between
Latin1 and UTF-16 while keeping the buffer re-use optimization for the
"assign" cases.

MozReview-Commit-ID: 8JCw3AaCNLN

Differential Revision: https://phabricator.services.mozilla.com/D3582

--HG--
extra : moz-landing-system : lando
2018-08-28 14:13:17 +00:00
Henri Sivonen acc4596637 Bug 1486470 - Avoid overwriting newData when there's an OOM failure on buffer shrinking attempt. r=froydnj
MozReview-Commit-ID: F54grcUOwBG

Differential Revision: https://phabricator.services.mozilla.com/D4418

--HG--
extra : moz-landing-system : lando
2018-08-28 14:49:20 +00:00
Henri Sivonen 876f7ad09f Bug 1482828 - Introduce C++ analogs of Rust's nsA[C]StringBulkWriteHandle. r=froydnj
MozReview-Commit-ID: BZyHd4VzNur

Differential Revision: https://phabricator.services.mozilla.com/D3405

--HG--
extra : moz-landing-system : lando
2018-08-28 16:42:26 +00:00
Henri Sivonen 8711bfbcb6 Bug 1483603 - Avoid propagating OOM from StartBulkWrite() when shrinking the buffer. r=froydnj
Shrinking the buffer is purely a memory footprint optimization and can be
omitted as far as the string semantics visible to the caller are concerned.
Since shrinking is optional, it doesn't make sense to propagate error when
it fails due to OOM.

MozReview-Commit-ID: BuyBLCBmYzZ

Differential Revision: https://phabricator.services.mozilla.com/D3866

--HG--
extra : moz-landing-system : lando
2018-08-27 07:03:59 +00:00
Nicholas Nethercote ac5efebb4b Bug 1486690 - Remove unnecessary checks after moz_xmalloc() calls. r=glandium
There are surprisingly many of them.

(Plus a couple of unnecessary checks after `new` calls that were nearby.)

--HG--
extra : rebase_source : 47b6d5d7c5c99b1b50b396daf7a3b67abfd74fc1
2018-08-28 15:56:01 +10:00
Henri Sivonen 3a52652295 Bug 1349528 - Use encoding_rs for normalizing USVString. r=smaug
MozReview-Commit-ID: 9uG6j8UdfKR

Differential Revision: https://phabricator.services.mozilla.com/D3413

--HG--
extra : moz-landing-system : lando
2018-08-16 10:15:07 +00:00
Henri Sivonen 3edc601325 Bug 1402247 - Use encoding_rs for XPCOM string encoding conversions. r=Nika,erahm,froydnj.
Correctness improvements:

 * UTF errors are handled safely per spec instead of dangerously truncating
   strings.

 * There are fewer converter implementations.

Performance improvements:

 * The old code did exact buffer length math, which meant doing UTF math twice
   on each input string (once for length calculation and another time for
   conversion). Exact length math is more complicated when handling errors
   properly, which the old code didn't do. The new code does UTF math on the
   string content only once (when converting) but risks allocating more than
   once. There are heuristics in place to lower the probability of
   reallocation in cases where the double math avoidance isn't enough of a
   saving to absorb an allocation and memcpy.

 * Previously, in UTF-16 <-> UTF-8 conversions, an ASCII prefix was optimized
   but a single non-ASCII code point pessimized the rest of the string. The
   new code tries to get back on the fast ASCII path.

 * UTF-16 to Latin1 conversion guarantees less about handling of out-of-range
   input to eliminate an operation from the inner loop on x86/x86_64.

 * When assigning to a pre-existing string, the new code tries to reuse the
   old buffer instead of first releasing the old buffer and then allocating a
   new one.

 * When reallocating from the new code, the memcpy covers only the data that
   is part of the logical length of the old string instead of memcpying the
   whole capacity. (For old callers old excess memcpy behavior is preserved
   due to bogus callers. See bug 1472113.)

 * UTF-8 strings in XPConnect that are in the Latin1 range are passed to
   SpiderMonkey as Latin1.

New features:

 * Conversion between UTF-8 and Latin1 is added in order to enable faster
   future interop between Rust code (or otherwise UTF-8-using code) and text
   node and SpiderMonkey code that uses Latin1.

MozReview-Commit-ID: JaJuExfILM9
2018-08-14 14:43:42 +03:00
Chris Peterson 02588f7a04 Bug 1481097 - xpcom: Remove nsTString literal string workaround for gcc 4.9 bug. r=nika
This gcc 4.9 workaround (from bug 1377351) is no longer needed because Firefox currently requires gcc 6.1 or later (as of bug 1444274).

MozReview-Commit-ID: 9R14BDzWEoj

--HG--
extra : rebase_source : a56ec3ee321cdc76e704fe33c2c4a5b85b558889
extra : source : e0c26ec11d499058e51bc2c3d06b2e1840e77f13
2018-07-22 00:02:34 -07:00
Jan Varga d38e92d73f Bug 1399789 - nsSubstringSplitter/nsCSubstringSplitter is not defined anymore; r=erahm 2018-08-09 14:18:22 +02:00
Brian Hackett 312bcb5d90 Bug 1207696 Part 4l - Don't record some debugging/statistics atomics, r=froydnj.
--HG--
extra : rebase_source : 401fdf6385e81b72d2ceee84b5ee1a9aac056aaa
2018-07-21 14:26:58 +00:00
Chris Peterson 2afd829d0f Bug 1469769 - Part 6: Replace non-failing NS_NOTREACHED with MOZ_ASSERT_UNREACHABLE. r=froydnj
This patch is an automatic replacement of s/NS_NOTREACHED/MOZ_ASSERT_UNREACHABLE/. Reindenting long lines and whitespace fixups follow in patch 6b.

MozReview-Commit-ID: 5UQVHElSpCr

--HG--
extra : rebase_source : 4c1b2fc32b269342f07639266b64941e2270e9c4
extra : source : 907543f6eae716f23a6de52b1ffb1c82908d158a
2018-06-17 22:43:11 -07:00
Andi-Bogdan Postelnicu 2f780cc3ed Bug 1453795 - XPCom/String - Initialize member fields in classes/ structures. r=froydnj
--HG--
extra : rebase_source : 9f9b074342cc38137ea8f57dd2eb59d4ae327956
2018-06-14 13:57:45 +03:00