Fixed GetTranslators to return the list of output formats in the order of most capable to least capable instead of before, where the list's order was the reverse of the order in which the translators were loaded.

git-svn-id: file:///srv/svn/repos/haiku/trunk/current@6125 a95241bf-73f2-0310-859d-f6bbb57e9c96
This commit is contained in:
Matthew Wilber
2004-01-18 03:06:59 +00:00
parent 8267ce8bbc
commit 01a21f2027
+17 -5
View File
@@ -632,9 +632,14 @@ BTranslatorRoster::Identify(BPositionIO *inSource,
//
// Postconditions:
//
// Returns: < 0 if a is less desirable than b,
// 0 if a as good as b,
// > 0 if a is more desirable than b
// Returns:
// NOTE: Since qsort sorts lowest to highest, and I want
// the highest quality/capability first, I must do things
// "backwards."
//
// 0 if A and B are equally capable
// -1 if A is more capable than B
// 1 if A is less capable than B
// ---------------------------------------------------------------
static int
compare_data(const void *a, const void *b)
@@ -645,8 +650,15 @@ compare_data(const void *a, const void *b)
register const translator_info *bi =
reinterpret_cast<const translator_info *> (b);
return static_cast<int> (- ai->quality * ai->capability +
bi->quality * bi->capability);
float acmp, bcmp;
acmp = ai->quality * ai->capability;
bcmp = bi->quality * bi->capability;
if (acmp == bcmp)
return 0;
else if (acmp > bcmp)
return -1;
else
return 1;
}
// ---------------------------------------------------------------