Bug 1325995 - Misc fixes.

MozReview-Commit-ID: IcJvNv6rWSt
This commit is contained in:
Jeff Gilbert 2017-01-03 16:12:06 -08:00
parent c66c9fccda
commit 4e282917d8

View File

@ -52,7 +52,8 @@ TruncateComments(const nsAString& src, nsAString* const out)
const nsString commentBeginnings[] = { NS_LITERAL_STRING("//"),
NS_LITERAL_STRING("/*"),
nsString() };
nsString() }; // Final empty string for "found
// nothing".
const nsString lineCommentEndings[] = { NS_LITERAL_STRING("\\\n"),
NS_LITERAL_STRING("\n"),
nsString() };
@ -63,8 +64,10 @@ TruncateComments(const nsAString& src, nsAString* const out)
while (srcItr != srcEnd) {
size_t foundId;
fnEmitUntil( fnFindSoonestOf(commentBeginnings, 2, &foundId) );
fnEmitUntil(srcItr + commentBeginnings[foundId].Length());
fnEmitUntil(srcItr + commentBeginnings[foundId].Length()); // Final empty string
// allows us to skip
// forward here
// unconditionally.
switch (foundId) {
case 0: // line comment
while (true) {