pod: move common check outside of the loop

This commit is contained in:
Wim Taymans 2025-04-15 18:33:29 +02:00
parent 4774178c68
commit d1d580cafa

View file

@ -209,15 +209,15 @@ spa_pod_filter_prop(struct spa_pod_builder *b,
bool found_def = false; bool found_def = false;
/* we should prefer the alt2 range default value but only if valid */ /* we should prefer the alt2 range default value but only if valid */
for (j = 0, a1 = alt1; j < nalt1; j++, a1 = SPA_PTROFF(a1,size,void)) { if (spa_pod_compare_value(type, alt2, min, size) >= 0 &&
if (spa_pod_compare_value(type, alt2, min, size) < 0 || spa_pod_compare_value(type, alt2, max, size) <= 0) {
spa_pod_compare_value(type, alt2, max, size) > 0) for (j = 0, a1 = alt1; j < nalt1; j++, a1 = SPA_PTROFF(a1,size,void)) {
break; if (spa_pod_compare_value(type, a1, alt2, size) == 0) {
if (spa_pod_compare_value(type, a1, alt2, size) == 0) { /* it is in the enum, use as default then */
/* it is in the enum, use as default then */ spa_pod_builder_raw(b, a1, size);
spa_pod_builder_raw(b, a1, size); found_def = true;
found_def = true; break;
break; }
} }
} }
/* copy all values inside the range */ /* copy all values inside the range */