diff options
author | Dimitri van Heesch <doxygen@gmail.com> | 2020-03-02 19:10:51 (GMT) |
---|---|---|
committer | Dimitri van Heesch <doxygen@gmail.com> | 2020-03-02 19:10:51 (GMT) |
commit | fbebfae209139fccb15fde8fb7d1bdbb4b941875 (patch) | |
tree | 451d9d2cb66489e4ab427301909c58b4cbb63948 /addon | |
parent | 6c06e912338176303d1a1e041a39984ff6fd42be (diff) | |
download | Doxygen-fbebfae209139fccb15fde8fb7d1bdbb4b941875.zip Doxygen-fbebfae209139fccb15fde8fb7d1bdbb4b941875.tar.gz Doxygen-fbebfae209139fccb15fde8fb7d1bdbb4b941875.tar.bz2 |
Fix a number of compiler warnings in the 64bit build for Windows
Diffstat (limited to 'addon')
-rw-r--r-- | addon/doxysearch/doxyindexer.cpp | 4 | ||||
-rw-r--r-- | addon/doxysearch/doxysearch.cpp | 42 |
2 files changed, 23 insertions, 23 deletions
diff --git a/addon/doxysearch/doxyindexer.cpp b/addon/doxysearch/doxyindexer.cpp index 12d3e9a..df596a2 100644 --- a/addon/doxysearch/doxyindexer.cpp +++ b/addon/doxysearch/doxyindexer.cpp @@ -52,7 +52,7 @@ static std::string trim(const std::string& str, return ""; // no content size_t strEnd = str.find_last_not_of(whitespace); - int strRange = strEnd - strBegin + 1; + size_t strRange = strEnd - strBegin + 1; return str.substr(strBegin, strRange); } @@ -72,7 +72,7 @@ static std::string reduce(const std::string& str, while (beginSpace != std::string::npos) { size_t endSpace = result.find_first_not_of(whitespace, beginSpace); - int range = endSpace - beginSpace; + size_t range = endSpace - beginSpace; result.replace(beginSpace, range, fill); diff --git a/addon/doxysearch/doxysearch.cpp b/addon/doxysearch/doxysearch.cpp index 98adab4..4c4dc72 100644 --- a/addon/doxysearch/doxysearch.cpp +++ b/addon/doxysearch/doxysearch.cpp @@ -76,7 +76,7 @@ static std::string uriDecode(const std::string & sSrc) // (0-9, A-F) are reserved for future extension" const unsigned char * pSrc = (const unsigned char *)sSrc.c_str(); - const int SRC_LEN = sSrc.length(); + const size_t SRC_LEN = sSrc.length(); const unsigned char * const SRC_END = pSrc + SRC_LEN; // last decodable '%' const unsigned char * const SRC_LAST_DEC = SRC_END - 2; @@ -140,9 +140,9 @@ T fromString(const std::string& s) /** Class that holds the starting position of a word */ struct WordPosition { - WordPosition(int s,int i) : start(s), index(i) {} - int start; - int index; + WordPosition(size_t s,size_t i) : start(s), index(i) {} + size_t start; + size_t index; }; /** Class representing the '<' operator for WordPosition objects based on position. */ @@ -174,20 +174,20 @@ struct Fragment_greater /** Class representing a range within a string */ struct Range { - Range(int s,int e) : start(s), end(e) {} - int start; - int end; + Range(size_t s,size_t e) : start(s), end(e) {} + size_t start; + size_t end; }; /** Returns true if [start..start+len] is inside one of the \a ranges. */ -static bool insideRange(const std::vector<Range> &ranges,int start,int len) +static bool insideRange(const std::vector<Range> &ranges,size_t start,size_t len) { for (std::vector<Range>::const_iterator it = ranges.begin(); it!=ranges.end(); ++it ) { Range r = *it; - if (start>=r.start && start+len<r.end) + if (start>=r.start && start+len<r.end) { return true; } @@ -206,18 +206,18 @@ static void highlighter(const std::string &s, const std::string spanStart="<span class=\"hl\">"; const std::string spanEnd="</span>"; const std::string dots="..."; - const int fragLen = 60; - int sl=s.length(); + const size_t fragLen = 60; + size_t sl=s.length(); // find positions of words in s - size_t j=0; + int j=0; std::vector<WordPosition> positions; for (std::vector<std::string>::const_iterator it=words.begin(); it!=words.end(); ++it,++j ) { - int pos=0; + size_t pos=0; size_t i; std::string word = *it; while ((i=s.find(word,pos))!=std::string::npos) @@ -236,8 +236,8 @@ static void highlighter(const std::string &s, { WordPosition wp = *it; std::string w = words[wp.index]; - int i=wp.start; - int wl=w.length(); + size_t i=wp.start; + size_t wl=w.length(); if (!insideRange(ranges,i,wl)) { if (wl>fragLen) @@ -248,8 +248,8 @@ static void highlighter(const std::string &s, else { std::string startFragment,endFragment; - int bi=i-(fragLen-wl)/2; - int ei=i+wl+(fragLen-wl)/2; + size_t bi=i-(fragLen-wl)/2; + size_t ei=i+wl+(fragLen-wl)/2; int occ=0; if (bi<0) { ei-=bi; bi=0; } else startFragment=dots; if (ei>sl) { ei=sl; } else endFragment=dots; @@ -257,14 +257,14 @@ static void highlighter(const std::string &s, while (ei<sl && !isspace(s[ei])) ei++; // round to end of the word // highlight any word in s between indexes bi and ei std::string fragment=startFragment; - int pos=bi; + size_t pos=bi; for (std::vector<WordPosition>::const_iterator it2=positions.begin(); it2!=positions.end(); ++it2) { WordPosition wp2 = *it2; std::string w2 = words[wp2.index]; - int wl2 = w2.length(); + size_t wl2 = w2.length(); if (wp2.start>=bi && wp2.start+wl2<=ei) // word is inside the range! { fragment+=s.substr(pos,wp2.start-pos)+ @@ -288,10 +288,10 @@ static void highlighter(const std::string &s, static std::string escapeString(const std::string &s) { std::stringstream dst; - for (unsigned int i=0;i<s.length();i++) + for (size_t i=0;i<s.length();i++) { char ch = s[i]; - switch (ch) + switch (ch) { case '\"': dst << "\\\""; break; default: dst << ch; break; |