Skip to content

Bring OggzStreamContent enum in line with documented return values.

Petter Reinholdtsen requested to merge oggzstreamcontent-error-codes into master

According to the documentation of oggz_stream_get_content(), it can return values OGGZ_ERR_BAD_OGGZ and OGGZ_ERR_BAD_SERIALNO, neither which is part of the return type enum OggzStreamContent. This causes the following compiler warning and make it impossible to check the return value of this method without a compiler warning:

oggz_stream.c: In function ‘oggz_stream_get_content’:
oggz_stream.c:55:28: warning: implicit conversion from ‘enum OggzError’ to ‘OggzStreamContent’ [-Wenum-conversion]
   55 |   if (oggz == NULL) return OGGZ_ERR_BAD_OGGZ;
      |                            ^~~~~~~~~~~~~~~~~
oggz_stream.c:58:30: warning: implicit conversion from ‘enum OggzError’ to ‘OggzStreamContent’ [-Wenum-conversion]
   58 |   if (stream == NULL) return OGGZ_ERR_BAD_SERIALNO;
      |                              ^~~~~~~~~~~~~~~~~~~~~

This fix provide new enum members OGGZ_CONTENT_ERR_BAD_OGGZ and OGGZ_CONTENT_ERR_BAD_SERIALNO with identical integer values as the OGGZ_ERR_* values, ensuring ABI compatilibity while providing types accepted by the compiler.

Fixes #16 (closed)

Edited by Petter Reinholdtsen

Merge request reports

Loading