From 61ac0c352313ee69c84cabc03c9c2f4415056d70 Mon Sep 17 00:00:00 2001 From: Matthew Wilber Date: Sat, 10 Jan 2004 21:03:36 +0000 Subject: [PATCH] Changed GetAllTranslators to generate the list of Translators in the same order they were read in (instead of the reverse). This should cause the list of Translators in the DataTranslations pref and in Save As submenus to be in the same order as when using Be's version of the Translation Kit. Also changed the Translation Kit version string calculations to match those for the Translators. So, for R5, the version string becomes "Translation Kit v5.0.0" instead of "Translation Kit v12.8.0", which is what Be's version does, but doesn't appear right because it doesn't match the calculations the Translators use.. Note that the version number is still the same, only how it appears in the string is different. git-svn-id: file:///srv/svn/repos/haiku/trunk/current@6007 a95241bf-73f2-0310-859d-f6bbb57e9c96 --- src/kits/translation/TranslatorRoster.cpp | 14 ++++++++------ 1 file changed, 8 insertions(+), 6 deletions(-) diff --git a/src/kits/translation/TranslatorRoster.cpp b/src/kits/translation/TranslatorRoster.cpp index 1bc6cb51da..22ee1f5017 100644 --- a/src/kits/translation/TranslatorRoster.cpp +++ b/src/kits/translation/TranslatorRoster.cpp @@ -329,9 +329,9 @@ BTranslatorRoster::Version(int32 *outCurVersion, int32 *outMinVersion, static char vDate[] = __DATE__; if (!vString[0]) { sprintf(vString, "Translation Kit v%d.%d.%d %s\n", - B_TRANSLATION_CURRENT_VERSION/100, - (B_TRANSLATION_CURRENT_VERSION/10)%10, - B_TRANSLATION_CURRENT_VERSION%10, + static_cast(B_TRANSLATION_CURRENT_VERSION >> 8), + static_cast((B_TRANSLATION_CURRENT_VERSION >> 4) & 0xf), + static_cast(B_TRANSLATION_CURRENT_VERSION & 0xf), vDate); } *outCurVersion = B_TRANSLATION_CURRENT_VERSION; @@ -807,14 +807,16 @@ BTranslatorRoster::GetAllTranslators( *outCount = 0; if (fSem > 0 && acquire_sem(fSem) == B_OK) { - // count handlers + // count translators translator_node *pTranNode = NULL; for (pTranNode = fpTranslators; pTranNode; pTranNode = pTranNode->next) (*outCount)++; + // because translators are stored in the list backwards, + // populate the outList backwards to produce the original order *outList = new translator_id[*outCount]; - *outCount = 0; + int32 i = (*outCount) - 1; for (pTranNode = fpTranslators; pTranNode; pTranNode = pTranNode->next) - (*outList)[(*outCount)++] = pTranNode->id; + (*outList)[i--] = pTranNode->id; result = B_NO_ERROR; release_sem(fSem);