summaryrefslogtreecommitdiffstats
path: root/embedding/components/find/nsFind.cpp
diff options
context:
space:
mode:
authorMatt A. Tobin <email@mattatobin.com>2020-04-17 06:10:23 -0400
committerMatt A. Tobin <email@mattatobin.com>2020-04-17 06:10:23 -0400
commit70c8ff8e5af7d2661b64fb92a158f2860af7766c (patch)
treee7fd37d81858a7dfa06fbf59880d837d9e7fa256 /embedding/components/find/nsFind.cpp
parent53428ad3f04ff1e01f0596ef0c592bdbe5fdd15b (diff)
downloadUXP-70c8ff8e5af7d2661b64fb92a158f2860af7766c.tar
UXP-70c8ff8e5af7d2661b64fb92a158f2860af7766c.tar.gz
UXP-70c8ff8e5af7d2661b64fb92a158f2860af7766c.tar.lz
UXP-70c8ff8e5af7d2661b64fb92a158f2860af7766c.tar.xz
UXP-70c8ff8e5af7d2661b64fb92a158f2860af7766c.zip
Bug 1377978 - Make nsRange use uint32_t to offset
Tag #1375
Diffstat (limited to 'embedding/components/find/nsFind.cpp')
-rw-r--r--embedding/components/find/nsFind.cpp19
1 files changed, 12 insertions, 7 deletions
diff --git a/embedding/components/find/nsFind.cpp b/embedding/components/find/nsFind.cpp
index 63304dafb..89221251e 100644
--- a/embedding/components/find/nsFind.cpp
+++ b/embedding/components/find/nsFind.cpp
@@ -609,7 +609,7 @@ nsFind::NextNode(nsIDOMRange* aSearchRange,
// beginning/end of the search range.
nsCOMPtr<nsIDOMNode> startNode;
nsCOMPtr<nsIDOMNode> endNode;
- int32_t startOffset, endOffset;
+ uint32_t startOffset, endOffset;
if (aContinueOk) {
#ifdef DEBUG_FIND
printf("Match in progress: continuing past endpoint\n");
@@ -645,7 +645,8 @@ nsFind::NextNode(nsIDOMRange* aSearchRange,
}
}
- rv = InitIterator(startNode, startOffset, endNode, endOffset);
+ rv = InitIterator(startNode, static_cast<int32_t>(startOffset),
+ endNode, static_cast<int32_t>(endOffset));
NS_ENSURE_SUCCESS(rv, rv);
if (!aStartPoint) {
aStartPoint = aSearchRange;
@@ -665,14 +666,18 @@ nsFind::NextNode(nsIDOMRange* aSearchRange,
if (mFindBackward) {
aStartPoint->GetEndContainer(getter_AddRefs(node));
if (mIterNode.get() == node.get()) {
- aStartPoint->GetEndOffset(&mIterOffset);
+ uint32_t endOffset;
+ aStartPoint->GetEndOffset(&endOffset);
+ mIterOffset = static_cast<int32_t>(endOffset);
} else {
mIterOffset = -1; // sign to start from end
}
} else {
aStartPoint->GetStartContainer(getter_AddRefs(node));
if (mIterNode.get() == node.get()) {
- aStartPoint->GetStartOffset(&mIterOffset);
+ uint32_t startOffset;
+ aStartPoint->GetStartOffset(&startOffset);
+ mIterOffset = static_cast<int32_t>(startOffset);
} else {
mIterOffset = 0;
}
@@ -997,7 +1002,7 @@ nsFind::Find(const nsAString& aPatText, nsIDOMRange* aSearchRange,
// Get the end point, so we know when to end searches:
nsCOMPtr<nsIDOMNode> endNode;
- int32_t endOffset;
+ uint32_t endOffset;
aEndPoint->GetEndContainer(getter_AddRefs(endNode));
aEndPoint->GetEndOffset(&endOffset);
@@ -1132,8 +1137,8 @@ nsFind::Find(const nsAString& aPatText, nsIDOMRange* aSearchRange,
// Have we gone past the endpoint yet? If we have, and we're not in the
// middle of a match, return.
if (mIterNode == endNode &&
- ((mFindBackward && findex < endOffset) ||
- (!mFindBackward && findex > endOffset))) {
+ ((mFindBackward && findex < static_cast<int32_t>(endOffset)) ||
+ (!mFindBackward && findex > static_cast<int32_t>(endOffset)))) {
ResetAll();
return NS_OK;
}