Fixing warnings. Added JSONCPP_DEPRECATED definition for clang. Also updating .gitignore to ignore .DS_Store files (Mac OS Finder generated)

This commit is contained in:
damiram
2017-08-02 22:44:42 -07:00
parent 7354da8077
commit ef16a35328
7 changed files with 57 additions and 10 deletions

View File

@@ -81,7 +81,7 @@ Features Features::strictMode() {
// Implementation of class Reader
// ////////////////////////////////
static bool containsNewLine(Reader::Location begin, Reader::Location end) {
bool Reader::containsNewLine(Reader::Location begin, Reader::Location end) {
for (; begin < end; ++begin)
if (*begin == '\n' || *begin == '\r')
return true;
@@ -370,7 +370,7 @@ bool Reader::readComment() {
return true;
}
static JSONCPP_STRING normalizeEOL(Reader::Location begin, Reader::Location end) {
JSONCPP_STRING Reader::normalizeEOL(Reader::Location begin, Reader::Location end) {
JSONCPP_STRING normalized;
normalized.reserve(static_cast<size_t>(end - begin));
Reader::Location current = begin;
@@ -1019,6 +1019,9 @@ private:
void addComment(Location begin, Location end, CommentPlacement placement);
void skipCommentTokens(Token& token);
static JSONCPP_STRING normalizeEOL(Location begin, Location end);
static bool containsNewLine(Location begin, Location end);
typedef std::stack<Value*> Nodes;
Nodes nodes_;
Errors errors_;
@@ -1036,6 +1039,13 @@ private:
// complete copy of Read impl, for OurReader
bool OurReader::containsNewLine(OurReader::Location begin, OurReader::Location end) {
for (; begin < end; ++begin)
if (*begin == '\n' || *begin == '\r')
return true;
return false;
}
OurReader::OurReader(OurFeatures const& features)
: errors_(), document_(), begin_(), end_(), current_(), lastValueEnd_(),
lastValue_(), commentsBefore_(),
@@ -1345,6 +1355,25 @@ bool OurReader::readComment() {
return true;
}
JSONCPP_STRING OurReader::normalizeEOL(OurReader::Location begin, OurReader::Location end) {
JSONCPP_STRING normalized;
normalized.reserve(static_cast<size_t>(end - begin));
OurReader::Location current = begin;
while (current != end) {
char c = *current++;
if (c == '\r') {
if (current != end && *current == '\n')
// convert dos EOL
++current;
// convert Mac EOL
normalized += '\n';
} else {
normalized += c;
}
}
return normalized;
}
void
OurReader::addComment(Location begin, Location end, CommentPlacement placement) {
assert(collectComments_);