Skip to content

Commit eaed388

Browse files
committed
fix warnings for msbuild (int -> size_t)
1 parent a44c5f9 commit eaed388

2 files changed

Lines changed: 11 additions & 15 deletions

File tree

src/wsjcpp_yaml.cpp

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -716,7 +716,7 @@ void WsjcppYamlNode::throw_error(const std::string &sError) {
716716
}
717717

718718
void WsjcppYamlNode::removeLastCharNewLine(std::string &sLine) {
719-
int nLen = sLine.length();
719+
size_t nLen = sLine.length();
720720
if (nLen > 0 && sLine[nLen - 1] == '\n') {
721721
sLine = sLine.substr(0, nLen - 1);
722722
}
@@ -766,7 +766,7 @@ std::string WsjcppYamlParsebleLine::getPrefix() {
766766
}
767767

768768
int WsjcppYamlParsebleLine::getIndent() {
769-
return m_sPrefix.length();
769+
return int(m_sPrefix.length());
770770
}
771771

772772
bool WsjcppYamlParsebleLine::isArrayItem() {
@@ -957,7 +957,7 @@ bool WsjcppYamlParsebleLine::parseLine(const std::string &sLine, std::string &sE
957957
bool WsjcppYamlParsebleLine::canTagName(const std::string &sVal) {
958958
std::string sTrim = sVal;
959959
sTrim = WsjcppYaml::trim(sTrim);
960-
int nLen = sTrim.length();
960+
size_t nLen = sTrim.length();
961961
if (nLen == 0) {
962962
return false;
963963
}
@@ -987,7 +987,7 @@ std::string WsjcppYamlParsebleLine::removeStringDoubleQuotes(const std::string &
987987
return sValue;
988988
}
989989
int nStartPos = 1;
990-
int nEndPos = sValue.size()-1;
990+
size_t nEndPos = sValue.size() - 1;
991991
std::string sRet = "";
992992
bool bEscape = false;
993993
for (int i = nStartPos; i < nEndPos; i++) {
@@ -1014,7 +1014,7 @@ std::string WsjcppYamlParsebleLine::removeStringSingleQuotes(const std::string &
10141014
return sValue;
10151015
}
10161016
int nStartPos = 1;
1017-
int nEndPos = sValue.size()-1;
1017+
size_t nEndPos = sValue.size() - 1;
10181018
std::string sRet = "";
10191019
bool bEscape = false;
10201020
for (int i = nStartPos; i < nEndPos; i++) {
@@ -1411,7 +1411,7 @@ void WsjcppYaml::info(const std::string &TAG, const std::string &sMessage) {
14111411
std::vector<std::string> WsjcppYaml::splitToLines(const std::string &sBuffer) {
14121412
std::vector<std::string> vLines;
14131413
std::string sLine = "";
1414-
int nSize = sBuffer.length();
1414+
size_t nSize = sBuffer.length();
14151415
for (int i = 0; i < nSize; i++) {
14161416
char c = sBuffer[i];
14171417
if (c == '\n') {

src/wsjcpp_yaml.h

Lines changed: 5 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -35,8 +35,6 @@ Official Source Code: https://github.com/wsjcpp/wsjcpp-yaml
3535
#include <stdlib.h>
3636
#include <string.h>
3737

38-
// ---------------------------------------------------------------------
39-
4038
enum WsjcppYamlNodeType {
4139
WSJCPP_YAML_NODE_UNDEFINED = 0,
4240
WSJCPP_YAML_NODE_EMPTY = 1,
@@ -45,7 +43,11 @@ enum WsjcppYamlNodeType {
4543
WSJCPP_YAML_NODE_VALUE = 4
4644
};
4745

48-
// ---------------------------------------------------------------------
46+
enum WsjcppYamlQuotes {
47+
WSJCPP_YAML_QUOTES_NONE,
48+
WSJCPP_YAML_QUOTES_DOUBLE,
49+
WSJCPP_YAML_QUOTES_SINGLE
50+
};
4951

5052
class WsjcppYamlPlaceInFile {
5153
public:
@@ -71,12 +73,6 @@ class WsjcppYamlPlaceInFile {
7173
// ---------------------------------------------------------------------
7274
// WsjcppYamlQuotes
7375

74-
enum WsjcppYamlQuotes {
75-
WSJCPP_YAML_QUOTES_NONE,
76-
WSJCPP_YAML_QUOTES_DOUBLE,
77-
WSJCPP_YAML_QUOTES_SINGLE
78-
};
79-
8076
class IWsjcppYamlLog {
8177
public:
8278
virtual void err(const std::string &TAG, const std::string &sMessage) = 0;

0 commit comments

Comments
 (0)