[haiku-commits] Re: haiku: hrev46529 - src/add-ons/translators/psd

  • From: Jérôme Duval <korli@xxxxxxxxxxxxxxxx>
  • To: haiku-commits@xxxxxxxxxxxxx
  • Date: Thu, 12 Dec 2013 18:01:23 +0100

2013/12/12 Gerasim Troeglazov <3deyes@xxxxxxxxx>:
> +
> +
> +int32
> +PSDLoader::_ColorFormat(void)
> +{
> +       int32 format = PSD_COLOR_FORMAT_UNSUPPORTED;

Could you consider using the enum instead of int32?

> +       if (!fLoaded)
> +               return format;
> +
> +       switch (fColorFormat) {
> +               case PSD_COLOR_MODE_RGB:
> +                       if (fChannels == 3)
> +                               format = PSD_COLOR_FORMAT_RGB_8;
> +                       if (fChannels >= 4)
> +                               format = PSD_COLOR_FORMAT_RGB_A_8;

a 'else if' would be better.

> +                       break;
> +               case PSD_COLOR_MODE_GRAYSCALE:
> +                       if (fChannels == 1)
> +                               format = PSD_COLOR_FORMAT_GRAY_8;
> +                       if (fChannels == 2)
> +                               format = PSD_COLOR_FORMAT_GRAY_A_8;
> +                       break;
> +               case PSD_COLOR_MODE_MULTICHANNEL:
> +                       if (fChannels == 3)
> +                               format = PSD_COLOR_FORMAT_MULTICHANNEL_8;
> +                       break;
> +               case PSD_COLOR_MODE_CMYK:
> +                       if (fChannels == 3)
> +                               format = PSD_COLOR_FORMAT_MULTICHANNEL_8;
> +                       if (fChannels == 4)
> +                               format = PSD_COLOR_FORMAT_CMYK_8;
> +                       if (fChannels > 4)
> +                               format = PSD_COLOR_FORMAT_CMYK_A_8;
> +                       break;
> +               case PSD_COLOR_MODE_LAB:
> +                       if (fChannels == 3)
> +                               format = PSD_COLOR_FORMAT_LAB_8;
> +                       if (fChannels > 3)
> +                               format = PSD_COLOR_FORMAT_LAB_A_8;
> +                       break;
> +               default:
> +                       break;
> +       };
> +
> +       return format;
> +}
> +
> +
>  int
>  PSDLoader::Decode(BPositionIO *target)
>  {

return type should be status_t

Bye,
Jérôme

Other related posts: