made [Input | Output]Formats() better handle the case where out_count is NULL and made the functions better handle the case when the number of input or output formats changes

git-svn-id: file:///srv/svn/repos/haiku/trunk/current@2314 a95241bf-73f2-0310-859d-f6bbb57e9c96
This commit is contained in:
Matthew Wilber
2002-12-29 14:56:53 +00:00
parent 032ae6c6e4
commit d4dd380232
@@ -222,10 +222,12 @@ BMPTranslator::TranslatorVersion() const
const translation_format * const translation_format *
BMPTranslator::InputFormats(int32 *out_count) const BMPTranslator::InputFormats(int32 *out_count) const
{ {
if (out_count) if (out_count) {
*out_count = 2; *out_count = sizeof(gInputFormats) /
sizeof(translation_format);
return gInputFormats; return gInputFormats;
} else
return NULL;
} }
// --------------------------------------------------------------- // ---------------------------------------------------------------
@@ -246,10 +248,12 @@ BMPTranslator::InputFormats(int32 *out_count) const
const translation_format * const translation_format *
BMPTranslator::OutputFormats(int32 *out_count) const BMPTranslator::OutputFormats(int32 *out_count) const
{ {
if (out_count) if (out_count) {
*out_count = 2; *out_count = sizeof(gOutputFormats) /
sizeof(translation_format);
return gOutputFormats; return gOutputFormats;
} else
return NULL;
} }
// --------------------------------------------------------------- // ---------------------------------------------------------------