X-Git-Url: https://gerrit.o-ran-sc.org/r/gitweb?a=blobdiff_plain;f=src%2Fjson%2Fjhash.cpp;h=25efc4583abd9e5488ba5a34a86feac7677d3fa2;hb=555fc14abec797f96cd4c03bf997ce3711984393;hp=df95e13453963bca2433e3cad6206d6c97a1274a;hpb=6ef23e1d7f7f47ccab5be6ff1b68e5cfdda80ad2;p=ric-plt%2Fxapp-frame-cpp.git diff --git a/src/json/jhash.cpp b/src/json/jhash.cpp index df95e13..25efc45 100644 --- a/src/json/jhash.cpp +++ b/src/json/jhash.cpp @@ -49,7 +49,6 @@ namespace xapp { suss out the values. */ xapp::Jhash::Jhash( const char* jbuf ) : - master_st( NULL ), st( jw_new( jbuf ) ) { /* empty body */ } @@ -57,10 +56,10 @@ xapp::Jhash::Jhash( const char* jbuf ) : /* Move constructor. */ -Jhash::Jhash( Jhash&& soi ) { - master_st = soi.master_st; - st = soi.st; - +Jhash::Jhash( Jhash&& soi ) : + master_st( soi.master_st ), + st( soi.st ) +{ soi.st = NULL; // prevent closing of RMR stuff on soi destroy soi.master_st = NULL; } @@ -142,7 +141,7 @@ void xapp::Jhash::Unset_blob( ) { Right now we don't have much to work with other than checking for a nil table. */ -bool xapp::Jhash::Parse_errors( ) { +const bool xapp::Jhash::Parse_errors( ) { return st == NULL; } @@ -222,6 +221,7 @@ bool xapp::Jhash::Is_missing( const char* name ) { bool xapp::Jhash::Bool( const char* name ) { int v; v = (int) jw_value( st, name ); + return v == 1; } @@ -231,7 +231,7 @@ bool xapp::Jhash::Bool( const char* name ) { */ std::string xapp::Jhash::String( const char* name ) { std::string rv = ""; - char* hashv; + const char* hashv; if( (hashv = jw_string( st, name )) != NULL ) { rv = std::string( hashv ); @@ -281,7 +281,7 @@ bool xapp::Jhash::Set_blob_ele( const char* name, int eidx ) { */ std::string xapp::Jhash::String_ele( const char* name, int eidx ) { std::string rv = ""; - char* hashv; + const char* hashv; if( (hashv = jw_string_ele( st, name, eidx )) != NULL ) { rv = std::string( hashv );