libjson path的一个bug
int i = 0;
Json::PathArgument arg(i);
Json::Path pathLang(".[%].Language", arg);
Json::Path pathLnag2(".[0].Language") 这里pathLang pathLang2应该是等价的才对,原始代码这里PathArgument存在bug,造成这两者不等价。现在修正
Json::Value jLang = pathLang.make(jArray);
修改代码如下:
json_value.cpp
void
Path::makePath( const std::string &path,
const InArgs &in )
{
const char *current = path.c_str();
const char *end = current + path.length();
InArgs::const_iterator itInArg = in.begin();
while ( current != end )
{
if ( *current == '[' )
{
++current;
if ( *current == '%' )
{
addPathInArg( path, in, itInArg, PathArgument::kindIndex );
++current; //原始代码这里没有让指针+1
}else