sndfile2k  1.2.0
Enumerations | Functions
Error handling

Enumerations

enum  SF_ERR {
  SF_ERR_NO_ERROR = 0, SF_ERR_UNRECOGNISED_FORMAT = 1, SF_ERR_SYSTEM = 2, SF_ERR_MALFORMED_FILE = 3,
  SF_ERR_UNSUPPORTED_ENCODING = 4
}
 Defines public error values. More...
 

Functions

SNDFILE2K_EXPORT int sf_error (SNDFILE *sndfile)
 Returns the current error code for the given SNDFILE. More...
 
SNDFILE2K_EXPORT const char * sf_strerror (SNDFILE *sndfile)
 Returns textual description of the current error code for the given SNDFILE. More...
 
SNDFILE2K_EXPORT const char * sf_error_number (int errnum)
 Returns text description of error code. More...
 
SNDFILE2K_EXPORT int sf_perror (SNDFILE *sndfile)
 Returns internal error code for the given SNDFILE. More...
 
SNDFILE2K_EXPORT int sf_error_str (SNDFILE *sndfile, char *str, size_t len)
 Fills provided buffer with text description of error code for the given SNDFILE. More...
 

Detailed Description

Enumeration Type Documentation

◆ SF_ERR

enum SF_ERR

Defines public error values.

These are guaranteed to remain unchanged for the duration of the library major version number.

There are also a large number of private error numbers which are internal to the library which can change at any time.

Enumerator
SF_ERR_NO_ERROR 

No error (success)

SF_ERR_UNRECOGNISED_FORMAT 

Format not recognised.

SF_ERR_SYSTEM 

System error.

SF_ERR_MALFORMED_FILE 

Supported file format but file is malformed.

SF_ERR_UNSUPPORTED_ENCODING 

Supported file format but unsupported encoding.

Function Documentation

◆ sf_error()

SNDFILE2K_EXPORT int sf_error ( SNDFILE sndfile)

Returns the current error code for the given SNDFILE.

Parameters
[in]sndfilePointer to a sound file state

The error code may be one of SF_ERR values, or any one of many other internal error values.

Applications should only test the return value against SF_ERR values as the internal error values are subject to change at any time.

For errors not in the above list, the function sf_error_number() can be used to convert it to an error string.

Returns
Error number.
See also
sf_error_number()

◆ sf_error_number()

SNDFILE2K_EXPORT const char* sf_error_number ( int  errnum)

Returns text description of error code.

Parameters
[in]errnumError code
Returns
Pointer to the NULL-terminated error description string.
See also
sf_error()

◆ sf_error_str()

SNDFILE2K_EXPORT int sf_error_str ( SNDFILE sndfile,
char *  str,
size_t  len 
)

Fills provided buffer with text description of error code for the given SNDFILE.

Parameters
[in]sndfilePointer to a sound file state
[out]strPointer to an allocated string buffer
[in]lenSize in bytes of str

The error code may be one of SF_ERR values, or any one of many other internal error values.

Deprecated:
sf_error_str() is deprecated and will be dropped from the library at some later date.
Returns
Zero on success or non-zero otherwise.
See also
sf_perror()

◆ sf_perror()

SNDFILE2K_EXPORT int sf_perror ( SNDFILE sndfile)

Returns internal error code for the given SNDFILE.

Parameters
[in]sndfilePointer to a sound file state

The error code may be one of SF_ERR values, or any one of many other internal error values.

Deprecated:
sf_perror() is deprecated and will be dropped from the library at some later date.
Returns
Error code.

\sa sf_error_str()

◆ sf_strerror()

SNDFILE2K_EXPORT const char* sf_strerror ( SNDFILE sndfile)

Returns textual description of the current error code for the given SNDFILE.

Parameters
[in]sndfilePointer to a sound file state
Returns
Pointer to the NULL-terminated error description string.
See also
sf_error()