Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
22 changes: 11 additions & 11 deletions include/crow/json.h
Original file line number Diff line number Diff line change
Expand Up @@ -1862,14 +1862,14 @@ namespace crow // NOTE: Already documented in "crow/app.h"
out.push_back('"');
}

inline void dump_indentation_part(std::string& out, const int indent, const char separator, const int indent_level) const
inline void dump_indentation_part(std::string& out, const size_t indent, const char separator, const int indent_level) const
{
out.push_back('\n');
out.append(indent_level * indent, separator);
}


inline void dump_internal(const wvalue& v, std::string& out, const int indent, const char separator, const int indent_level = 0) const
inline void dump_internal(const wvalue& v, std::string& out, const size_t indent, const char separator, const int indent_level = 0) const
{
switch (v.t_)
{
Expand Down Expand Up @@ -1965,7 +1965,7 @@ namespace crow // NOTE: Already documented in "crow/app.h"
{
out.push_back('[');

if (indent >= 0)
if (indent !=std::string::npos)
{
dump_indentation_part(out, indent, separator, indent_level + 1);
}
Expand All @@ -1979,7 +1979,7 @@ namespace crow // NOTE: Already documented in "crow/app.h"
{
out.push_back(',');

if (indent >= 0)
if (indent != std::string::npos)
{
dump_indentation_part(out, indent, separator, indent_level + 1);
}
Expand All @@ -1989,7 +1989,7 @@ namespace crow // NOTE: Already documented in "crow/app.h"
}
}

if (indent >= 0)
if (indent !=std::string::npos)
{
dump_indentation_part(out, indent, separator, indent_level);
}
Expand All @@ -2001,7 +2001,7 @@ namespace crow // NOTE: Already documented in "crow/app.h"
{
out.push_back('{');

if (indent >= 0)
if (indent != std::string::npos)
{
dump_indentation_part(out, indent, separator, indent_level + 1);
}
Expand All @@ -2014,7 +2014,7 @@ namespace crow // NOTE: Already documented in "crow/app.h"
if (!first)
{
out.push_back(',');
if (indent >= 0)
if (indent != std::string::npos)
{
dump_indentation_part(out, indent, separator, indent_level + 1);
}
Expand All @@ -2023,7 +2023,7 @@ namespace crow // NOTE: Already documented in "crow/app.h"
dump_string(kv.first, out);
out.push_back(':');

if (indent >= 0)
if (indent != std::string::npos)
{
out.push_back(' ');
}
Expand All @@ -2032,7 +2032,7 @@ namespace crow // NOTE: Already documented in "crow/app.h"
}
}

if (indent >= 0)
if (indent != std::string::npos)
{
dump_indentation_part(out, indent, separator, indent_level);
}
Expand All @@ -2048,7 +2048,7 @@ namespace crow // NOTE: Already documented in "crow/app.h"
}

public:
std::string dump(const int indent, const char separator = ' ') const
std::string dump(const size_t indent, const char separator = ' ') const
{
std::string ret;
ret.reserve(estimate_length());
Expand All @@ -2058,7 +2058,7 @@ namespace crow // NOTE: Already documented in "crow/app.h"

std::string dump() const override
{
static constexpr int DontIndent = -1;
static constexpr size_t DontIndent = std::string::npos;

return dump(DontIndent);
}
Expand Down
Loading