Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Added missing field initializers and typeinfo include #4

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
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
8 changes: 4 additions & 4 deletions ujson/ujson.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -76,9 +76,9 @@ struct utf8_ranges_t {
};

static const utf8_ranges_t utf8_ranges[] = {
{ 0x7F, 0 },
{ 0xBF, 1 }, // 80-BF invalid continuation
{ 0xC1, 1 }, // 0xC0-0xC1 invalid as first byte
{ 0x7F, 0, {} },
{ 0xBF, 1, {} }, // 80-BF invalid continuation
{ 0xC1, 1, {} }, // 0xC0-0xC1 invalid as first byte
{ 0xDF, 1, { { 0x80, 0xBF + 1 } } },
{ 0xE0, 2, { { 0xA0, 0xBF + 1 }, { 0x80, 0xBF + 1 } } },
{ 0xEC, 2, { { 0x80, 0xBF + 1 }, { 0x80, 0xBF + 1 } } },
Expand All @@ -87,7 +87,7 @@ static const utf8_ranges_t utf8_ranges[] = {
{ 0xF0, 3, { { 0x90, 0xBF + 1 }, { 0x80, 0xBF + 1 }, { 0x80, 0xBF + 1 } } },
{ 0xF3, 3, { { 0x80, 0xBF + 1 }, { 0x80, 0xBF + 1 }, { 0x80, 0xBF + 1 } } },
{ 0xF4, 3, { { 0x80, 0x8F + 1 }, { 0x80, 0xBF + 1 }, { 0x80, 0xBF + 1 } } },
{ 0xFF, 1 } // 0xF5-0xFF invalid as first byte
{ 0xFF, 1, {} } // 0xF5-0xFF invalid as first byte
};

static const std::size_t num_utf8_ranges =
Expand Down
5 changes: 3 additions & 2 deletions ujson/ujson.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -31,6 +31,7 @@
#include <map>
#include <memory>
#include <string>
#include <typeinfo>
#include <vector>

namespace ujson {
Expand Down Expand Up @@ -721,8 +722,8 @@ inline void swap(value &lhs, value &rhs) noexcept { lhs.swap(rhs); }

inline bool operator==(const value &lhs, const value &rhs) {

auto lhs_impl = lhs.impl();
auto rhs_impl = rhs.impl();
auto const lhs_impl = lhs.impl();
auto const rhs_impl = rhs.impl();

if (typeid(*lhs_impl) != typeid(*rhs_impl))
return false;
Expand Down