@@ -415,17 +415,17 @@ void JSONVar::replaceJson(struct cJSON* json)
415
415
// ---------------------------------------------------------------------
416
416
417
417
bool JSONVar::hasPropertyEqualTo (const String& key, String& value) const {
418
- return hasPropertyEqualTo (key.c_str (), value.c_str ());
418
+ return this . hasPropertyEqualTo (key.c_str (), value.c_str ());
419
419
}
420
420
421
421
// ---------------------------------------------------------------------
422
422
423
423
bool JSONVar::hasPropertyEqualTo (const char * key, const char * value) const {
424
- if (!hasProperty (sourceProperty )){
424
+ if (!this . hasProperty (key )){
425
425
return false ;
426
426
}
427
427
428
- if (strcmp (targetValue, source[sourceProperty ]) == 0 ){
428
+ if (strcmp (value, this [key ]) == 0 ){
429
429
return true ;
430
430
}
431
431
@@ -435,29 +435,29 @@ bool JSONVar::hasPropertyEqualTo(const char* key, const char* value) const {
435
435
// ---------------------------------------------------------------------
436
436
437
437
JSONVar JSONVar::getPropertyWithValue (const String& key, String& value, String child = " " ) const {
438
- return getPropertyWithValue (key..c_str (), value.c_str (), child.c_str ());
438
+ return this . getPropertyWithValue (key..c_str (), value.c_str (), child.c_str ());
439
439
}
440
440
441
441
// ---------------------------------------------------------------------
442
442
443
443
JSONVar JSONVar::getPropertyWithValue (const char * key, const char * value, const char * child = ' ' ) const {
444
444
if (this .hasOwnPropertyEqualTo (key, value)){
445
- if (source .hasOwnProperty (childName )){
446
- return source[childName ];
445
+ if (this .hasOwnProperty (child )){
446
+ return this [child ];
447
447
}
448
448
else {
449
- return source ;
449
+ return this ;
450
450
}
451
451
}
452
452
453
- if (JSON.typeof_ (source ) == " array" ){
454
- for (int i = 0 ; i < source .length (); ++i) {
455
- if (_hasMatch (source[i], sourceProperty, targetValue )){
456
- if (source [i].hasOwnProperty (childName )){
457
- return source [i][childName ];
453
+ if (JSON.typeof_ (this ) == " array" ){
454
+ for (int i = 0 ; i < this .length (); ++i) {
455
+ if (this . hasPropertyEqualTo (key, value )){
456
+ if (this [i].hasOwnProperty (child )){
457
+ return this [i][child ];
458
458
}
459
459
else {
460
- return source [i];
460
+ return this [i];
461
461
}
462
462
}
463
463
}
0 commit comments