From 32898e2a71e62afcaa62d49d0a4b852e06fbc556 Mon Sep 17 00:00:00 2001 From: Matthew Wilber Date: Sun, 29 Dec 2002 14:57:27 +0000 Subject: [PATCH] made [Input | Output]Formats() better handle the case where out_count is NULL and made the functions better handle the cas e when the number of input or output formats changes git-svn-id: file:///srv/svn/repos/haiku/trunk/current@2315 a95241bf-73f2-0310-859d-f6bbb57e9c96 --- .../tgatranslator/TGATranslator.cpp | 20 +++++++++++-------- 1 file changed, 12 insertions(+), 8 deletions(-) diff --git a/src/add-ons/translators/tgatranslator/TGATranslator.cpp b/src/add-ons/translators/tgatranslator/TGATranslator.cpp index 8f21cdb225..3241154593 100644 --- a/src/add-ons/translators/tgatranslator/TGATranslator.cpp +++ b/src/add-ons/translators/tgatranslator/TGATranslator.cpp @@ -234,10 +234,12 @@ TGATranslator::TranslatorVersion() const const translation_format * TGATranslator::InputFormats(int32 *out_count) const { - if (out_count) - *out_count = 2; - - return gInputFormats; + if (out_count) { + *out_count = sizeof(gInputFormats) / + sizeof(translation_format); + return gInputFormats; + } else + return NULL; } // --------------------------------------------------------------- @@ -258,10 +260,12 @@ TGATranslator::InputFormats(int32 *out_count) const const translation_format * TGATranslator::OutputFormats(int32 *out_count) const { - if (out_count) - *out_count = 2; - - return gOutputFormats; + if (out_count) { + *out_count = sizeof(gOutputFormats) / + sizeof(translation_format); + return gOutputFormats; + } else + return NULL; } // ---------------------------------------------------------------