diff options
author | Matt A. Tobin <email@mattatobin.com> | 2020-04-17 06:10:23 -0400 |
---|---|---|
committer | Matt A. Tobin <email@mattatobin.com> | 2020-04-17 06:10:23 -0400 |
commit | 70c8ff8e5af7d2661b64fb92a158f2860af7766c (patch) | |
tree | e7fd37d81858a7dfa06fbf59880d837d9e7fa256 /embedding/components | |
parent | 53428ad3f04ff1e01f0596ef0c592bdbe5fdd15b (diff) | |
download | UXP-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')
-rw-r--r-- | embedding/components/find/nsFind.cpp | 19 | ||||
-rw-r--r-- | embedding/components/find/nsWebBrowserFind.cpp | 2 |
2 files changed, 13 insertions, 8 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; } diff --git a/embedding/components/find/nsWebBrowserFind.cpp b/embedding/components/find/nsWebBrowserFind.cpp index aadc66f8e..5aefba975 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) { |