Changeset 4a2ded0bad747c8d671f2321e8ac9e9c556e1d17
- Timestamp:
- 21/10/07 09:12:07
(1 year ago)
- Author:
- Rémi Denis-Courmont <rem@videolan.org>
- git-committer:
- Rémi Denis-Courmont <rem@videolan.org> 1192950727 +0000
- git-parent:
[086d0746ed62770dbd0bdc473c18f41b604f0bb7]
- git-author:
- Rémi Denis-Courmont <rem@videolan.org> 1192950727 +0000
- Message:
libvlc_exception:
- add missing const qualifiers
- prevent exception from being silented in case of ENOMEM
-
Files:
-
Legend:
- Unmodified
- Added
- Removed
- Modified
- Copied
- Moved
| r7b32ae1 |
r4a2ded0 |
|
| 62 | 62 | * \return 0 if no exception raised, 1 else |
|---|
| 63 | 63 | */ |
|---|
| 64 | | VLC_PUBLIC_API int libvlc_exception_raised( libvlc_exception_t *p_exception ); |
|---|
| | 64 | VLC_PUBLIC_API int |
|---|
| | 65 | libvlc_exception_raised( const libvlc_exception_t *p_exception ); |
|---|
| 65 | 66 | |
|---|
| 66 | 67 | /** |
|---|
| … | … | |
| 69 | 70 | * \param psz_message the exception message |
|---|
| 70 | 71 | */ |
|---|
| 71 | | VLC_PUBLIC_API void libvlc_exception_raise( libvlc_exception_t *p_exception, const char *psz_format, ... ); |
|---|
| | 72 | VLC_PUBLIC_API void |
|---|
| | 73 | libvlc_exception_raise( libvlc_exception_t *p_exception, |
|---|
| | 74 | const char *psz_format, ... ); |
|---|
| 72 | 75 | |
|---|
| 73 | 76 | /** |
|---|
| … | … | |
| 84 | 87 | * for example) |
|---|
| 85 | 88 | */ |
|---|
| 86 | | VLC_PUBLIC_API char* libvlc_exception_get_message( libvlc_exception_t *p_exception ); |
|---|
| | 89 | VLC_PUBLIC_API const char * |
|---|
| | 90 | libvlc_exception_get_message( const libvlc_exception_t *p_exception ); |
|---|
| 87 | 91 | |
|---|
| 88 | 92 | /**@} */ |
|---|
| r7b32ae1 |
r4a2ded0 |
|
| 304 | 304 | libvlc_MediaInstanceReachedEnd, |
|---|
| 305 | 305 | libvlc_MediaInstancePositionChanged, |
|---|
| 306 | | |
|---|
| | 306 | |
|---|
| 307 | 307 | libvlc_MediaListItemAdded, |
|---|
| 308 | 308 | libvlc_MediaListItemDeleted, |
|---|
| r6ee1e19 |
r4a2ded0 |
|
| 27 | 27 | #include <vlc_interface.h> |
|---|
| 28 | 28 | |
|---|
| | 29 | static const char nomemstr[] = "Insufficient memory"; |
|---|
| | 30 | |
|---|
| 29 | 31 | /************************************************************************* |
|---|
| 30 | 32 | * Exceptions handling |
|---|
| … | … | |
| 38 | 40 | void libvlc_exception_clear( libvlc_exception_t *p_exception ) |
|---|
| 39 | 41 | { |
|---|
| 40 | | if( p_exception->psz_message ) |
|---|
| | 42 | if( p_exception->psz_message != nomemstr ) |
|---|
| 41 | 43 | free( p_exception->psz_message ); |
|---|
| 42 | 44 | p_exception->psz_message = NULL; |
|---|
| … | … | |
| 44 | 46 | } |
|---|
| 45 | 47 | |
|---|
| 46 | | int libvlc_exception_raised( libvlc_exception_t *p_exception ) |
|---|
| | 48 | int libvlc_exception_raised( const libvlc_exception_t *p_exception ) |
|---|
| 47 | 49 | { |
|---|
| 48 | 50 | return (NULL != p_exception) && p_exception->b_raised; |
|---|
| 49 | 51 | } |
|---|
| 50 | 52 | |
|---|
| 51 | | char *libvlc_exception_get_message( libvlc_exception_t *p_exception ) |
|---|
| | 53 | const char * |
|---|
| | 54 | libvlc_exception_get_message( const libvlc_exception_t *p_exception ) |
|---|
| 52 | 55 | { |
|---|
| 53 | 56 | if( p_exception->b_raised == 1 && p_exception->psz_message ) |
|---|
| … | … | |
| 67 | 70 | |
|---|
| 68 | 71 | /* remove previous exception if it wasn't cleared */ |
|---|
| 69 | | if( p_exception->b_raised && p_exception->psz_message ) |
|---|
| 70 | | free(p_exception->psz_message); |
|---|
| | 72 | libvlc_exception_clear( p_exception ); |
|---|
| 71 | 73 | |
|---|
| 72 | 74 | va_start( args, psz_format ); |
|---|
| 73 | 75 | if( vasprintf( &p_exception->psz_message, psz_format, args ) == -1) |
|---|
| 74 | | p_exception->psz_message = NULL; |
|---|
| | 76 | p_exception->psz_message = (char *)nomemstr; |
|---|
| 75 | 77 | va_end( args ); |
|---|
| 76 | 78 | |
|---|