44// file COPYING or http://www.opensource.org/licenses/mit-license.php.
55
66#include < stdint.h>
7- #include < ctype.h>
87#include < errno.h>
98#include < iomanip>
109#include < limits>
@@ -21,7 +20,7 @@ static bool ParsePrechecks(const std::string& str)
2120{
2221 if (str.empty ()) // No empty string allowed
2322 return false ;
24- if (str.size () >= 1 && (isspace (str[0 ]) || isspace (str[str.size ()-1 ]))) // No padding allowed
23+ if (str.size () >= 1 && (json_isspace (str[0 ]) || json_isspace (str[str.size ()-1 ]))) // No padding allowed
2524 return false ;
2625 if (str.size () != strlen (str.c_str ())) // No embedded NUL characters allowed
2726 return false ;
@@ -210,7 +209,7 @@ bool UniValue::pushKVs(const UniValue& obj)
210209
211210 for (unsigned int i = 0 ; i < obj.keys .size (); i++) {
212211 keys.push_back (obj.keys [i]);
213- values.push_back (obj.values [i] );
212+ values.push_back (obj.values . at (i) );
214213 }
215214
216215 return true ;
@@ -234,7 +233,7 @@ bool UniValue::checkObject(const std::map<std::string,UniValue::VType>& t)
234233 if (idx < 0 )
235234 return false ;
236235
237- if (values[ idx] .getType () != it->second )
236+ if (values. at ( idx) .getType () != it->second )
238237 return false ;
239238 }
240239
@@ -250,7 +249,7 @@ const UniValue& UniValue::operator[](const std::string& key) const
250249 if (index < 0 )
251250 return NullUniValue;
252251
253- return values[ index] ;
252+ return values. at ( index) ;
254253}
255254
256255const UniValue& UniValue::operator [](unsigned int index) const
@@ -260,7 +259,7 @@ const UniValue& UniValue::operator[](unsigned int index) const
260259 if (index >= values.size ())
261260 return NullUniValue;
262261
263- return values[ index] ;
262+ return values. at ( index) ;
264263}
265264
266265const char *uvTypeName (UniValue::VType t)
@@ -278,15 +277,11 @@ const char *uvTypeName(UniValue::VType t)
278277 return NULL ;
279278}
280279
281- const UniValue& find_value ( const UniValue& obj, const std::string& name)
280+ const UniValue& find_value (const UniValue& obj, const std::string& name)
282281{
283282 for (unsigned int i = 0 ; i < obj.keys .size (); i++)
284- {
285- if ( obj.keys [i] == name )
286- {
287- return obj.values [i];
288- }
289- }
283+ if (obj.keys [i] == name)
284+ return obj.values .at (i);
290285
291286 return NullUniValue;
292287}
0 commit comments