issue 693: add missing release call in c-export interface.
parent
e6ac1ed66a
commit
70540616ce
|
@ -59,13 +59,37 @@ ASSIMP_API size_t aiGetExportFormatCount(void)
|
|||
|
||||
|
||||
// ------------------------------------------------------------------------------------------------
|
||||
ASSIMP_API const aiExportFormatDesc* aiGetExportFormatDescription( size_t pIndex)
|
||||
ASSIMP_API const aiExportFormatDesc* aiGetExportFormatDescription( size_t index)
|
||||
{
|
||||
// Note: this is valid as the index always pertains to a builtin exporter,
|
||||
// Note: this is valid as the index always pertains to a built-in exporter,
|
||||
// for which the returned structure is guaranteed to be of static storage duration.
|
||||
return Exporter().GetExportFormatDescription(pIndex);
|
||||
const aiExportFormatDesc* orig( Exporter().GetExportFormatDescription( index ) );
|
||||
if (NULL == orig) {
|
||||
return NULL;
|
||||
}
|
||||
|
||||
aiExportFormatDesc *desc = new aiExportFormatDesc;
|
||||
desc->description = new char[ strlen( orig->description ) + 1 ];
|
||||
::strncpy( (char*) desc->description, orig->description, strlen( orig->description ) );
|
||||
desc->fileExtension = new char[ strlen( orig->fileExtension ) + 1 ];
|
||||
::strncpy( ( char* ) desc->fileExtension, orig->fileExtension, strlen( orig->fileExtension ) );
|
||||
desc->id = new char[ strlen( orig->id ) + 1 ];
|
||||
::strncpy( ( char* ) desc->id, orig->id, strlen( orig->id ) );
|
||||
|
||||
return desc;
|
||||
}
|
||||
|
||||
// ------------------------------------------------------------------------------------------------
|
||||
ASSIMP_API void aiReleaseExportFormatDescription( const aiExportFormatDesc *desc ) {
|
||||
if (NULL == desc) {
|
||||
return;
|
||||
}
|
||||
|
||||
delete [] desc->description;
|
||||
delete [] desc->fileExtension;
|
||||
delete [] desc->id;
|
||||
delete desc;
|
||||
}
|
||||
|
||||
// ------------------------------------------------------------------------------------------------
|
||||
ASSIMP_API void aiCopyScene(const aiScene* pIn, aiScene** pOut)
|
||||
|
|
|
@ -86,13 +86,20 @@ ASSIMP_API size_t aiGetExportFormatCount(void);
|
|||
|
||||
// --------------------------------------------------------------------------------
|
||||
/** Returns a description of the nth export file format. Use #aiGetExportFormatCount()
|
||||
* to learn how many export formats are supported.
|
||||
* to learn how many export formats are supported. The description must be released by
|
||||
* calling aiReleaseExportFormatDescription afterwards.
|
||||
* @param pIndex Index of the export format to retrieve information for. Valid range is
|
||||
* 0 to #aiGetExportFormatCount()
|
||||
* @return A description of that specific export format. NULL if pIndex is out of range.
|
||||
*/
|
||||
ASSIMP_API const C_STRUCT aiExportFormatDesc* aiGetExportFormatDescription( size_t pIndex);
|
||||
|
||||
// --------------------------------------------------------------------------------
|
||||
/** Release a description of the nth export file format. Must be returned by
|
||||
* aiGetExportFormatDescription
|
||||
* @param desc Pointer to the description
|
||||
*/
|
||||
ASSIMP_API void aiReleaseExportFormatDescription( const C_STRUCT aiExportFormatDesc *desc );
|
||||
|
||||
// --------------------------------------------------------------------------------
|
||||
/** Create a modifiable copy of a scene.
|
||||
|
|
Loading…
Reference in New Issue