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

56 Коммитов

Автор SHA1 Сообщение Дата
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
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
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
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
Emilio Cobos Álvarez fffb25b74f Bug 1465585: Switch from mozilla::Move to std::move. r=froydnj
This was done automatically replacing:

  s/mozilla::Move/std::move/
  s/ Move(/ std::move(/
  s/(Move(/(std::move(/

Removing the 'using mozilla::Move;' lines.

And then with a few manual fixups, see the bug for the split series..

MozReview-Commit-ID: Jxze3adipUh
2018-06-01 10:45:27 +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 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 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 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
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 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
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
Eric Rahm 030b39d813 Bug 1393230 - Part 3: Convert the xpcom string classes to be templated on char type. r=njn, r=fitzgen, r=sfink
This removes the double-include macro hackery that we use to define two
separate string types (nsAString and nsACString) in favor of a templated
solution.

Annotations for Valgrind and the JS hazard analysis are updated as well as
the rust binding generations for string code.

--HG--
extra : rebase_source : 63ab2c4620cfcd4b764d42d654c82f30f984d016
extra : source : 9115364cd4aa078c49bba7911069f8178e55166f
2017-08-14 14:22:50 -07:00
Nicholas Nethercote f582d96b98 Bug 1390428 (part 9) - Remove nsXPIDLCString. r=erahm.
This is straightforward, with only two notable things.

- `#include "nsXPIDLString.h" is replaced with `#include "nsString.h"`
  throughout, because all nsXPIDLString.h did was include nsString.h. The
  exception is for files which already include nsString.h, in which case the
  patch just removes the nsXPIDLString.h inclusion.

- The patch removes the |xpidl_string| gtest, but improves the |voided| test to
  cover some of its ground, e.g. testing Adopt(nullptr).

--HG--
extra : rebase_source : 452cc4a08046a1adb1a8099a7e85a1917de5add8
2017-08-17 15:29:03 +10:00
Nicholas Nethercote 65b902e3ea Bug 1386103 (part 1, attempt 3) - Specify nsAuto[C]String storage size via template parameter. r=dbaron. 2017-08-09 20:41:38 +10:00
Nicholas Nethercote 4d15e13fc4 Bug 1390036 (part 3) - Remove nsXPIDLString. r=erahm.
--HG--
extra : rebase_source : 87094fef8b919094926ec1be26867985a7fe8708
2017-08-14 15:25:04 +10:00
Nicholas Nethercote 64c9cd5e75 Bug 1390036 (part 2) - Remove nsXPIDLString use from NullString(). r=dbaron.
This requires adding a new constructor for ns[C]String that can be used to
create an IsVoid string.

--HG--
extra : rebase_source : 8cb078bd0a41e63af0d9d144b9eef369875a05e0
2017-08-14 14:46:53 +10:00
Phil Ringnalda 858a553b02 Backed out 2 changesets (bug 1386103) for Android x86 build bustage
Backed out changeset eec506d87d03 (bug 1386103)
Backed out changeset 3f9ec011c9bd (bug 1386103)

MozReview-Commit-ID: 8ak71R7vUOC
2017-08-08 22:08:54 -07:00
Nicholas Nethercote e9daf4d245 Bug 1386103 (part 1) - Specify nsAuto[C]String storage size via template parameter. r=dbaron.
This patch parameterizes nsAuto[C]String, renames them as nsAuto[C]StringN, and
redefines nsAuto[C]String as typedefs for nsAuto[C]StringN<64>.

(The alternative would be to templatize nsAuto[C]String and use a default
parameter, but that would require writing "nsAuto[C]String<>" everywhere.)
2017-08-01 11:58:45 +10:00
Tristan Bourvon 3bd6c5f20a Bug 1374024 - add static-analysis annotation for class functions that return dangling pointers. r=mystor
MozReview-Commit-ID: 44Ltj5FZAZD
2017-07-13 12:00:06 +02:00
Nicholas Nethercote 3ab0f8b30f Bug 1384834 (part 4) - Improve comments for Adopt() and getter_Copies(). r=erahm.
--HG--
extra : rebase_source : a7bb27bbdade092bd087a014d31d9c6d019e1d72
2017-08-01 06:06:36 +10:00
Nicholas Nethercote e5d1c73749 Bug 1384834 (part 3) - Remove nsAdopting[C]String. r=erahm.
--HG--
extra : rebase_source : a87c357fb0166620a33a40e1a01af32d5e7a907d
2017-07-28 11:21:49 +10:00
Julian Seward 408d24da56 Bug 1382563 - Remove ns*String::AssignWithConversion. r=erahm.
This patch replaces four functions of the name AssignWithConversion which
are essentially wrappers around CopyASCIItoUTF16 and LossyCopyUTF16toASCII
with direct calls to the latter two functions.  The replaced functions are:

  void nsCString::AssignWithConversion( const nsAString& aData )
  void nsString::AssignWithConversion( const nsACString& aData )

  void nsTString_CharT::AssignWithConversion(
                            const incompatible_char_type* aData,
                            int32_t aLength = -1);

The last of the three exists inside the double-included nsTString* world and
so describes two functions, giving four in total.

This has two advantages:

* it removes code

* at the call points, it makes clear (from the replacement name) which
  conversion is being carried out.  The generic name "AssignWithConversion"
  doesn't make that obvious -- one had to infer it from the types.

The patch also removes two commented out lines from
editor/composer/nsComposerCommands.cpp, that appear to be related.  They are
at top level, where they would never have compiled.  They look like
leftovers from some previous change.

--HG--
extra : rebase_source : fb47bf450771c3c9ee3341dd14520f5da69ec4f5
2017-07-24 19:23:52 +02:00
L. David Baron eb59a21402 Bug 1381080 patch 1 - Add ClassFlags::NULL_TERMINATED to strings that require null-termination. r=erahm
This is needed for patch 4.

MozReview-Commit-ID: 5ikQFIL9O0i

--HG--
extra : transplant_source : %88%80%E3%04%11%7E%7F%A4%7E%15%1B%1A%84%E2%13%3E%F6%E8%2A%1C
2017-07-20 15:46:58 -07:00
Carsten "Tomcat" Book b41e12901b Backed out changeset b75316c29d8c (bug 1374024) 2017-07-13 15:14:34 +02:00
Tristan Bourvon a4fa68b6aa Bug 1374024 - add static-analysis annotation for methods that return dangling pointers. r=mystor
MozReview-Commit-ID: KE4a4W0Du3I
2017-07-06 14:29:07 +02:00
Carsten "Tomcat" Book 41e0f69542 Backed out changeset 1eb2623a06c8 (bug 1374024) 2017-07-13 11:10:17 +02:00
Tristan Bourvon 145fe29dbe Bug 1374024 - add static-analysis annotation for methods that return dangling pointers. r=mystor
MozReview-Commit-ID: KE4a4W0Du3I
2017-07-06 14:29:07 +02:00
L. David Baron c59666d841 Bug 1343715 - Split nsTSubstring::mFlags into separate variables for class and data flags. r=dmajor
MozReview-Commit-ID: JW1p5BxpHKA

--HG--
extra : transplant_source : %20e%CF%FA%60%A2%1Bn%1A%C6%A2%DBAy%3C%E0b%0C%077
2017-07-10 12:23:10 -07:00
Nicholas Nethercote fe9268c4cd Bug 1374580 (part 2) - Remove nsAFlat{,C}String typedefs. r=froydnj.
All the instances are converted as follows.

- nsAFlatString  --> nsString
- nsAFlatCString --> nsCString

--HG--
extra : rebase_source : b37350642c58a85a08363df2e7c610873faa6e41
2017-06-20 19:19:05 +10:00
Valentin Gosu 427ac28f38 Bug 1344498 - Add fallible StripWhitespace r=njn
MozReview-Commit-ID: 8UOTEBlFxfO

--HG--
extra : rebase_source : 2c32cf4b39f9e601b9ebe1a51639000dea9f14f7
2017-03-23 12:52:31 +01:00
David Major 29d7d9433c Bug 1344629 - Part 1: String class cleanup and dead code removal. r=dbaron
Cleanup in preparation for upcoming patches:

- By using an accessor method, nsTPromiseFlatString no longer needs to be a friend.
- The explicit uint32_t constructors are unused.
- The abstract_string_type typedef is unused (and will be potentially confusing in the next patch, so removing).
- The three-param ctor for nsTSubstring no longer needs to be public "for convenience".
- friend class nsTObsoleteAStringThunk_CharT no longer exists.

MozReview-Commit-ID: 4ibJLNzn13k

--HG--
extra : rebase_source : d5a947f398a6dfc801f644f437bae9125424d4d0
2017-03-14 09:28:49 +13:00
Iris Hsiao 5cece96e1c Backed out 12 changesets (bug 1344629) for stylo build bustage
Backed out changeset cf4273d3ac30 (bug 1344629)
Backed out changeset a96390e044e0 (bug 1344629)
Backed out changeset d9b330f9bc24 (bug 1344629)
Backed out changeset 2b460fe020af (bug 1344629)
Backed out changeset 0ada91b0452e (bug 1344629)
Backed out changeset 083304fcd6bd (bug 1344629)
Backed out changeset 53d7d1ce2c97 (bug 1344629)
Backed out changeset 55eee7078ae4 (bug 1344629)
Backed out changeset 7d3c06b3eca9 (bug 1344629)
Backed out changeset e5df14c3db61 (bug 1344629)
Backed out changeset 636095ff2815 (bug 1344629)
Backed out changeset 0be052ad24c1 (bug 1344629)
2017-03-14 11:52:24 +08:00
David Major c04f2c4296 Bug 1344629 - Part 1: String class cleanup and dead code removal. r=dbaron
Cleanup in preparation for upcoming patches:

- By using an accessor method, nsTPromiseFlatString no longer needs to be a friend.
- The explicit uint32_t constructors are unused.
- The abstract_string_type typedef is unused (and will be potentially confusing in the next patch, so removing).
- The three-param ctor for nsTSubstring no longer needs to be public "for convenience".
- friend class nsTObsoleteAStringThunk_CharT no longer exists.

MozReview-Commit-ID: 4ibJLNzn13k

--HG--
extra : rebase_source : d5a947f398a6dfc801f644f437bae9125424d4d0
2017-03-14 09:28:49 +13:00
Vincent Lequertier 5864a38dc4 Bug 1329243 - Fix nsAdoptingString -Wextra copy constructor warning; r=froydnj
MozReview-Commit-ID: DEicxRecJUu

--HG--
extra : rebase_source : 612fa3d002ed906102ab24b3d338eb0087ca5f60
2017-01-23 20:50:01 +01:00
Masatoshi Kimura 9c32f727eb Bug 1318857 - Unhide nsTSubstring_CharT::StripChars in nsTString_CharT. r=froydnj
MozReview-Commit-ID: CyQhH2y9lbm

--HG--
extra : rebase_source : d733decec808e7a74deefe149672ec4bdbc7f3f1
2016-11-20 00:53:37 +09:00
Nicholas Nethercote 2511b2c327 Bug 1267550 (part 2) - Rename MOZ_WARN_UNUSED_RESULT as MOZ_MUST_USE. r=froydnj.
It's an annotation that is used a lot, and should be used even more, so a
shorter name is better.

MozReview-Commit-ID: 1VS4Dney4WX

--HG--
extra : rebase_source : b26919c1b0fcb32e5339adeef5be5becae6032cf
2016-04-27 14:16:50 +10:00
Michael Layzell 660f381a2f Bug 1159433 - Part 4: Mark nsTAutoString_CharT and nsAutoArrayBase as non-memmovable; r=froydnj 2015-07-24 19:15:40 -04:00
Mike Hommey 924c9eb636 Bug 1134923 - Remove NS_Alloc/NS_Realloc/NS_Free. r=nfroyd
They are kept around for the sake of the standalone glue, which is used
for e.g. webapprt, which doesn't have direct access to jemalloc, and thus
still needs a wrapper to go through the xpcom function list and get to
jemalloc from there.
2015-05-01 09:40:30 +09:00
Jim Blandy 6afdd6c96b Bug 1145051: Use MOZ_WARN_UNUSED_RESULT instead of NS_WARN_UNUSED_RESULT. r=glandium
--HG--
extra : rebase_source : d210822225d307f3e3685cb5f95b461c48c0be7e
2015-03-19 00:46:40 -07:00
Tom Tromey 795381b915 Bug 1135081 - Fix typo in nsTString::AssertValidDepedentString. r=froydnj 2015-02-20 08:02:00 -05:00
Ehsan Akhgari 56a443b1c1 Bug 1097452 - Use fallible allocation when setting the value of an <input> or <textarea> element; r=jst,froydnj
This patch handles most of the call sites for these allocations except
for a few where I added TODO comments with some information.  Handling
those places may require reworking lots of code, so I prefer to not do
that here.
2015-01-14 17:31:41 -05:00
Ehsan Akhgari 4354953b4f Bug 1118486 - Part 1: Use `= delete` instead of MOZ_DELETE directly; r=Waldo
Most of this patch (with the exception of dom/bindings/Codegen.py) was
generated by the following bash script:

#!/bin/bash

function convert() {
echo "Converting $1 to $2..."
find . ! -wholename "*nsprpub*" \
       ! -wholename "*security/nss*" \
       ! -wholename "*/.hg*" \
       ! -wholename "*/.git*" \
       ! -wholename "obj-*" \
         -type f \
      \( -iname "*.cpp" \
         -o -iname "*.h" \
         -o -iname "*.cc" \
         -o -iname "*.idl" \
         -o -iname "*.ipdl" \
         -o -iname "*.ipdlh" \
         -o -iname "*.mm" \) | \
    xargs -n 1 sed -i -e "s/\b$1\b/$2/g"
}

convert MOZ_DELETE '= delete'
2015-01-08 23:19:05 -05:00
Ehsan Akhgari 67cc0b04d5 Bug 1101337 - Make the ReplaceSubstring() XPCOM string API linear; r=froydnj
ReplaceSubstring() is an O(n*m) algorithm (n being the length of the
string and m being the number of occurrences of aTarget) because we have
to move the remainder of the string, search it again and potentially
memmove most of it again as we find more matches.  This patch rewrites
that function to make it O(n+m).

Note that we currently don't build TestStrings.cpp, so the test case in
this patch is not run automatically, but the test case has been verified
to pass separately by moving the test function into Gecko and calling it
during startup and stepping through it in the debugger.

--HG--
extra : rebase_source : b020e17c1973330b0dbbd6bf956c073cfdcb775e
2014-12-12 18:57:09 -05:00
Wes Kocher e39cbf38e2 Backed out changeset 95377313608b (bug 1101337) for linux debug build bustage 2014-12-12 16:34:43 -08:00
Ehsan Akhgari 8bcf46c622 Bug 1101337 - Make the ReplaceSubstring() XPCOM string API linear; r=froydnj
ReplaceSubstring() is an O(n*m) algorithm (n being the length of the
string and m being the number of occurrences of aTarget) because we have
to move the remainder of the string, search it again and potentially
memmove most of it again as we find more matches.  This patch rewrites
that function to make it O(n+m).

Note that we currently don't build TestStrings.cpp, so the test case in
this patch is not run automatically, but the test case has been verified
to pass separately by moving the test function into Gecko and calling it
during startup and stepping through it in the debugger.
2014-12-12 18:57:09 -05:00