fixed aid selection
This commit is contained in:
@@ -123,13 +123,17 @@ int PrintAIDDescription(char *aid, bool verbose) {
|
|||||||
goto out;
|
goto out;
|
||||||
|
|
||||||
json_t *elm = NULL;
|
json_t *elm = NULL;
|
||||||
|
int maxaidlen = 0;
|
||||||
for (int elmindx = 0; elmindx < json_array_size(root); elmindx++) {
|
for (int elmindx = 0; elmindx < json_array_size(root); elmindx++) {
|
||||||
json_t *data = AIDSearchGetElm(root, elmindx);
|
json_t *data = AIDSearchGetElm(root, elmindx);
|
||||||
if (data == NULL)
|
if (data == NULL)
|
||||||
continue;
|
continue;
|
||||||
if (aidCompare(jsonStrGet(data, "AID"), aid)) {
|
const char *dictaid = jsonStrGet(data, "AID");
|
||||||
elm = data;
|
if (aidCompare(aid, dictaid)) { // dictaid may be less length than requested aid
|
||||||
break;
|
if (maxaidlen < strlen(dictaid) && strlen(dictaid) <= strlen(aid)) {
|
||||||
|
maxaidlen = strlen(dictaid);
|
||||||
|
elm = data;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user