Skip to content
Snippets Groups Projects

Make sure to check the correct flac init return values.

Merged Petter Reinholdtsen requested to merge fix-flac-init-return-values into master

Check for valid return values when calling FLAC__stream_encoder_init_stream() and FLAC__stream_decoder_init_stream().

Handle non-OK return values as an error, instead of looking for return values that can not be returned from these methods. Note, the integer value for both FLAC__STREAM_DECODER_SEARCH_FOR_METADATA, FLAC__STREAM_ENCODER_OK, FLAC__STREAM_DECODER_INIT_STATUS_OK and FLAC__STREAM_ENCODER_INIT_STATUS_OK are all zero, so the behaviour of the code do not change.

This avoid the following compiler message:

  flac.c: In function ‘fs_flac_decode_header’:
  flac.c:269:10: warning: comparison between ‘FLAC__StreamDecoderInitStatus’ and ‘enum <anonymous>’ [-Wenum-compare]
    269 |        ) != FLAC__STREAM_DECODER_SEARCH_FOR_METADATA)
        |          ^~
  flac.c: In function ‘fs_flac_enc_headers’:
  flac.c:610:10: warning: comparison between ‘FLAC__StreamEncoderInitStatus’ and ‘enum <anonymous>’ [-Wenum-compare]
    610 |        ) != FLAC__STREAM_ENCODER_OK)
        |          ^~
Edited by Petter Reinholdtsen

Merge request reports

Loading
Loading

Activity

Filter activity
  • Approvals
  • Assignees & reviewers
  • Comments (from bots)
  • Comments (from users)
  • Commits & branches
  • Edits
  • Labels
  • Lock status
  • Mentions
  • Merge request status
  • Tracking
Please register or sign in to reply
Loading