summaryrefslogtreecommitdiff
path: root/embedding
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
parent53428ad3f04ff1e01f0596ef0c592bdbe5fdd15b (diff)
downloaduxp-70c8ff8e5af7d2661b64fb92a158f2860af7766c.tar.gz
Bug 1377978 - Make nsRange use uint32_t to offset
Tag #1375
Diffstat (limited to 'embedding')
-rw-r--r--embedding/components/find/nsFind.cpp19
-rw-r--r--embedding/components/find/nsWebBrowserFind.cpp2
2 files changed, 13 insertions, 8 deletions
diff --git a/embedding/components/find/nsFind.cpp b/embedding/components/find/nsFind.cpp
index 63304dafb9..89221251ea 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;
}
diff --git a/embedding/components/find/nsWebBrowserFind.cpp b/embedding/components/find/nsWebBrowserFind.cpp
index aadc66f8eb..5aefba975f 100644
--- a/embedding/components/find/nsWebBrowserFind.cpp
+++ b/embedding/components/find/nsWebBrowserFind.cpp
@@ -518,7 +518,7 @@ nsWebBrowserFind::GetSearchLimits(nsIDOMRange* aSearchRange,
nsCOMPtr<nsIDOMRange> range;
nsCOMPtr<nsIDOMNode> node;
- int32_t offset;
+ uint32_t offset;
// Forward, not wrapping: SelEnd to DocEnd
if (!mFindBackwards && !aWrap) {