From 9dc829b584a39b29738d71719971ad0fa8c4590b Mon Sep 17 00:00:00 2001 From: Hunter Goldstein Date: Fri, 8 Nov 2024 12:32:51 -0800 Subject: [PATCH] Use `size_t` in `getDocumentOffsets` --- Analysis/src/FragmentAutocomplete.cpp | 16 ++++++++-------- 1 file changed, 8 insertions(+), 8 deletions(-) diff --git a/Analysis/src/FragmentAutocomplete.cpp b/Analysis/src/FragmentAutocomplete.cpp index c8c6a1f4..3395f125 100644 --- a/Analysis/src/FragmentAutocomplete.cpp +++ b/Analysis/src/FragmentAutocomplete.cpp @@ -99,14 +99,14 @@ FragmentAutocompleteAncestryResult findAncestryForFragmentParse(AstStatBlock* ro * Example - your document is "foo bar baz" and getDocumentOffsets is passed (1, 4) - (1, 8). This function returns the pair {3, 7}, * which corresponds to the string " bar " */ -std::pair getDocumentOffsets(const std::string_view& src, const Position& startPos, const Position& endPos) +std::pair getDocumentOffsets(const std::string_view& src, const Position& startPos, const Position& endPos) { - unsigned int lineCount = 0; - unsigned int colCount = 0; + size_t lineCount = 0; + size_t colCount = 0; - unsigned int docOffset = 0; - unsigned int startOffset = 0; - unsigned int endOffset = 0; + size_t docOffset = 0; + size_t startOffset = 0; + size_t endOffset = 0; bool foundStart = false; bool foundEnd = false; for (char c : src) @@ -146,8 +146,8 @@ std::pair getDocumentOffsets(const std::string_view& if (foundStart && !foundEnd) endOffset = src.length(); - unsigned int min = std::min(startOffset, endOffset); - unsigned int len = std::max(startOffset, endOffset) - min; + size_t min = std::min(startOffset, endOffset); + size_t len = std::max(startOffset, endOffset) - min; return {min, len}; }